Merge lp:~danilo/linaro-license-protection/fix-deployment-script into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Данило Шеган
Status: Merged
Merged at revision: 100
Proposed branch: lp:~danilo/linaro-license-protection/fix-deployment-script
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 58 lines (+9/-9)
1 file modified
scripts/update-deployment.py (+9/-9)
To merge this branch: bzr merge lp:~danilo/linaro-license-protection/fix-deployment-script
Reviewer Review Type Date Requested Status
Stevan Radaković code Approve
Review via email: mp+119885@code.launchpad.net

Description of the change

Now that we have cronjob running the update-deployment script every half
an hour, it was easy to see that the working tree checkouts were not
being updated because they are not branches themselves (i.e. their branch
is up to date, but checkouts are working trees).

We were also always defaulting to a DEBUG error level which meant that
the script was never quiet (even without the -v options).

To post a comment you must log in.
Revision history for this message
Stevan Radaković (stevanr) wrote :

Looks good.
Approve +1.

review: Approve (code)

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-13 11:43:07 +0000
+++ scripts/update-deployment.py 2012-08-16 10:25:42 +0000
@@ -36,6 +36,7 @@
3636
37import argparse37import argparse
38import bzrlib.branch38import bzrlib.branch
39import bzrlib.workingtree
39import logging40import logging
40import os41import os
41import subprocess42import subprocess
@@ -55,8 +56,6 @@
55 "settings_staging_snapshots": staging_snapshots_root,56 "settings_staging_snapshots": staging_snapshots_root,
56 }57 }
5758
58logging_level = logging.DEBUG
59
60code_root = os.path.join(code_base, branch_name)59code_root = os.path.join(code_base, branch_name)
61configs_root = os.path.join(code_base, configs_branch_name)60configs_root = os.path.join(code_base, configs_branch_name)
6261
@@ -76,22 +75,22 @@
76 return code_branch75 return code_branch
7776
7877
79def update_branch(branch_dir):78def update_tree(working_tree_dir):
80 """Does a checkout update."""79 """Does a checkout update."""
81 code_branch = bzrlib.branch.Branch.open(branch_dir)80 code_tree = bzrlib.workingtree.WorkingTree.open(working_tree_dir)
82 code_branch.update()81 code_tree.update()
8382
8483
85def update_installation(config, installation_root):84def update_installation(config, installation_root):
86 """Updates a single installation code and databases.85 """Updates a single installation code and databases.
8786
88 It expects code and config branches to be simple checkouts so it only87 It expects code and config branches to be simple checkouts (working trees)
89 does an "update" on them.88 so it only does an "update" on them.
9089
91 Afterwards, it runs "syncdb" and "collectstatic" steps.90 Afterwards, it runs "syncdb" and "collectstatic" steps.
92 """91 """
93 update_branch(os.path.join(installation_root, branch_name))92 update_tree(os.path.join(installation_root, branch_name))
94 update_branch(os.path.join(installation_root, "configs"))93 update_tree(os.path.join(installation_root, "configs"))
95 os.environ["PYTHONPATH"] = (94 os.environ["PYTHONPATH"] = (
96 ":".join(95 ":".join(
97 [installation_root,96 [installation_root,
@@ -128,6 +127,7 @@
128 "Can be used multiple times"))127 "Can be used multiple times"))
129 args = parser.parse_args()128 args = parser.parse_args()
130129
130 logging_level = logging.ERROR
131 if args.verbose == 0:131 if args.verbose == 0:
132 logging_level = logging.ERROR132 logging_level = logging.ERROR
133 elif args.verbose == 1:133 elif args.verbose == 1:

Subscribers

People subscribed via source and target branches