mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Reapply pep8 changes from previous revert.
This commit is contained in:
parent
01ba1e9297
commit
b1b5280075
1 changed files with 20 additions and 20 deletions
|
@ -92,11 +92,11 @@ except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from systemd import journal
|
from systemd import journal
|
||||||
has_journal = True
|
has_journal = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
import syslog
|
import syslog
|
||||||
has_journal = False
|
has_journal = False
|
||||||
|
|
||||||
FILE_COMMON_ARGUMENTS=dict(
|
FILE_COMMON_ARGUMENTS=dict(
|
||||||
src = dict(),
|
src = dict(),
|
||||||
|
@ -561,8 +561,8 @@ class AnsibleModule(object):
|
||||||
def _count_terms(self, check):
|
def _count_terms(self, check):
|
||||||
count = 0
|
count = 0
|
||||||
for term in check:
|
for term in check:
|
||||||
if term in self.params:
|
if term in self.params:
|
||||||
count += 1
|
count += 1
|
||||||
return count
|
return count
|
||||||
|
|
||||||
def _check_mutually_exclusive(self, spec):
|
def _check_mutually_exclusive(self, spec):
|
||||||
|
@ -706,16 +706,16 @@ class AnsibleModule(object):
|
||||||
self.fail_json(msg="argument %s is of invalid type: %s, required: %s" % (k, type(value), wanted))
|
self.fail_json(msg="argument %s is of invalid type: %s, required: %s" % (k, type(value), wanted))
|
||||||
|
|
||||||
def _set_defaults(self, pre=True):
|
def _set_defaults(self, pre=True):
|
||||||
for (k,v) in self.argument_spec.iteritems():
|
for (k,v) in self.argument_spec.iteritems():
|
||||||
default = v.get('default', None)
|
default = v.get('default', None)
|
||||||
if pre == True:
|
if pre == True:
|
||||||
# this prevents setting defaults on required items
|
# this prevents setting defaults on required items
|
||||||
if default is not None and k not in self.params:
|
if default is not None and k not in self.params:
|
||||||
self.params[k] = default
|
self.params[k] = default
|
||||||
else:
|
else:
|
||||||
# make sure things without a default still get set None
|
# make sure things without a default still get set None
|
||||||
if k not in self.params:
|
if k not in self.params:
|
||||||
self.params[k] = default
|
self.params[k] = default
|
||||||
|
|
||||||
def _load_params(self):
|
def _load_params(self):
|
||||||
''' read the input and return a dictionary and the arguments string '''
|
''' read the input and return a dictionary and the arguments string '''
|
||||||
|
@ -825,7 +825,7 @@ class AnsibleModule(object):
|
||||||
def exit_json(self, **kwargs):
|
def exit_json(self, **kwargs):
|
||||||
''' return from the module, without error '''
|
''' return from the module, without error '''
|
||||||
self.add_path_info(kwargs)
|
self.add_path_info(kwargs)
|
||||||
if not kwargs.has_key('changed'):
|
if not 'changed' in kwargs:
|
||||||
kwargs['changed'] = False
|
kwargs['changed'] = False
|
||||||
print self.jsonify(kwargs)
|
print self.jsonify(kwargs)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
@ -922,10 +922,10 @@ class AnsibleModule(object):
|
||||||
|
|
||||||
try: # leaves tmp file behind when sudo and not root
|
try: # leaves tmp file behind when sudo and not root
|
||||||
if os.getenv("SUDO_USER") and os.getuid() != 0:
|
if os.getenv("SUDO_USER") and os.getuid() != 0:
|
||||||
# cleanup will happen by 'rm' of tempdir
|
# cleanup will happen by 'rm' of tempdir
|
||||||
shutil.copy(src, tmp_dest)
|
shutil.copy(src, tmp_dest)
|
||||||
else:
|
else:
|
||||||
shutil.move(src, tmp_dest)
|
shutil.move(src, tmp_dest)
|
||||||
if self.selinux_enabled():
|
if self.selinux_enabled():
|
||||||
self.set_context_if_different(tmp_dest, context, False)
|
self.set_context_if_different(tmp_dest, context, False)
|
||||||
os.rename(tmp_dest, dest)
|
os.rename(tmp_dest, dest)
|
||||||
|
|
Loading…
Reference in a new issue