开发者

fabric - $(env_name) not getting set

开发者 https://www.devze.com 2023-01-29 08:28 出处:网络
I would like to create env variables once to use elsewhere in my fabric file.For e开发者_如何学Pythonxample:

I would like to create env variables once to use elsewhere in my fabric file. For e开发者_如何学Pythonxample:

from fabric.api import *

# environments
def dtconfig():
    env.path = 'David'
# tasks
def hello():
    require('path', provided_by=[dtconfig])
    print (env.path)
    print ('Hello $(path)')
    print ('Hello ' + env.path)

The output from running 'fab dtconfig hello' is:

David
Hello $(path)
Hello David

Why doesn't the $(path) get replaced with 'David'? thx


Looks like bash variables were removed in later versions of fabric. just used plain old %s string substitutions instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消