Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Static module deploy fails #360

Closed
paul-duffy opened this issue Jun 8, 2020 · 1 comment · Fixed by #361
Closed

[BUG] Static module deploy fails #360

paul-duffy opened this issue Jun 8, 2020 · 1 comment · Fixed by #361
Assignees
Labels
bug Something isn't working priority:critical Critical priority issue or pull request

Comments

@paul-duffy
Copy link

Describe the bug
When using the newest version of runway (1.8.1) static modules are not able to be deployed. The following error is show:

TypeError: <class 'troposphere.s3.BucketPolicy'>: BucketPolicy.PolicyDocument is <class 'awacs.aws.Policy'>, expected (<class 'dict'>, <class 'awacs.aws.Policy'>, <class 'awacs.aws.PolicyDocument'>)

To Reproduce
Steps to reproduce the behavior:

  1. pipenv --python 3
  2. pipenv install -d runway==1.8.1
  3. pipenv run runway gen-sample static-angular
  4. cd static-angular
  5. DEPLOY_ENVIRONMENT=dev pipenv run runway deploy
ERROR:runway.cfngin.plan:<class 'troposphere.s3.BucketPolicy'>: BucketPolicy.PolicyDocument is <class 'awacs.aws.Policy'>, expected (<class 'dict'>, <class 'awacs.aws.Policy'>, <class 'awacs.aws.PolicyDocument'>)
Traceback (most recent call last):
  File "/Users/pduffy/.local/share/virtualenvs/bugs-awxQH1y6/lib/python3.7/site-packages/runway/cfngin/plan.py", line 142, in _run_once
    status = self.fn(self.stack, status=self.status)
  File "/Users/pduffy/.local/share/virtualenvs/bugs-awxQH1y6/lib/python3.7/site-packages/runway/cfngin/actions/build.py", line 360, in _launch_stack
    template = self._template(stack.blueprint)
  File "/Users/pduffy/.local/share/virtualenvs/bugs-awxQH1y6/lib/python3.7/site-packages/runway/cfngin/actions/build.py", line 423, in _template
    return Template(body=blueprint.rendered)
  File "/Users/pduffy/.local/share/virtualenvs/bugs-awxQH1y6/lib/python3.7/site-packages/runway/cfngin/blueprints/base.py", line 563, in rendered
    self._version, self._rendered = self.render_template()
  File "/Users/pduffy/.local/share/virtualenvs/bugs-awxQH1y6/lib/python3.7/site-packages/runway/cfngin/blueprints/base.py", line 482, in render_template
    self.create_template()
  File "/Users/pduffy/.local/share/virtualenvs/bugs-awxQH1y6/lib/python3.7/site-packages/runway/blueprints/staticsite/staticsite.py", line 148, in create_template
    self.add_bucket_policy(bucket)
  File "/Users/pduffy/.local/share/virtualenvs/bugs-awxQH1y6/lib/python3.7/site-packages/runway/blueprints/staticsite/staticsite.py", line 329, in add_bucket_policy
    Join('', [bucket.get_att('Arn'), '/*'])
  File "/Users/pduffy/.local/share/virtualenvs/bugs-awxQH1y6/lib/python3.7/site-packages/troposphere/__init__.py", line 127, in __init__
    self.__setattr__(k, v)
  File "/Users/pduffy/.local/share/virtualenvs/bugs-awxQH1y6/lib/python3.7/site-packages/troposphere/__init__.py", line 214, in __setattr__
    self._raise_type(name, value, expected_type)
  File "/Users/pduffy/.local/share/virtualenvs/bugs-awxQH1y6/lib/python3.7/site-packages/troposphere/__init__.py", line 232, in _raise_type
    expected_type))
TypeError: <class 'troposphere.s3.BucketPolicy'>: BucketPolicy.PolicyDocument is <class 'awacs.aws.Policy'>, expected (<class 'dict'>, <class 'awacs.aws.Policy'>, <class 'awacs.aws.PolicyDocument'>)
INFO:runway.cfngin.ui:sample-app: failed (<class 'troposphere.s3.BucketPolicy'>: BucketPolicy.PolicyDocument is <class 'awacs.aws.Policy'>, expected (<class 'dict'>, <class 'awacs.aws.Policy'>, <class 'awacs.aws.PolicyDocument'>))
ERROR:runway.cfngin.actions.base:The following steps failed: sample-app

Expected behavior
The static site is deployed.

Desktop (please complete the following information):

  • OS: macOS
  • Version: 10.15.4

Additional context
Works in version 1.8.0.

@paul-duffy paul-duffy added bug Something isn't working priority:low Low priority issue or pull request status:review_needed Issue or pull request needs reviewed labels Jun 8, 2020
@ITProKyle ITProKyle added priority:critical Critical priority issue or pull request and removed priority:low Low priority issue or pull request status:review_needed Issue or pull request needs reviewed labels Jun 9, 2020
@ITProKyle
Copy link
Collaborator

This impacts all CFNgin modules using blueprints.

The root cause was introduced in #351 which unloads modules, including portions of awacs and troposphere. Because troposphere is being imported as part of the Blueprint base class's components, it is not completely unloaded. The remains result in type comparisons to class instances from the unloaded import which do not match subsequent imports.

troyready pushed a commit that referenced this issue Jun 9, 2020
… isinstance inconsistencies (#361)

* fix module not subscriptable

introduced in #354

* exclude awacs and troposphere from cfngin sys.modules unload

bug introduced in #351
resolves #360

* update cfngin test with new call args

* add test for sys_module_exclude
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority:critical Critical priority issue or pull request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants