当前位置: 首页>>代码示例>>Python>>正文


Python Role.deserialize方法代码示例

本文整理汇总了Python中ansible.playbook.role.Role.deserialize方法的典型用法代码示例。如果您正苦于以下问题:Python Role.deserialize方法的具体用法?Python Role.deserialize怎么用?Python Role.deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ansible.playbook.role.Role的用法示例。


在下文中一共展示了Role.deserialize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: deserialize

# 需要导入模块: from ansible.playbook.role import Role [as 别名]
# 或者: from ansible.playbook.role.Role import deserialize [as 别名]
    def deserialize(self, data):

        # import is here to avoid import loops
        #from ansible.playbook.task_include import TaskInclude

        block_data = data.get('block')

        if block_data:
            b = Block()
            b.deserialize(block_data)
            self._block = b
            del data['block']

        role_data = data.get('role')
        if role_data:
            r = Role()
            r.deserialize(role_data)
            self._role = r
            del data['role']

        ti_data = data.get('task_include')
        if ti_data:
            #ti = TaskInclude()
            ti = Task()
            ti.deserialize(ti_data)
            self._task_include = ti
            del data['task_include']

        super(Task, self).deserialize(data)
开发者ID:RajeevNambiar,项目名称:temp,代码行数:31,代码来源:task.py

示例2: deserialize

# 需要导入模块: from ansible.playbook.role import Role [as 别名]
# 或者: from ansible.playbook.role.Role import deserialize [as 别名]
    def deserialize(self, data):
        '''
        Override of the default deserialize method, to match the above overridden
        serialize method
        '''

        from ansible.playbook.task import Task

        # we don't want the full set of attributes (the task lists), as that
        # would lead to a serialize/deserialize loop
        for attr in self._get_base_attributes():
            if attr in data and attr not in ('block', 'rescue', 'always'):
                setattr(self, attr, data.get(attr))

        self._dep_chain = data.get('dep_chain', [])

        # if there was a serialized role, unpack it too
        role_data = data.get('role')
        if role_data:
            r = Role()
            r.deserialize(role_data)
            self._role = r

        # if there was a serialized task include, unpack it too
        ti_data = data.get('task_include')
        if ti_data:
            ti = Task()
            ti.deserialize(ti_data)
            self._task_include = ti

        pb_data = data.get('parent_block')
        if pb_data:
            pb = Block()
            pb.deserialize(pb_data)
            self._parent_block = pb
开发者ID:RajeevNambiar,项目名称:temp,代码行数:37,代码来源:block.py

示例3: deserialize

# 需要导入模块: from ansible.playbook.role import Role [as 别名]
# 或者: from ansible.playbook.role.Role import deserialize [as 别名]
    def deserialize(self, data):

        # import is here to avoid import loops
        from ansible.playbook.task_include import TaskInclude
        from ansible.playbook.handler_task_include import HandlerTaskInclude

        parent_data = data.get('parent', None)
        if parent_data:
            parent_type = data.get('parent_type')
            if parent_type == 'Block':
                p = Block()
            elif parent_type == 'TaskInclude':
                p = TaskInclude()
            elif parent_type == 'HandlerTaskInclude':
                p = HandlerTaskInclude()
            p.deserialize(parent_data)
            self._parent = p
            del data['parent']

        role_data = data.get('role')
        if role_data:
            r = Role()
            r.deserialize(role_data)
            self._role = r
            del data['role']

        super(Task, self).deserialize(data)
开发者ID:KMK-ONLINE,项目名称:ansible,代码行数:29,代码来源:task.py

示例4: deserialize

# 需要导入模块: from ansible.playbook.role import Role [as 别名]
# 或者: from ansible.playbook.role.Role import deserialize [as 别名]
    def deserialize(self, data):
        '''
        Override of the default deserialize method, to match the above overridden
        serialize method
        '''

        from ansible.playbook.task import Task

        # unpack the when attribute, which is the only one we want
        self.when = data.get('when')
        self._dep_chain = data.get('dep_chain', [])

        # if there was a serialized role, unpack it too
        role_data = data.get('role')
        if role_data:
            r = Role()
            r.deserialize(role_data)
            self._role = r

        # if there was a serialized task include, unpack it too
        ti_data = data.get('task_include')
        if ti_data:
            ti = Task()
            ti.deserialize(ti_data)
            self._task_include = ti
开发者ID:dataxu,项目名称:ansible,代码行数:27,代码来源:block.py

示例5: deserialize

# 需要导入模块: from ansible.playbook.role import Role [as 别名]
# 或者: from ansible.playbook.role.Role import deserialize [as 别名]
    def deserialize(self, data):
        super(Play, self).deserialize(data)

        if 'roles' in data:
            role_data = data.get('roles', [])
            roles = []
            for role in role_data:
                r = Role()
                r.deserialize(role)
                roles.append(r)

            setattr(self, 'roles', roles)
            del data['roles']
开发者ID:thebeefcake,项目名称:masterless,代码行数:15,代码来源:play.py

示例6: deserialize

# 需要导入模块: from ansible.playbook.role import Role [as 别名]
# 或者: from ansible.playbook.role.Role import deserialize [as 别名]
    def deserialize(self, data):
        '''
        Override of the default deserialize method, to match the above overridden
        serialize method
        '''

        # import is here to avoid import loops
        from ansible.playbook.task import Task
        from ansible.playbook.task_include import TaskInclude
        from ansible.playbook.handler_task_include import HandlerTaskInclude

        # we don't want the full set of attributes (the task lists), as that
        # would lead to a serialize/deserialize loop
        for attr in self._valid_attrs:
            if attr in data and attr not in ('block', 'rescue', 'always'):
                setattr(self, attr, data.get(attr))

        self._dep_chain = data.get('dep_chain', None)
        self._eor = data.get('eor', False)

        # if there was a serialized role, unpack it too
        role_data = data.get('role')
        if role_data:
            r = Role()
            r.deserialize(role_data)
            self._role = r

        parent_data = data.get('parent')
        if parent_data:
            parent_type = data.get('parent_type')
            if parent_type == 'Block':
                p = Block()
            elif parent_type == 'TaskInclude':
                p = TaskInclude()
            elif parent_type == 'HandlerTaskInclude':
                p = HandlerTaskInclude()
            p.deserialize(parent_data)
            self._parent = p
            self._dep_chain = self._parent.get_dep_chain()
开发者ID:ernstp,项目名称:ansible,代码行数:41,代码来源:block.py


注:本文中的ansible.playbook.role.Role.deserialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。