當前位置: 首頁>>代碼示例>>Python>>正文


Python AnsibleMapping.update方法代碼示例

本文整理匯總了Python中ansible.parsing.yaml.objects.AnsibleMapping.update方法的典型用法代碼示例。如果您正苦於以下問題:Python AnsibleMapping.update方法的具體用法?Python AnsibleMapping.update怎麽用?Python AnsibleMapping.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ansible.parsing.yaml.objects.AnsibleMapping的用法示例。


在下文中一共展示了AnsibleMapping.update方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: construct_yaml_map

# 需要導入模塊: from ansible.parsing.yaml.objects import AnsibleMapping [as 別名]
# 或者: from ansible.parsing.yaml.objects.AnsibleMapping import update [as 別名]
 def construct_yaml_map(self, node):
     data = AnsibleMapping()
     yield data
     value = self.construct_mapping(node)
     data.update(value)
     data._line_number   = value._line_number
     data._column_number = value._column_number
     data._data_source   = value._data_source
開發者ID:conlini,項目名稱:frozen-ansible,代碼行數:10,代碼來源:constructor.py

示例2: preprocess_data

# 需要導入模塊: from ansible.parsing.yaml.objects import AnsibleMapping [as 別名]
# 或者: from ansible.parsing.yaml.objects.AnsibleMapping import update [as 別名]
    def preprocess_data(self, ds):
        # role names that are simply numbers can be parsed by PyYAML
        # as integers even when quoted, so turn it into a string type
        if isinstance(ds, int):
            ds = "%s" % ds

        if not isinstance(ds, dict) and not isinstance(ds, string_types) and not isinstance(ds, AnsibleBaseYAMLObject):
            raise AnsibleAssertionError()

        if isinstance(ds, dict):
            ds = super(RoleDefinition, self).preprocess_data(ds)

        # save the original ds for use later
        self._ds = ds

        # we create a new data structure here, using the same
        # object used internally by the YAML parsing code so we
        # can preserve file:line:column information if it exists
        new_ds = AnsibleMapping()
        if isinstance(ds, AnsibleBaseYAMLObject):
            new_ds.ansible_pos = ds.ansible_pos

        # first we pull the role name out of the data structure,
        # and then use that to determine the role path (which may
        # result in a new role name, if it was a file path)
        role_name = self._load_role_name(ds)
        (role_name, role_path) = self._load_role_path(role_name)

        # next, we split the role params out from the valid role
        # attributes and update the new datastructure with that
        # result and the role name
        if isinstance(ds, dict):
            (new_role_def, role_params) = self._split_role_params(ds)
            new_ds.update(new_role_def)
            self._role_params = role_params

        # set the role name in the new ds
        new_ds['role'] = role_name

        # we store the role path internally
        self._role_path = role_path

        # and return the cleaned-up data structure
        return new_ds
開發者ID:awiddersheim,項目名稱:ansible,代碼行數:46,代碼來源:definition.py

示例3: munge

# 需要導入模塊: from ansible.parsing.yaml.objects import AnsibleMapping [as 別名]
# 或者: from ansible.parsing.yaml.objects.AnsibleMapping import update [as 別名]
    def munge(self, ds):

        assert isinstance(ds, dict) or isinstance(ds, string_types)

        # we create a new data structure here, using the same
        # object used internally by the YAML parsing code so we
        # can preserve file:line:column information if it exists
        new_ds = AnsibleMapping()
        if isinstance(ds, AnsibleBaseYAMLObject):
            new_ds.copy_position_info(ds)

        # first we pull the role name out of the data structure,
        # and then use that to determine the role path (which may
        # result in a new role name, if it was a file path)
        role_name = self._load_role_name(ds)
        (role_name, role_path) = self._load_role_path(role_name)

        # next, we split the role params out from the valid role
        # attributes and update the new datastructure with that
        # result and the role name
        if isinstance(ds, dict):
            (new_role_def, role_params) = self._split_role_params(ds)
            new_ds.update(new_role_def)
            self._role_params = role_params

        # set the role name in the new ds
        new_ds['role'] = role_name

        # we store the role path internally
        self._role_path = role_path

        # save the original ds for use later
        self._ds = ds

        # and return the cleaned-up data structure
        return new_ds
開發者ID:dataxu,項目名稱:ansible,代碼行數:38,代碼來源:definition.py

示例4: construct_yaml_map

# 需要導入模塊: from ansible.parsing.yaml.objects import AnsibleMapping [as 別名]
# 或者: from ansible.parsing.yaml.objects.AnsibleMapping import update [as 別名]
 def construct_yaml_map(self, node):
     data = AnsibleMapping()
     yield data
     value = self.construct_mapping(node)
     data.update(value)
     data.ansible_pos = self._node_position_info(node)
開發者ID:RajeevNambiar,項目名稱:temp,代碼行數:8,代碼來源:constructor.py


注:本文中的ansible.parsing.yaml.objects.AnsibleMapping.update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。