diff options
author | Danilo Segan <danilo@canonical.com> | 2012-08-23 19:09:20 +0200 |
---|---|---|
committer | Danilo Segan <danilo@canonical.com> | 2012-08-23 19:09:20 +0200 |
commit | 641fa63238c7cdc8321c00537ad9ab12e66db4bb (patch) | |
tree | c4afa065e7f89787a953154ddd05d9d21cc58a5d /scripts/update-deployment.py | |
parent | a1b406a9d9278cf1c8b5a570148fc2bd973c1c2b (diff) |
Use the subprocess options compatible with python2.6 standard library version.
Diffstat (limited to 'scripts/update-deployment.py')
-rwxr-xr-x | scripts/update-deployment.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/scripts/update-deployment.py b/scripts/update-deployment.py index 32114ea..6cfca6b 100755 --- a/scripts/update-deployment.py +++ b/scripts/update-deployment.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.7 +#!/usr/bin/env python """Update a deployment of lp:linaro-license-protection. @@ -84,6 +84,16 @@ class UpdateDeploymentScript(LinaroScript): code_tree = bzrlib.workingtree.WorkingTree.open(working_tree_dir) code_tree.update() + def run_subcommand(self, arguments, cwd=None): + process = subprocess.Popen(arguments, cwd=cwd) + process_out, process_err = process.communicate() + if process_out is not None: + logger.debug("stdout:\n" + "\n\t".join(process_out.splitlines())) + if process_err is not None: + logger.debug("stderr:\n" + "\n\t".join(process_err.splitlines())) + if process.returncode != 0: + logger.error("FAILED %d", process.returncode) + def update_installation(self, config, installation_root): """Updates a single installation code and databases. @@ -108,13 +118,13 @@ class UpdateDeploymentScript(LinaroScript): os.environ.get("DJANGO_SETTINGS_MODULE")) self.logger.debug("Doing 'syncdb'...") - self.logger.debug(subprocess.check_output( - ["django-admin", "syncdb", "--noinput"], cwd=code_root)) + self.run_subcommand( + ["django-admin", "syncdb", "--noinput"], cwd=code_root) self.logger.debug("Doing 'collectstatic'...") - self.logger.debug(subprocess.check_output( + self.run_subcommand( ["django-admin", "collectstatic", "--noinput"], - cwd=code_root)) + cwd=code_root) def setup_parser(self): super(UpdateDeploymentScript, self).setup_parser() |