|
|
@ -28,7 +28,6 @@ from ansible import constants as C
|
|
|
|
|
|
|
|
|
|
|
|
REPLACER = "#<<INCLUDE_ANSIBLE_MODULE_COMMON>>"
|
|
|
|
REPLACER = "#<<INCLUDE_ANSIBLE_MODULE_COMMON>>"
|
|
|
|
REPLACER_ARGS = "\"<<INCLUDE_ANSIBLE_MODULE_ARGS>>\""
|
|
|
|
REPLACER_ARGS = "\"<<INCLUDE_ANSIBLE_MODULE_ARGS>>\""
|
|
|
|
REPLACER_LANG = "\"<<INCLUDE_ANSIBLE_MODULE_LANG>>\""
|
|
|
|
|
|
|
|
REPLACER_COMPLEX = "\"<<INCLUDE_ANSIBLE_MODULE_COMPLEX_ARGS>>\""
|
|
|
|
REPLACER_COMPLEX = "\"<<INCLUDE_ANSIBLE_MODULE_COMPLEX_ARGS>>\""
|
|
|
|
|
|
|
|
|
|
|
|
class ModuleReplacer(object):
|
|
|
|
class ModuleReplacer(object):
|
|
|
@ -140,12 +139,10 @@ class ModuleReplacer(object):
|
|
|
|
encoded_args = repr(module_args.encode('utf-8'))
|
|
|
|
encoded_args = repr(module_args.encode('utf-8'))
|
|
|
|
except UnicodeDecodeError:
|
|
|
|
except UnicodeDecodeError:
|
|
|
|
encoded_args = repr(module_args)
|
|
|
|
encoded_args = repr(module_args)
|
|
|
|
encoded_lang = repr(C.DEFAULT_MODULE_LANG)
|
|
|
|
|
|
|
|
encoded_complex = repr(complex_args_json)
|
|
|
|
encoded_complex = repr(complex_args_json)
|
|
|
|
|
|
|
|
|
|
|
|
# these strings should be part of the 'basic' snippet which is required to be included
|
|
|
|
# these strings should be part of the 'basic' snippet which is required to be included
|
|
|
|
module_data = module_data.replace(REPLACER_ARGS, encoded_args)
|
|
|
|
module_data = module_data.replace(REPLACER_ARGS, encoded_args)
|
|
|
|
module_data = module_data.replace(REPLACER_LANG, encoded_lang)
|
|
|
|
|
|
|
|
module_data = module_data.replace(REPLACER_COMPLEX, encoded_complex)
|
|
|
|
module_data = module_data.replace(REPLACER_COMPLEX, encoded_complex)
|
|
|
|
|
|
|
|
|
|
|
|
if module_style == 'new':
|
|
|
|
if module_style == 'new':
|
|
|
@ -154,7 +151,6 @@ class ModuleReplacer(object):
|
|
|
|
facility = inject['ansible_syslog_facility']
|
|
|
|
facility = inject['ansible_syslog_facility']
|
|
|
|
module_data = module_data.replace('syslog.LOG_USER', "syslog.%s" % facility)
|
|
|
|
module_data = module_data.replace('syslog.LOG_USER', "syslog.%s" % facility)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lines = module_data.split("\n")
|
|
|
|
lines = module_data.split("\n")
|
|
|
|
shebang = None
|
|
|
|
shebang = None
|
|
|
|
if lines[0].startswith("#!"):
|
|
|
|
if lines[0].startswith("#!"):
|
|
|
|