@@ -90,12 +90,10 @@ def deploy(self, namespace, name, image, entrypoint, command, **kwargs): # noqa
9090 app_type = kwargs .get ('app_type' )
9191 routable = kwargs .get ('routable' , False )
9292 service_annotations = kwargs .get ('service_annotations' , {})
93- envs = kwargs .get ('envs' , {})
94- port = envs .get ('PORT' , None )
93+ port = kwargs .get ('envs' , {}).get ('PORT' , None )
9594
9695 # create a deployment if missing, otherwise update to trigger a release
9796 try :
98- deployment = self .get_deployment (namespace , name ).json ()
9997 # labels that represent the pod(s)
10098 version = kwargs .get ('version' )
10199 labels = {
@@ -105,6 +103,7 @@ def deploy(self, namespace, name, image, entrypoint, command, **kwargs): # noqa
105103 'heritage' : 'deis' ,
106104 }
107105 # this depends on the deployment object having the latest information
106+ deployment = self .get_deployment (namespace , name ).json ()
108107 if deployment ['spec' ]['template' ]['metadata' ]['labels' ] == labels :
109108 self .log (namespace , 'Deployment {} with release {} already exists. Stopping deploy' .format (name , version )) # noqa
110109 return
@@ -135,7 +134,7 @@ def deploy(self, namespace, name, image, entrypoint, command, **kwargs): # noqa
135134 # Make sure the application is routable and uses the correct port
136135 # Done after the fact to let initial deploy settle before routing
137136 # traffic to the application
138- self ._update_application_service (namespace , name , app_type , port , routable , service_annotations ) # noqa
137+ self ._update_application_service (namespace , app_type , port , routable , service_annotations ) # noqa
139138
140139 def cleanup_release (self , namespace , controller , timeout ):
141140 """
@@ -177,7 +176,7 @@ def _get_deploy_batches(self, steps, desired):
177176
178177 return batches
179178
180- def _update_application_service (self , namespace , name , app_type , port , routable = False , annotations = {}): # noqa
179+ def _update_application_service (self , namespace , app_type , port , routable = False , annotations = {}): # noqa
181180 """Update application service with all the various required information"""
182181 service = self .get_service (namespace , namespace ).json ()
183182 old_service = service .copy () # in case anything fails for rollback
0 commit comments