mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-22 12:50:42 +00:00
fix: add missing vault yaml tag (#113)
This commit is contained in:
parent
a85c54287c
commit
5dae0a6976
@ -20,6 +20,7 @@ from ansiblelater.exceptions import LaterError
|
|||||||
from ansiblelater.utils import Singleton
|
from ansiblelater.utils import Singleton
|
||||||
from ansiblelater.utils import sysexit_with_message
|
from ansiblelater.utils import sysexit_with_message
|
||||||
from ansiblelater.utils.yamlhelper import UnsafeTag
|
from ansiblelater.utils.yamlhelper import UnsafeTag
|
||||||
|
from ansiblelater.utils.yamlhelper import VaultTag
|
||||||
from ansiblelater.utils.yamlhelper import action_tasks
|
from ansiblelater.utils.yamlhelper import action_tasks
|
||||||
from ansiblelater.utils.yamlhelper import normalize_task
|
from ansiblelater.utils.yamlhelper import normalize_task
|
||||||
from ansiblelater.utils.yamlhelper import normalized_yaml
|
from ansiblelater.utils.yamlhelper import normalized_yaml
|
||||||
@ -223,6 +224,9 @@ class StandardBase(object, metaclass=StandardExtendedMeta):
|
|||||||
yaml.add_constructor(
|
yaml.add_constructor(
|
||||||
UnsafeTag.yaml_tag, UnsafeTag.yaml_constructor, Loader=yaml.SafeLoader
|
UnsafeTag.yaml_tag, UnsafeTag.yaml_constructor, Loader=yaml.SafeLoader
|
||||||
)
|
)
|
||||||
|
yaml.add_constructor(
|
||||||
|
VaultTag.yaml_tag, VaultTag.yaml_constructor, Loader=yaml.SafeLoader
|
||||||
|
)
|
||||||
content = yaml.safe_load(f)
|
content = yaml.safe_load(f)
|
||||||
except yaml.YAMLError as e:
|
except yaml.YAMLError as e:
|
||||||
errors.append(
|
errors.append(
|
||||||
@ -244,6 +248,9 @@ class StandardBase(object, metaclass=StandardExtendedMeta):
|
|||||||
yaml.add_constructor(
|
yaml.add_constructor(
|
||||||
UnsafeTag.yaml_tag, UnsafeTag.yaml_constructor, Loader=yaml.SafeLoader
|
UnsafeTag.yaml_tag, UnsafeTag.yaml_constructor, Loader=yaml.SafeLoader
|
||||||
)
|
)
|
||||||
|
yaml.add_constructor(
|
||||||
|
VaultTag.yaml_tag, VaultTag.yaml_constructor, Loader=yaml.SafeLoader
|
||||||
|
)
|
||||||
yaml.safe_load(f)
|
yaml.safe_load(f)
|
||||||
|
|
||||||
for problem in linter.run(f, YamlLintConfig(options)):
|
for problem in linter.run(f, YamlLintConfig(options)):
|
||||||
|
@ -593,3 +593,16 @@ class UnsafeTag:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def yaml_constructor(loader, node):
|
def yaml_constructor(loader, node):
|
||||||
return loader.construct_scalar(node)
|
return loader.construct_scalar(node)
|
||||||
|
|
||||||
|
|
||||||
|
class VaultTag:
|
||||||
|
"""Handle custom yaml vault tag."""
|
||||||
|
|
||||||
|
yaml_tag = u"!vault"
|
||||||
|
|
||||||
|
def __init__(self, value):
|
||||||
|
self.unsafe = value
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def yaml_constructor(loader, node):
|
||||||
|
return loader.construct_scalar(node)
|
||||||
|
Loading…
Reference in New Issue
Block a user