Cleanups:

* Don't reference __class__ when we can use the instance itself
* use isdisjoint() as it can stop once a match is found
* Remove a condtional that was taken care of in the conditonal just above
This commit is contained in:
Toshio Kuratomi
2015-07-23 12:11:10 -07:00
parent 4e3f5e3be6
commit f8e4aff4c1
3 changed files with 10 additions and 13 deletions

View File

@@ -118,10 +118,7 @@ class ActionBase:
if tmp and "tmp" in tmp:
# tmp has already been created
return False
if not self._connection.__class__.has_pipelining or not C.ANSIBLE_SSH_PIPELINING or C.DEFAULT_KEEP_REMOTE_FILES or self._play_context.become:
# tmp is necessary to store module source code
return True
if not self._connection.__class__.has_pipelining:
if not self._connection.has_pipelining or not C.ANSIBLE_SSH_PIPELINING or C.DEFAULT_KEEP_REMOTE_FILES or self._play_context.become:
# tmp is necessary to store the module source code
# or we want to keep the files on the target system
return True
@@ -363,7 +360,7 @@ class ActionBase:
# FIXME: all of the old-module style and async stuff has been removed from here, and
# might need to be re-added (unless we decide to drop support for old-style modules
# at this point and rework things to support non-python modules specifically)
if self._connection.__class__.has_pipelining and C.ANSIBLE_SSH_PIPELINING and not C.DEFAULT_KEEP_REMOTE_FILES:
if self._connection.has_pipelining and C.ANSIBLE_SSH_PIPELINING and not C.DEFAULT_KEEP_REMOTE_FILES:
in_data = module_data
else:
if remote_module_path:

View File

@@ -87,7 +87,7 @@ class ConnectionBase(with_metaclass(ABCMeta, object)):
def _become_method_supported(self):
''' Checks if the current class supports this privilege escalation method '''
if self._play_context.become_method in self.__class__.become_methods:
if self._play_context.become_method in self.become_methods:
return True
raise AnsibleError("Internal Error: this connection module does not support running commands via %s" % become_method)