option mapping error with cfn-pyplates
Question: I am using cfn_pyplates to ingest a yaml file and spit out a json file but
have an issue with the option mapping of the cfn_pyplates here. I have this
particular piece of code at the start of the program. Now I have a yaml file
with “stack_role” in it which I used to access before with
options['stack_role’] and used to work successful but now throws the error :

    
    
    import sys
    import os
    sys.path.append(os.path.dirname(os.path.realpath(sys.argv[1])))
    from cfn_pyplates import core, functions
    import djpp
    
    stackName = options['stack_name']
    resources = dict()
    

The error thrown:

    
    
        > SBK-Kaul-PAR:cloudformation-private kaulk$ ./gen.sh dev/ testFile.yaml
        > New python executable in python-virtualenv/bin/python Installing
        > setuptools, pip...done. You are using pip version 6.1.1, however
        > version 7.1.2 is available. You should consider upgrading via the 'pip
        > install --upgrade pip' command. Requirement already satisfied (use
        > --upgrade to upgrade): cfn-pyplates==0.4.3 in ./python-virtualenv/lib/python2.7/site-packages (from -r py_reqs.txt
        > (line 3)) Traceback (most recent call last):   File
        > "/Users/kaulk/sandbox/cloudformation-private/python-virtualenv/bin/cfn_py_generate",
        > line 10, in <module>
        >     sys.exit(generate())   File "/Users/kaulk/sandbox/cloudformation-private/python-virtualenv/lib/python2.7/site-packages/cfn_pyplates/cli.py",
        > line 122, in generate
        >     pyplate = _load_pyplate(args['<pyplate>'], options_mapping)   File "/Users/kaulk/sandbox/cloudformation-private/python-virtualenv/lib/python2.7/site-packages/cfn_pyplates/cli.py",
        > line 40, in _load_pyplate
        >     exec pyplate in exec_namespace   File "gen.py", line 5, in <module>
        >     import djpp   File "/Users/kaulk/sandbox/cloudformation-private/djpp/__init__.py", line
        > 1, in <module>
        >     from djpp import ec2, cloudformation, elb, inject   File "/Users/kaulk/sandbox/cloudformation-private/djpp/cloudformation.py",
        > line 1, in <module>
        >     import inspect, gen   File "/Users/kaulk/sandbox/cloudformation-private/gen.py", line 7, in
        > <module>
        >     stackName = options['stack_name'] NameError: name 'options' is not defined
    


Answer: found it, i was importing options in a different file which was causing this
issue. Thanks.

