Merge lp:~mew/juju-deployer/branch-optional into lp:~gandelman-a/juju-deployer/trunk

Proposed by Matthew Wedgwood
Status: Merged
Merged at revision: 66
Proposed branch: lp:~mew/juju-deployer/branch-optional
Merge into: lp:~gandelman-a/juju-deployer/trunk
Diff against target: 45 lines (+10/-4)
1 file modified
deployer.py (+10/-4)
To merge this branch: bzr merge lp:~mew/juju-deployer/branch-optional
Reviewer Review Type Date Requested Status
Adam Gandelman Pending
Review via email: mp+150943@code.launchpad.net

Description of the change

This change makes the "branch" value optional. If it is missing, deployer.py skips the branch/update/revno process and expects charms to be on-disk in the places it would have put them. This allows us to pre-build charms with payloads before deploying them.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'deployer.py'
2--- deployer.py 2013-02-21 02:05:38 +0000
3+++ deployer.py 2013-02-28 00:24:24 +0000
4@@ -138,8 +138,11 @@
5 for k in CHARMS.keys():
6 charm_path = "%s/%s" % (series_store, k)
7 debug_msg("Charm '%s' - using charm path '%s'" % (k, charm_path))
8- (branch, sep, revno) = CHARMS[k]["branch"].partition('@')
9- debug_msg("Branch: {}, revision: {}".format(branch, revno))
10+ (branch, sep, revno) = CHARMS[k].get("branch", '').partition('@')
11+ if branch:
12+ debug_msg("Branch: {}, revision: {}".format(branch, revno))
13+ else:
14+ debug_msg("No remote branch specified")
15 if os.path.exists(charm_path):
16 if opts.no_local_mods:
17 with cd(charm_path):
18@@ -151,7 +154,7 @@
19 log.error("Aborting")
20 exit(1)
21 debug_msg("Charm path exists @ %s." % charm_path)
22- if update_charms:
23+ if update_charms and branch:
24 debug_msg("Updating charm branch '%s'" % k)
25 code = subprocess.call(
26 ["bzr", "pull", "-d", charm_path, '--remember', branch])
27@@ -159,7 +162,7 @@
28 log.error("Could not update branch at {} from {}".format(
29 charm_path, branch))
30 exit(code)
31- else:
32+ elif branch:
33 print "- Cloning %s from %s" % (k, branch)
34 subprocess.call(["bzr", "branch", branch, charm_path])
35 if revno:
36@@ -170,6 +173,9 @@
37 log.error("Unable to check out branch revision {}".format(revno))
38 exit(code)
39 # load charms metadata
40+ if not os.path.isdir(charm_path):
41+ print "Branch for {} does not exist ({})".format(k, charm_path)
42+ exit(1)
43 mdf = open("%s/metadata.yaml" % charm_path, "r")
44 debug_msg("Loading metadata from %s/metadata.yaml" % charm_path)
45 CHARMS[k]["metadata"] = yaml.load(mdf)

Subscribers

People subscribed via source and target branches