Merge "Fix merge action plugins verbose output"
This commit is contained in:
commit
b142b0ae7a
|
@ -171,12 +171,12 @@ class ActionModule(action.ActionBase):
|
||||||
del tmp # not used
|
del tmp # not used
|
||||||
|
|
||||||
sources = self._task.args.get('sources', None)
|
sources = self._task.args.get('sources', None)
|
||||||
|
whitespace = self._task.args.get('whitespace', True)
|
||||||
|
|
||||||
if not isinstance(sources, list):
|
if not isinstance(sources, list):
|
||||||
sources = [sources]
|
sources = [sources]
|
||||||
|
|
||||||
config = OverrideConfigParser(
|
config = OverrideConfigParser(whitespace=whitespace)
|
||||||
whitespace=self._task.args.get('whitespace', True))
|
|
||||||
|
|
||||||
for source in sources:
|
for source in sources:
|
||||||
self.read_config(source, config)
|
self.read_config(source, config)
|
||||||
|
@ -213,7 +213,11 @@ class ActionModule(action.ActionBase):
|
||||||
loader=self._loader,
|
loader=self._loader,
|
||||||
templar=self._templar,
|
templar=self._templar,
|
||||||
shared_loader_obj=self._shared_loader_obj)
|
shared_loader_obj=self._shared_loader_obj)
|
||||||
result.update(copy_action.run(task_vars=task_vars))
|
copy_result = copy_action.run(task_vars=task_vars)
|
||||||
|
copy_result['invocation']['module_args'].update({
|
||||||
|
'src': result_file, 'sources': sources,
|
||||||
|
'whitespace': whitespace})
|
||||||
|
result.update(copy_result)
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(local_tempdir)
|
shutil.rmtree(local_tempdir)
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -17,8 +17,7 @@ import os
|
||||||
import shutil
|
import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from yaml import dump
|
import yaml
|
||||||
from yaml import safe_load
|
|
||||||
|
|
||||||
from ansible import constants
|
from ansible import constants
|
||||||
from ansible import errors as ansible_errors
|
from ansible import errors as ansible_errors
|
||||||
|
@ -81,7 +80,7 @@ class ActionModule(action.ActionBase):
|
||||||
def read_config(self, source):
|
def read_config(self, source):
|
||||||
result = None
|
result = None
|
||||||
# Only use config if present
|
# Only use config if present
|
||||||
if os.access(source, os.R_OK):
|
if source and os.access(source, os.R_OK):
|
||||||
with open(source, 'r') as f:
|
with open(source, 'r') as f:
|
||||||
template_data = f.read()
|
template_data = f.read()
|
||||||
|
|
||||||
|
@ -94,7 +93,7 @@ class ActionModule(action.ActionBase):
|
||||||
self._templar.environment.loader.searchpath = searchpath
|
self._templar.environment.loader.searchpath = searchpath
|
||||||
|
|
||||||
template_data = self._templar.template(template_data)
|
template_data = self._templar.template(template_data)
|
||||||
result = safe_load(template_data)
|
result = yaml.safe_load(template_data)
|
||||||
return result or {}
|
return result or {}
|
||||||
|
|
||||||
def run(self, tmp=None, task_vars=None):
|
def run(self, tmp=None, task_vars=None):
|
||||||
|
@ -128,7 +127,7 @@ class ActionModule(action.ActionBase):
|
||||||
try:
|
try:
|
||||||
result_file = os.path.join(local_tempdir, 'source')
|
result_file = os.path.join(local_tempdir, 'source')
|
||||||
with open(result_file, 'w') as f:
|
with open(result_file, 'w') as f:
|
||||||
f.write(dump(output, default_flow_style=False))
|
f.write(yaml.dump(output, default_flow_style=False))
|
||||||
|
|
||||||
new_task = self._task.copy()
|
new_task = self._task.copy()
|
||||||
new_task.args.pop('sources', None)
|
new_task.args.pop('sources', None)
|
||||||
|
@ -147,7 +146,11 @@ class ActionModule(action.ActionBase):
|
||||||
loader=self._loader,
|
loader=self._loader,
|
||||||
templar=self._templar,
|
templar=self._templar,
|
||||||
shared_loader_obj=self._shared_loader_obj)
|
shared_loader_obj=self._shared_loader_obj)
|
||||||
result.update(copy_action.run(task_vars=task_vars))
|
copy_result = copy_action.run(task_vars=task_vars)
|
||||||
|
copy_result['invocation']['module_args'].update({
|
||||||
|
'src': result_file, 'sources': sources,
|
||||||
|
'extend_lists': extend_lists})
|
||||||
|
result.update(copy_result)
|
||||||
finally:
|
finally:
|
||||||
shutil.rmtree(local_tempdir)
|
shutil.rmtree(local_tempdir)
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue