@@ -54,8 +54,6 @@ func UpdateAPI(
5454
5555 api := getAPISpec (apiConfig , projectID , deploymentID )
5656
57- var msg string
58-
5957 if prevDeployment == nil {
6058 err = config .AWS .UploadMsgpackToS3 (api , * config .Cluster .Bucket , api .Key )
6159 if err != nil {
@@ -65,9 +63,10 @@ func UpdateAPI(
6563 go deleteK8sResources (api .Name )
6664 return nil , "" , err
6765 }
68- msg = fmt .Sprintf ("creating %s api" , api .Name )
66+ return api , fmt .Sprintf ("creating %s api" , api .Name ), nil
67+ }
6968
70- } else if ! areDeploymentsEqual (prevDeployment , deploymentSpec (api , prevDeployment )) {
69+ if ! areDeploymentsEqual (prevDeployment , deploymentSpec (api , prevDeployment )) {
7170 isUpdating , err := isAPIUpdating (prevDeployment )
7271 if err != nil {
7372 return nil , "" , err
@@ -82,21 +81,18 @@ func UpdateAPI(
8281 if err = applyK8sResources (api , prevDeployment , prevService , prevVirtualService ); err != nil {
8382 return nil , "" , err
8483 }
85- msg = fmt .Sprintf ("updating %s api" , api .Name )
86-
87- } else { // deployment didn't change
88- isUpdating , err := isAPIUpdating (prevDeployment )
89- if err != nil {
90- return nil , "" , err
91- }
92- if isUpdating {
93- msg = fmt .Sprintf ("%s api is already updating" , api .Name )
94- } else {
95- msg = fmt .Sprintf ("%s api is up to date" , api .Name )
96- }
84+ return api , fmt .Sprintf ("updating %s api" , api .Name ), nil
9785 }
9886
99- return api , msg , nil
87+ // deployment didn't change
88+ isUpdating , err := isAPIUpdating (prevDeployment )
89+ if err != nil {
90+ return nil , "" , err
91+ }
92+ if isUpdating {
93+ return api , fmt .Sprintf ("%s api is already updating" , api .Name ), nil
94+ }
95+ return api , fmt .Sprintf ("%s api is up to date" , api .Name ), nil
10096}
10197
10298func RefreshAPI (apiName string , force bool ) (string , error ) {
0 commit comments