Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Make orchestrator command Windows aware #4142

Merged
merged 2 commits into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/orchestrators.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type orchestratorsCmd struct {
// user input
orchestrator string
version string
windows bool
}

func newOrchestratorsCmd() *cobra.Command {
Expand All @@ -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)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a note here that the windows flag applies to the Kubernetes orchestrator only?

For example: 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
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/api/orchestrators.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fine to keep current behavior as-is

if err != nil {
return nil, err
}
Expand All @@ -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
Expand All @@ -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
}
}
Expand Down