Exemplo n.º 1
0
    def object_hook(self, pairs):
        for key in pairs:
            value = pairs[key]

            if key == '__ansible_vault':
                value = AnsibleVaultEncryptedUnicode(value)
                if self._vaults:
                    value.vault = self._vaults['default']
                return value
            elif key == '__ansible_unsafe':
                return wrap_var(value.get('__ansible_unsafe'))

        return pairs
Exemplo n.º 2
0
    def _decode_map(self, value):

        if value.get('__ansible_unsafe', False):
            value = wrap_var(value.get('__ansible_unsafe'))
        elif value.get('__ansible_vault', False):
            value = AnsibleVaultEncryptedUnicode(value.get('__ansible_vault'))
            if self._vaults:
                value.vault = self._vaults['default']
        else:
            for k in value:
                if isinstance(value[k], Mapping):
                    value[k] = self._decode_map(value[k])
        return value
Exemplo n.º 3
0
    def _decode_map(self, value):

        if value.get('__ansible_unsafe', False):
            value = wrap_var(value.get('__ansible_unsafe'))
        elif value.get('__ansible_vault', False):
            value = AnsibleVaultEncryptedUnicode(value.get('__ansible_vault'))
            if self._vaults:
                value.vault = self._vaults['default']
        else:
            for k in value:
                if isinstance(value[k], Mapping):
                    value[k] = self._decode_map(value[k])
        return value