gpt4 book ai didi

python - Fabric "TypeError: not all arguments converted during string formatting"

转载 作者:行者123 更新时间:2023-12-01 05:59:56 28 4
gpt4 key购买 nike

我有以下结构任务:

@task
def deploy_west_ec2_ami(name, puppetClass, size='m1.small', region='us-west-1', basedn='joe', ldap='arch-ldap-01', secret='secret', subnet='subnet-d43b8abd', sgroup='sg-926578fe'):
execute(deploy_ec2_ami, name='%s',puppetClass='%s',size='%s',region='%s',basedn='%s',ldap='%s',secret='%s',subnet='%s',sgroup='%s' %(name, puppetClass, size, region, basedn, ldap, secret, subnet, sgroup))

但是当我运行命令时:

fab deploy_west_ec2_ami:test,java

我得到以下回溯:

            Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/fabric/main.py", line 710, in main
*args, **kwargs
File "/usr/local/lib/python2.6/dist-packages/fabric/tasks.py", line 321, in execute
results['<local-only>'] = task.run(*args, **new_kwargs)
File "/usr/local/lib/python2.6/dist-packages/fabric/tasks.py", line 113, in run
return self.wrapped(*args, **kwargs)
File "/home/bcarpio/Projects/githubenterprise/awsdeploy/fabfile.py", line 35, in deploy_west_ec2_ami
execute(deploy_ec2_ami, name='%s',puppetClass='%s',size='%s',region='%s',basedn='%s',ldap='%s',secret='%s',subnet='%s',sgroup='%s' %(name, puppetClass, size, region, basedn, ldap, secret, subnet, sgroup))
TypeError: not all arguments converted during string formatting

我不确定我明白为什么。我很确定我已经定义了这里的所有值。

此外,当我运行执行任务deploy_ec2_ami时:

deploy_ec2_ami:test,java,m1.small,us-west-1,'dc\=test\,dc\=net',ldap-01,secret,subnet-d43b8abd,sg-926578fe

效果很好

最佳答案

好吧,问题是在使用execute时你必须定义一个host=。我的其他 fab 任务不需要 host= 所以我只是输入常规的 python:

deploy_ec2_ami (name, puppetClass, size, region, basedn, ldap, secret, subnet, sgroup)

一切都很顺利。

关于python - Fabric "TypeError: not all arguments converted during string formatting",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10984044/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com