func (d *daemonState) loadProfiles(profileDir string) (oz.Profiles, error) { ps, err := oz.LoadProfiles(profileDir) if err != nil { return nil, err } d.Debug("%d profiles loaded", len(ps)) return ps, nil }
func loadProfile(dir, name string) (*oz.Profile, error) { ps, err := oz.LoadProfiles(dir) if err != nil { return nil, err } for _, p := range ps { if name == p.Name { return p, nil } } return nil, fmt.Errorf("no profile named '%s'", name) }
func loadProfile(name, profileDir string) (*oz.Profile, error) { ps, err := oz.LoadProfiles(profileDir) if err != nil { return nil, err } p, err := ps.GetProfileByName(name) if err != nil || p == nil { return ps.GetProfileByPath(name) } return p, nil }
func handleConfigcheck(c *cli.Context) { _, err := oz.LoadConfig(oz.DefaultConfigPath) if err != nil { if !os.IsNotExist(err) { fmt.Fprintf(os.Stderr, "Could not load configuration `%s`: %v\n", oz.DefaultConfigPath, err) os.Exit(1) } } OzConfig = loadConfig() _, err = oz.LoadProfiles(OzConfig.ProfileDir) if err != nil { fmt.Fprintf(os.Stderr, "Unable to load profiles from `%s`: %v\n", OzConfig.ProfileDir, err) os.Exit(1) } fmt.Println("Configurations and profiles ok!") os.Exit(0) }