caltechads / deployfish

Manage your whole application lifecycle in Amazon AWS ECS.
http://deployfish.readthedocs.io
Other
90 stars 20 forks source link

KeyError: 'serviceRegistries' #23

Closed afosterw closed 6 years ago

afosterw commented 6 years ago

With config:

services:
  - name: test-service1
    cluster: test-cluster1
    count: 1
    family: test1
    network_mode: bridge
    containers:
      - name: test_container1
        image: <account_id_removed>.dkr.ecr.us-west-2.amazonaws.com/test_service:dev.latest
        cpu: 128
        memory: 512
        ports:
          - "80"
          - "443"
Traceback (most recent call last):
  File "/home/afosterw/.virtualenvs/lovepop-cli/bin/deploy", line 11, in <module>
    load_entry_point('deployfish', 'console_scripts', 'deploy')()
  File "/home/afosterw/lovepop/deployfish/deployfish/dplycli.py", line 656, in main
    cli(obj={})
  File "/home/afosterw/.virtualenvs/lovepop-cli/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/afosterw/.virtualenvs/lovepop-cli/local/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/afosterw/.virtualenvs/lovepop-cli/local/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/afosterw/.virtualenvs/lovepop-cli/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/afosterw/.virtualenvs/lovepop-cli/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/afosterw/.virtualenvs/lovepop-cli/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/afosterw/lovepop/deployfish/deployfish/dplycli.py", line 196, in create
    service.create()
  File "/home/afosterw/lovepop/deployfish/deployfish/aws/ecs.py", line 1315, in create
    self.from_aws()
  File "/home/afosterw/lovepop/deployfish/deployfish/aws/ecs.py", line 1278, in from_aws
    if self.__aws_service['serviceRegistries']:
KeyError: 'serviceRegistries'
cmalek commented 6 years ago

Were you creating or updating your service?

cmalek commented 6 years ago

Also, what version of boto3 do you have installed?

afosterw commented 6 years ago

It happens on info, create and delete:

boto==2.46.1 boto3==1.5.18 botocore==1.8.39

I fixed locally with this change:

diff --git a/deployfish/aws/ecs.py b/deployfish/aws/ecs.py
index d472abe..724cf60 100644
--- a/deployfish/aws/ecs.py
+++ b/deployfish/aws/ecs.py
@@ -1273,7 +1273,7 @@ class Service(object):
                 for t in self.tasks.values():
                     t.from_aws(helpers[t.family])

-            if self.__aws_service['serviceRegistries']:
+            if 'serviceRegistries' in self.__aws_service:
                 self.serviceDiscovery = ServiceDiscovery(self.service_discovery[0]['registryArn'])
             else:
                 self.serviceDiscovery = None
cmalek commented 6 years ago

Ah, those are old versions of boto3 and botocore. Could you update to latest and try again?

Current is:

boto3==1.7.49 botocore==1.10.49

You need to keep botocore and boto3 up to date so they can match changes to the upstream AWS API.

cmalek commented 6 years ago

Yes, looking through the changelogs for botocore, the 'serviceRegistries' keyword was added in botocore==1.9.15, so the minimum requirement for boto3 looks like it would be 1.6.15.

I'll update the requirements appropriately.

cmalek commented 6 years ago

I've released the requirements change to PyPi as deployfish==0.21.1 .

afosterw commented 6 years ago

Thanks! I've updated to the latest boto/botocore and it's resolved on my end.

On Tue, Jul 3, 2018 at 3:54 PM, Chris Malek notifications@github.com wrote:

I've released the requirements change to PyPi as deployfish==0.21.1 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/caltechads/deployfish/issues/23#issuecomment-402274250, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmMWo9y4J-i0OF_xOFGQGzt-xMtzTT0ks5uC8vpgaJpZM4VBf7w .