Beispiel #1
0
func (f *ArchiveFlag) ReadEnvelope(fpath string) (*ovf.Envelope, error) {
	if fpath == "" {
		return nil, nil
	}

	r, _, err := f.Open(fpath)
	if err != nil {
		return nil, err
	}
	defer r.Close()

	e, err := ovf.Unmarshal(r)
	if err != nil {
		return nil, fmt.Errorf("failed to parse ovf: %s", err.Error())
	}

	return e, nil
}
Beispiel #2
0
func (cmd *ovfx) ReadEnvelope(fpath string) (*ovf.Envelope, error) {
	if fpath == "" {
		return nil, nil
	}

	f, _, err := cmd.Open(fpath)
	if err != nil {
		return nil, err
	}
	defer f.Close()

	e, err := ovf.Unmarshal(f)
	if err != nil {
		return nil, fmt.Errorf("failed to parse ovf: %s", err.Error())
	}

	return e, nil
}