@ -608,7 +608,7 @@ class AnsibleModule(object):
self . run_command_environ_update = { }
self . aliases = { }
self . _legal_inputs = [ ' _ansible_check_mode ' , ' _ansible_no_log ' , ' _ansible_debug ' , ' _ansible_diff ' , ' _ansible_verbosity ' , ' _ansible_selinux_special_fs ' , ' _ansible_ version' , ' _ansible_syslog_facility ' ]
self . _legal_inputs = [ ' _ansible_check_mode ' , ' _ansible_no_log ' , ' _ansible_debug ' , ' _ansible_diff ' , ' _ansible_verbosity ' , ' _ansible_selinux_special_fs ' , ' _ansible_ module_name' , ' _ansible_ version' , ' _ansible_syslog_facility ' ]
if add_file_common_args :
for k , v in FILE_COMMON_ARGUMENTS . items ( ) :
@ -1229,8 +1229,6 @@ class AnsibleModule(object):
for ( k , v ) in list ( self . params . items ( ) ) :
if k == ' _ansible_check_mode ' and v :
if not self . supports_check_mode :
self . exit_json ( skipped = True , msg = " remote module does not support check mode " )
self . check_mode = True
elif k == ' _ansible_no_log ' :
@ -1254,6 +1252,9 @@ class AnsibleModule(object):
elif k == ' _ansible_version ' :
self . ansible_version = v
elif k == ' _ansible_module_name ' :
self . _name = v
elif check_invalid_arguments and k not in self . _legal_inputs :
self . fail_json ( msg = " unsupported parameter for module: %s " % k )
@ -1261,6 +1262,9 @@ class AnsibleModule(object):
if k . startswith ( ' _ansible_ ' ) :
del self . params [ k ]
if self . check_mode and not self . supports_check_mode :
self . exit_json ( skipped = True , msg = " remote module ( %s ) does not support check mode " % self . _name )
def _count_terms ( self , check ) :
count = 0
for term in check :
@ -1537,7 +1541,7 @@ class AnsibleModule(object):
def _log_to_syslog ( self , msg ) :
if HAS_SYSLOG :
module = ' ansible- %s ' % os . path . basename ( __file__ )
module = ' ansible- %s ' % self . _name
facility = getattr ( syslog , self . _syslog_facility , syslog . LOG_USER )
syslog . openlog ( str ( module ) , 0 , facility )
syslog . syslog ( syslog . LOG_INFO , msg )
@ -1553,7 +1557,7 @@ class AnsibleModule(object):
if log_args is None :
log_args = dict ( )
module = ' ansible- %s ' % os . path . basename ( __file__ )
module = ' ansible- %s ' % self . _name
if isinstance ( module , bytes ) :
module = module . decode ( ' utf-8 ' , ' replace ' )