Merge lp:~jtv/orchestra/odev-setup-arch into lp:~orchestra/orchestra/odev

Proposed by Jeroen T. Vermeulen
Status: Merged
Merged at revision: 100
Proposed branch: lp:~jtv/orchestra/odev-setup-arch
Merge into: lp:~orchestra/orchestra/odev
Diff against target: 57 lines (+26/-2)
2 files modified
setup.py (+16/-1)
zimmer-build/build (+10/-1)
To merge this branch: bzr merge lp:~jtv/orchestra/odev-setup-arch
Reviewer Review Type Date Requested Status
orchestra Pending
Review via email: mp+90290@code.launchpad.net

Description of the change

Make setup.py figure out the architecture for its juju cobbler profile, similar to what zimmer-build/build already does.

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 'setup.py'
2--- setup.py 2012-01-10 22:31:37 +0000
3+++ setup.py 2012-01-26 17:02:02 +0000
4@@ -3,6 +3,7 @@
5 import yaml
6 import Cheetah
7 import os
8+import re
9 import sys
10 import copy
11 import pprint
12@@ -166,9 +167,23 @@
13 raise Exception("failed to save %s" % system.name)
14 print "added %s" % system.name
15
16+
17+def get_profile_arch():
18+ """Get the system architecture for use in the cobbler setup profile."""
19+ # This should, for any given system, match what the zimmer-build
20+ # script does to determine the right architecture.
21+ arch_text = subprocess.check_output(
22+ ['/bin/uname', '-m'], stdout=subprocess.PIPE)
23+ if re.match('i.86', arch_text):
24+ return 'i386'
25+ else:
26+ return arch_text
27+
28+
29 def cobbler_setup(config):
30 hostip = "%s.1" % config['network']['ip_pre']
31- profile = "precise-x86_64-juju"
32+ arch = get_profile_arch()
33+ profile = "precise-%s-juju" % arch
34
35 cob = System(config, "zimmer")
36 server = xmlrpclib.Server("http://%s/cobbler_api" % cob.ipaddr)
37
38=== modified file 'zimmer-build/build'
39--- zimmer-build/build 2012-01-26 15:22:13 +0000
40+++ zimmer-build/build 2012-01-26 17:02:02 +0000
41@@ -1,6 +1,15 @@
42 #!/bin/bash
43
44-DEF_ZIMG="http://cloud-images.ubuntu.com/server/precise/current/precise-server-cloudimg-amd64-disk1.img"
45+# This should mirror what's in odev's setup.py, except here IA64 is called
46+# amd64, not x86_64.
47+GUEST_ARCHITECTURE=$(uname -m)
48+case "$GUEST_ARCHITECTURE" in
49+ i686) GUEST_ARCHITECTURE="i386" ;;
50+ x86_64) GUEST_ARCHITECTURE="amd64" ;;
51+esac
52+
53+
54+DEF_ZIMG="http://cloud-images.ubuntu.com/server/precise/current/precise-server-cloudimg-${GUEST_ARCHITECTURE}-disk1.img"
55 DEF_SAVE_D="pristine"
56 DEF_CI_BZR="lp:cloud-init"
57 DEF_UD_FILE="ud-build.txt"

Subscribers

People subscribed via source and target branches

to all changes: