How to discover current role in Python Fabric

前端 未结 5 387
既然无缘
既然无缘 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:12

    I didn't test it, but might work:

    def _get_current_role():
        for role in env.roledefs.keys():
            if env.host_string in env.roledefs[role]:
                return role
        return None
    

提交回复
热议问题