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

file lookup returning <type 'unicode'> where it previously returned <class 'troposphere.AWSHelperFn'> #645

Closed
ITProKyle opened this issue Aug 8, 2018 · 2 comments · Fixed by #646

Comments

@ITProKyle
Copy link
Contributor

ITProKyle commented Aug 8, 2018

As of 1.4.0, the use of the ${file parameterized } lookup no longer works with blueprints using variable type of troposphere.AWSHelperFn. This was working in previous versions - most recently 1.3.0.

Error

File "/usr/local/lib/python2.7/site-packages/stacker/plan.py", line 93, in _run_once
  status = self.fn(self.stack, status=self.status)
File "/usr/local/lib/python2.7/site-packages/stacker/actions/build.py", line 321, in _launch_stack
  stack.resolve(self.context, self.provider)
File "/usr/local/lib/python2.7/site-packages/stacker/stack.py", line 196, in resolve
  self.blueprint.resolve_variables(self.variables)
File "/usr/local/lib/python2.7/site-packages/stacker/blueprints/base.py", line 452, in resolve_variables
  self.name
File "/usr/local/lib/python2.7/site-packages/stacker/blueprints/base.py", line 226, in resolve_variable
  value = validate_variable_type(var_name, var_type, value)
File "/usr/local/lib/python2.7/site-packages/stacker/blueprints/base.py", line 147, in validate_variable_type
  "type: %s." % (var_name, var_type, type(value))
ValueError: Value for variable ExampleParameter must be of type <class 'troposphere.AWSHelperFn'>. Actual type: <type 'unicode'>.

System Information

Operating System: Mac OS X 10.13.6 build 17G65
Python Version: 2.7.14
Stacker Version: 1.4.0

Files

├── top-level-folder
│   ├── blueprints
│   │   ├── __init__.py
│   │   └── example_blueprint.py
│   ├── file-to-reference.json
│   ├── example.env
│   └── stacker-config.yaml

stacker-config.yaml

namespace: example
stacker_bucket: ""

sys_path: ./

stacks:
  example-stack:
    class_path: blueprints.example_blueprint.BlueprintClass
    enabled: true
    variables:
      ExampleParameter: ${file parameterized:file://file-to-reference.json}

blueprints/example_blueprint.py

from troposphere import AWSHelperFn
from stacker.blueprints.base import Blueprint

class BlueprintClass(Blueprint):

    VARIABLES = {
        'ExampleParameter': {
            'type': AWSHelperFn
        }
    }
@troyready
Copy link
Contributor

troyready added a commit to troyready/stacker that referenced this issue Aug 8, 2018
Previously, file was reported to return `GenericHelperFn`, when it in
fact would return either `GenericHelperFn` or `Base64`. Updated the
docstring to reflect their common base class instead.

Also updated the function to fix a regression where a string was
sometimes being returned instead.

Fixes cloudtools#645
@xiaket
Copy link
Contributor

xiaket commented Aug 8, 2018

@troyready when I was reading this I was really afraid that I messed up in the Python 3 support... That's a huge relief. :D

phobologic pushed a commit that referenced this issue Aug 12, 2018
Previously, file was reported to return `GenericHelperFn`, when it in
fact would return either `GenericHelperFn` or `Base64`. Updated the
docstring to reflect their common base class instead.

Also updated the function to fix a regression where a string was
sometimes being returned instead.

Fixes #645
phrohdoh pushed a commit to phrohdoh/stacker that referenced this issue Dec 18, 2018
Previously, file was reported to return `GenericHelperFn`, when it in
fact would return either `GenericHelperFn` or `Base64`. Updated the
docstring to reflect their common base class instead.

Also updated the function to fix a regression where a string was
sometimes being returned instead.

Fixes cloudtools#645
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants