How to discover current role in Python Fabric

前端 未结 5 396
既然无缘
既然无缘 2021-02-02 10:24

This is a very Fabric specific question, but more experienced python hackers might be able to answer this, even if they don\'t know Fabric.

I am trying to specify differ

5条回答
  •  盖世英雄少女心
    2021-02-02 11:03

    The env.roles will give you the roles specified by -R flag or hardcoded in the script itself. It won't contain the roles specified per task using the command line or using @roles decorator. There is currently no way of getting this kind of information.

    The next release of fabric (1.9 probably) will provide env.effective_roles attribute with exactly what you want - the roles being used for the currently executed task. The code for that has already been merged into master.

    Have a look at this issue.

提交回复
热议问题