cfnpyplates的选项映射错误

2024-09-27 17:58:02 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用cfn\u pyplates来接收yaml文件并输出json文件,但是这里的cfn\u pyplates的选项映射有问题。我在程序的开头有一段特殊的代码。现在,我有一个yaml文件,其中包含“stack\u role”,我以前使用options['stack\u role']访问它,过去它工作成功,但现在抛出错误:

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

Tags: inpyimportvirtualenvlineprivateusersfile

热门问题