mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-25 07:21:43 -07:00
Move over some of the parsing functions that we need.
This commit is contained in:
parent
e8aa847e5b
commit
05231dcde6
1 changed files with 3 additions and 5 deletions
|
@ -24,6 +24,7 @@ from ansible.playbook.attribute import Attribute, FieldAttribute
|
||||||
# TODO: it would be fantastic (if possible) if a task new where in the YAML it was defined for describing
|
# TODO: it would be fantastic (if possible) if a task new where in the YAML it was defined for describing
|
||||||
# it in error conditions
|
# it in error conditions
|
||||||
|
|
||||||
|
from ansible.parsing.splitter import parse_kv
|
||||||
from ansible.plugins import module_finder, lookup_finder
|
from ansible.plugins import module_finder, lookup_finder
|
||||||
|
|
||||||
class Task(Base):
|
class Task(Base):
|
||||||
|
@ -103,9 +104,6 @@ class Task(Base):
|
||||||
else:
|
else:
|
||||||
return "%s %s" % (self.action, self._merge_kv(self.args))
|
return "%s %s" % (self.action, self._merge_kv(self.args))
|
||||||
|
|
||||||
def _parse_kv(self, str):
|
|
||||||
return ansible.utils.parse_kv(str)
|
|
||||||
|
|
||||||
def _merge_kv(self, ds):
|
def _merge_kv(self, ds):
|
||||||
if ds is None:
|
if ds is None:
|
||||||
return ""
|
return ""
|
||||||
|
@ -146,7 +144,7 @@ class Task(Base):
|
||||||
def _munge_action2(self, ds, new_ds, k, v, local=False):
|
def _munge_action2(self, ds, new_ds, k, v, local=False):
|
||||||
''' take an old school action/local_action and reformat it '''
|
''' take an old school action/local_action and reformat it '''
|
||||||
if isinstance(v, basestring):
|
if isinstance(v, basestring):
|
||||||
(module, args) = self._parse_kv(v)
|
(module, args) = parse_kv(v)
|
||||||
new_ds['action'] = module
|
new_ds['action'] = module
|
||||||
if 'args' in ds:
|
if 'args' in ds:
|
||||||
raise AnsibleError("unexpected and redundant 'args'")
|
raise AnsibleError("unexpected and redundant 'args'")
|
||||||
|
@ -199,7 +197,7 @@ LEGACY = """
|
||||||
if module_name not in module_finder:
|
if module_name not in module_finder:
|
||||||
raise AnsibleError("the specified module '%s' could not be found, check your module path" % module_name)
|
raise AnsibleError("the specified module '%s' could not be found, check your module path" % module_name)
|
||||||
results['_module_name'] = module_name
|
results['_module_name'] = module_name
|
||||||
results['_parameters'] = self._parse_kv(params)
|
results['_parameters'] = parse_kv(params)
|
||||||
|
|
||||||
if k == 'local_action':
|
if k == 'local_action':
|
||||||
if 'delegate_to' in ds:
|
if 'delegate_to' in ds:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue