Merge lp:~danilo/linaro-license-protection/bounce-apache into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Данило Шеган
Status: Merged
Approved by: Georgy Redkozubov
Approved revision: 126
Merged at revision: 126
Proposed branch: lp:~danilo/linaro-license-protection/bounce-apache
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 32 lines (+8/-0)
1 file modified
scripts/update-deployment.py (+8/-0)
To merge this branch: bzr merge lp:~danilo/linaro-license-protection/bounce-apache
Reviewer Review Type Date Requested Status
Georgy Redkozubov Approve
Review via email: mp+122033@code.launchpad.net

Description of the change

Use the command as allowed in https://rt.linaro.org/Ticket/Display.html?id=584
to bounce Apache to allow staging deployments to be fully automatic.

We'll have to modify the cronjob to include --bounce-apache command line option as well.

To post a comment you must log in.
Revision history for this message
Georgy Redkozubov (gesha) wrote :

Looks good. Thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'scripts/update-deployment.py'
--- scripts/update-deployment.py 2012-08-23 18:43:44 +0000
+++ scripts/update-deployment.py 2012-08-30 11:04:20 +0000
@@ -66,6 +66,7 @@
66 self.run_subcommand(["bzr", "up"], branch_dir)66 self.run_subcommand(["bzr", "up"], branch_dir)
6767
68 def run_subcommand(self, arguments, cwd=None):68 def run_subcommand(self, arguments, cwd=None):
69 self.logger.debug("In %s, running: %s\n", cwd, str(arguments))
69 process = subprocess.Popen(arguments, cwd=cwd, stdout=subprocess.PIPE,70 process = subprocess.Popen(arguments, cwd=cwd, stdout=subprocess.PIPE,
70 stderr=subprocess.PIPE)71 stderr=subprocess.PIPE)
71 process_out, process_err = process.communicate()72 process_out, process_err = process.communicate()
@@ -114,6 +115,9 @@
114 def setup_parser(self):115 def setup_parser(self):
115 super(UpdateDeploymentScript, self).setup_parser()116 super(UpdateDeploymentScript, self).setup_parser()
116 self.argument_parser.add_argument(117 self.argument_parser.add_argument(
118 '--bounce-apache', action='store_true', default=False,
119 help="Whether to make Apache reload the configuration.")
120 self.argument_parser.add_argument(
117 'configs', metavar='CONFIG', nargs='+',121 'configs', metavar='CONFIG', nargs='+',
118 choices=configs_to_use.keys(),122 choices=configs_to_use.keys(),
119 help=("Django configuration module to use. One of " +123 help=("Django configuration module to use. One of " +
@@ -128,6 +132,10 @@
128 for config in self.arguments.configs:132 for config in self.arguments.configs:
129 self.update_installation(config, configs_to_use[config])133 self.update_installation(config, configs_to_use[config])
130134
135 # Finally, bounce apache.
136 if self.arguments.bounce_apache:
137 self.run_subcommand(["sudo", "/etc/init.d/apache2", "reload"])
138
131139
132if __name__ == '__main__':140if __name__ == '__main__':
133 script = UpdateDeploymentScript(141 script = UpdateDeploymentScript(

Subscribers

People subscribed via source and target branches