stateMap, err := state.StateMapFromYamlPath(GetStatePath(cmd.Flag("state"))) if err != nil { return err } if cmd.Flag("local").Changed { DumpResults(stateMap.Apply()) return nil } else { client, err := clients.NewOtterClient(GetEtcdUrls(cmd.Flag("etcd"))) if err != nil { return err } data, err := stateMap.ToJson() if err != nil { return err } client.SubmitState(string(data)) resultMap, err := client.SubmitCommands("*", "apply") if err != nil { return err } DumpResults(resultMap) } return nil }, } func init() { RootCmd.AddCommand(applyCmd) }
stateMap, err := state.StateMapFromYamlPath(GetStatePath(cmd.Flag("state"))) if err != nil { return err } if cmd.Flag("local").Changed { DumpResults(stateMap.State()) return nil } else { client, err := clients.NewOtterClient(GetEtcdUrls(cmd.Flag("etcd"))) data, err := stateMap.ToJson() if err != nil { return err } client.SubmitState(string(data)) if err != nil { return err } resultMap, err := client.SubmitCommands("*", "state") if err != nil { return err } DumpResults(resultMap) } return nil }, } func init() { RootCmd.AddCommand(stateCmd) }