From 532f41d0783b317086c7da3ea1e648c2fb770dbd Mon Sep 17 00:00:00 2001 From: William H Date: Wed, 14 Nov 2018 14:01:13 -0500 Subject: [PATCH] Make orchestrator command Windows aware (#4142) --- cmd/orchestrators.go | 4 +++- pkg/api/orchestrators.go | 10 +++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/orchestrators.go b/cmd/orchestrators.go index c19c21453..4a5066a03 100644 --- a/cmd/orchestrators.go +++ b/cmd/orchestrators.go @@ -18,6 +18,7 @@ type orchestratorsCmd struct { // user input orchestrator string version string + windows bool } func newOrchestratorsCmd() *cobra.Command { @@ -35,12 +36,13 @@ func newOrchestratorsCmd() *cobra.Command { f := command.Flags() f.StringVar(&oc.orchestrator, "orchestrator", "", "orchestrator name (optional) ") f.StringVar(&oc.version, "version", "", "orchestrator version (optional)") + f.BoolVar(&oc.windows, "windows", false, "orchestrator platform (optional, applies to Kubernetes only)") return command } func (oc *orchestratorsCmd) run(cmd *cobra.Command, args []string) error { - orchs, err := api.GetOrchestratorVersionProfileListVLabs(oc.orchestrator, oc.version) + orchs, err := api.GetOrchestratorVersionProfileListVLabs(oc.orchestrator, oc.version, oc.windows) if err != nil { return err } diff --git a/pkg/api/orchestrators.go b/pkg/api/orchestrators.go index 2c6f9673b..5a9549ead 100644 --- a/pkg/api/orchestrators.go +++ b/pkg/api/orchestrators.go @@ -68,8 +68,8 @@ func isVersionSupported(csOrch *OrchestratorProfile) bool { } // GetOrchestratorVersionProfileListVLabs returns vlabs OrchestratorVersionProfileList object per (optionally) specified orchestrator and version -func GetOrchestratorVersionProfileListVLabs(orchestrator, version string) (*vlabs.OrchestratorVersionProfileList, error) { - apiOrchs, err := getOrchestratorVersionProfileList(orchestrator, version) +func GetOrchestratorVersionProfileListVLabs(orchestrator, version string, windows bool) (*vlabs.OrchestratorVersionProfileList, error) { + apiOrchs, err := getOrchestratorVersionProfileList(orchestrator, version, windows) if err != nil { return nil, err } @@ -83,7 +83,7 @@ func GetOrchestratorVersionProfileListVLabs(orchestrator, version string) (*vlab // GetOrchestratorVersionProfileListV20170930 returns v20170930 OrchestratorVersionProfileList object per (optionally) specified orchestrator and version func GetOrchestratorVersionProfileListV20170930(orchestrator, version string) (*v20170930.OrchestratorVersionProfileList, error) { - apiOrchs, err := getOrchestratorVersionProfileList(orchestrator, version) + apiOrchs, err := getOrchestratorVersionProfileList(orchestrator, version, false) if err != nil { return nil, err } @@ -94,7 +94,7 @@ func GetOrchestratorVersionProfileListV20170930(orchestrator, version string) (* return orchList, nil } -func getOrchestratorVersionProfileList(orchestrator, version string) ([]*OrchestratorVersionProfile, error) { +func getOrchestratorVersionProfileList(orchestrator, version string, windows bool) ([]*OrchestratorVersionProfile, error) { var err error if orchestrator, err = validate(orchestrator, version); err != nil { return nil, err @@ -110,7 +110,7 @@ func getOrchestratorVersionProfileList(orchestrator, version string) ([]*Orchest orchs = append(orchs, arr...) } } else { - if orchs, err = funcmap[orchestrator](&OrchestratorProfile{OrchestratorType: orchestrator, OrchestratorVersion: version}, false); err != nil { + if orchs, err = funcmap[orchestrator](&OrchestratorProfile{OrchestratorType: orchestrator, OrchestratorVersion: version}, windows); err != nil { return nil, err } }