func (r MountMap) AppendSysResource(sr string, sys *system.System, config util.Config) (*Mount, error) { sysres := sys.NewMount(sr, sys, config) res, err := NewMount(sysres, config) if err != nil { return nil, err } if old_res, ok := r[res.ID()]; ok { res.Title = old_res.Title res.Meta = old_res.Meta } r[res.ID()] = res return res, nil }
func (r MountMap) AppendSysResourceIfExists(sr string, sys *system.System) (*Mount, system.Mount, bool) { sysres := sys.NewMount(sr, sys, util.Config{}) // FIXME: Do we want to be silent about errors? res, _ := NewMount(sysres, util.Config{}) if e, _ := sysres.Exists(); e != true { return res, sysres, false } if old_res, ok := r[res.ID()]; ok { res.Title = old_res.Title res.Meta = old_res.Meta } r[res.ID()] = res return res, sysres, true }
func (m *Mount) Validate(sys *system.System) []TestResult { skip := false sysMount := sys.NewMount(m.MountPoint, sys, util.Config{}) var results []TestResult results = append(results, ValidateValue(m, "exists", m.Exists, sysMount.Exists, skip)) if shouldSkip(results) { skip = true } if m.Opts != nil { results = append(results, ValidateValue(m, "opts", m.Opts, sysMount.Opts, skip)) } if m.Source != nil { results = append(results, ValidateValue(m, "source", m.Source, sysMount.Source, skip)) } if m.Filesystem != nil { results = append(results, ValidateValue(m, "filesystem", m.Filesystem, sysMount.Filesystem, skip)) } return results }