2015-09-08 18 views
2

我正在使用cfn_pyplates來獲取yaml文件並吐出一個json文件,但是在這裏cfn_pyplates的選項映射有問題。在程序開始時我有這段特殊的代碼。現在我有它,我用來與選項之前訪問「stack_role」 YAML文件[「stack_role」]和曾經工作的成功,但現在引發錯誤:cfn-pyplates的選項映射錯誤

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() 

引發的錯誤:

> 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 

回答

0

找到它了,我正在導入導致此問題的不同文件中的選項。謝謝。