本文整理汇总了Python中ansible.playbook.task.Task._get_parent_attribute方法的典型用法代码示例。如果您正苦于以下问题:Python Task._get_parent_attribute方法的具体用法?Python Task._get_parent_attribute怎么用?Python Task._get_parent_attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ansible.playbook.task.Task
的用法示例。
在下文中一共展示了Task._get_parent_attribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: blocks
# 需要导入模块: from ansible.playbook.task import Task [as 别名]
# 或者: from ansible.playbook.task.Task import _get_parent_attribute [as 别名]
taskData = []
conditionalData = []
print "\nParsed tasks....."
# Extract data from compiled playbook
for playbook_path in pbex._playbooks:
pb = Playbook.load(playbook_path, variable_manager=pbex._variable_manager, loader=pbex._loader)
plays = pb.get_plays()
for play in plays:
#print play.get_name()
tasklist = play.get_tasks() # play.get_tasks() returns a merged list of task blocks (pre, post, etc)
for taskBlocks in tasklist:
for task in taskBlocks:
hashedTask = hash(task)
changed = Task._get_parent_attribute(task, "changed_when")
taskData.append(hashedTask)
if changed is not None:
conditionalData.append(hashedTask)
print task, hashedTask, changed
# Build graph
graph = {}
def buildGraph(listData, nodeIndex=0):
if nodeIndex+1 == len(listData):
return
buildGraph(listData, nodeIndex+1)