From 20ec25389f7f5055795cb6804f17ddf9405d23b5 Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Fri, 19 Apr 2013 10:49:35 -0400 Subject: [PATCH] Cleanup: Remove duplicate file copy code. Fixes bug 1160548. Just a small cleanup to take advantage of code reuse. Change-Id: I6b362335d555a3e384fa8778fcc85cbbdc061fd1 --- libra/worker/drivers/haproxy/ubuntu_services.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/libra/worker/drivers/haproxy/ubuntu_services.py b/libra/worker/drivers/haproxy/ubuntu_services.py index 1b30f16c..b35a4818 100644 --- a/libra/worker/drivers/haproxy/ubuntu_services.py +++ b/libra/worker/drivers/haproxy/ubuntu_services.py @@ -95,14 +95,7 @@ class UbuntuServices(ServicesBase): # Copy any existing configuration file to a backup. if os.path.exists(self._config_file): - copy_cmd = "/usr/bin/sudo -n /bin/cp %s %s" % (self._config_file, - self._backup_config) - try: - subprocess.check_output(copy_cmd.split(), - stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as e: - raise Exception("Failed to copy configuration file: %s\n%s" - % (e, e.output.rstrip('\n'))) + self.sudo_copy(self._config_file, self._backup_config) # Move the temporary config file to production version. move_cmd = "/usr/bin/sudo -n /bin/mv %s %s" % (tmpfile,