From d38cd4896d5ac967b0a4ad5e2a01a1f8e4591b8b Mon Sep 17 00:00:00 2001 From: Benjamin Baumer Date: Tue, 7 Jul 2015 13:38:19 +0200 Subject: [PATCH] version_added for switch Parameter changed to 2.0 Add comment to explain check_rc Parameter in _exec Function Optimize code and clean up is_svn_repo Function --- lib/ansible/modules/source_control/subversion.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/source_control/subversion.py b/lib/ansible/modules/source_control/subversion.py index 84154d6dff0..24cc065c5a4 100644 --- a/lib/ansible/modules/source_control/subversion.py +++ b/lib/ansible/modules/source_control/subversion.py @@ -82,7 +82,7 @@ options: required: false default: "yes" choices: [ "yes", "no" ] - version_added: "1.6" + version_added: "2.0" description: - If C(no), do not call svn switch before update. ''' @@ -111,6 +111,7 @@ class Subversion(object): self.svn_path = svn_path def _exec(self, args, check_rc=True): + '''Execute a subversion command, and return output. If check_rc is False, returns the return code instead of the output.''' bits = [ self.svn_path, '--non-interactive', @@ -122,20 +123,16 @@ class Subversion(object): if self.password: bits.extend(["--password", self.password]) bits.extend(args) + rc, out, err = self.module.run_command(bits, check_rc) if check_rc: - rc, out, err = self.module.run_command(bits, check_rc) return out.splitlines() else: - rc, out, err = self.module.run_command(bits, check_rc) return rc def is_svn_repo(self): '''Checks if path is a SVN Repo.''' rc = self._exec(["info", self.dest], check_rc=False) - if rc == 0: - return True - else: - return False + return rc == 0 def checkout(self): '''Creates new svn working directory if it does not already exist.'''