Skip to content

Commit

Permalink
Merge branch 'main' into DUPLO-13421_Resource-as-functions_Kelly-Ferrone
Browse files Browse the repository at this point in the history
  • Loading branch information
kferrone authored Jan 9, 2024
2 parents 0a53d21 + 5efda8f commit ef91988
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/duplo_resource/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,19 @@ def update_image(self,
"""
tenant_id = self.tenant["TenantId"]
service = self.find(name)
allocation_tags = service["Template"]["AllocationTags"]
data = {
"Name": name,
"Image": image,
"AllocationTags": allocation_tags
}
self.duplo.post(f"subscriptions/{tenant_id}/ReplicationControllerChange", data)
current_image = None
for container in service["Template"]["Containers"]:
if container["Name"] == name:
current_image = container["Image"]
if(current_image == image):
self.duplo.post(f"subscriptions/{tenant_id}/ReplicationControllerReboot/{name}")
else:
data = {
"Name": name,
"Image": image,
"AllocationTags": service["Template"]["AllocationTags"]
}
self.duplo.post(f"subscriptions/{tenant_id}/ReplicationControllerChange", data)
return {"message": f"Successfully updated image for service '{name}'"}

@Command()
Expand Down

0 comments on commit ef91988

Please sign in to comment.