Skip to content

Commit

Permalink
Pass --location to containerService (Azure#2381)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsacavdm authored and Terje Torkelsen committed Mar 15, 2018
1 parent c80ad72 commit 819e829
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,20 @@ func (dc *deployCmd) validate(cmd *cobra.Command, args []string) error {
Locale: dc.locale,
},
}

if dc.location == "" {
return fmt.Errorf(fmt.Sprintf("--location must be specified"))
}
// skip validating the model fields for now
dc.containerService, dc.apiVersion, err = apiloader.LoadContainerServiceFromFile(dc.apimodelPath, false, false, nil)
if err != nil {
return fmt.Errorf(fmt.Sprintf("error parsing the api model: %s", err.Error()))
}

if dc.location == "" {
return fmt.Errorf(fmt.Sprintf("--location must be specified"))
if dc.containerService.Location == "" {
dc.containerService.Location = dc.location
} else if dc.containerService.Location != dc.location {
return fmt.Errorf(fmt.Sprintf("--location does not match api model location"))
}

dc.client, err = dc.authArgs.getClient()
Expand Down
6 changes: 6 additions & 0 deletions cmd/scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ func (sc *scaleCmd) validate(cmd *cobra.Command, args []string) {
log.Fatalf("error parsing the api model: %s", err.Error())
}

if sc.containerService.Location == "" {
sc.containerService.Location = sc.location
} else if sc.containerService.Location != sc.location {
log.Fatalf("--location does not match api model location")
}

if sc.agentPoolToScale == "" {
agentPoolCount := len(sc.containerService.Properties.AgentPoolProfiles)
if agentPoolCount > 1 {
Expand Down
6 changes: 6 additions & 0 deletions cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ func (uc *upgradeCmd) validate(cmd *cobra.Command, args []string) {
log.Fatalf("error parsing the api model: %s", err.Error())
}

if uc.containerService.Location == "" {
uc.containerService.Location = uc.location
} else if uc.containerService.Location != uc.location {
log.Fatalf("--location does not match api model location")
}

// get available upgrades for container service
orchestratorInfo, err := api.GetOrchestratorVersionProfile(uc.containerService.Properties.OrchestratorProfile)
if err != nil {
Expand Down

0 comments on commit 819e829

Please sign in to comment.