本文整理匯總了Python中ansible.playbook.play_context.PlayContext.deserialize方法的典型用法代碼示例。如果您正苦於以下問題:Python PlayContext.deserialize方法的具體用法?Python PlayContext.deserialize怎麽用?Python PlayContext.deserialize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ansible.playbook.play_context.PlayContext
的用法示例。
在下文中一共展示了PlayContext.deserialize方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: update_play_context
# 需要導入模塊: from ansible.playbook.play_context import PlayContext [as 別名]
# 或者: from ansible.playbook.play_context.PlayContext import deserialize [as 別名]
def update_play_context(self, pc_data):
"""Updates the play context information for the connection"""
pc_data = to_bytes(pc_data)
if PY3:
pc_data = cPickle.loads(pc_data, encoding='bytes')
else:
pc_data = cPickle.loads(pc_data)
play_context = PlayContext()
play_context.deserialize(pc_data)
messages = ['updating play_context for connection']
if self._play_context.become is False and play_context.become is True:
auth_pass = play_context.become_pass
self._terminal.on_become(passwd=auth_pass)
messages.append('authorizing connection')
elif self._play_context.become is True and not play_context.become:
self._terminal.on_unbecome()
messages.append('deauthorizing connection')
self._play_context = play_context
return messages