← Back to team overview

orchestra team mailing list archive

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

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/orchestra/odev-setup-arch into lp:~orchestra/orchestra/odev.

Requested reviews:
  orchestra (orchestra)

For more details, see:
https://code.launchpad.net/~jtv/orchestra/odev-setup-arch/+merge/90290

Make setup.py figure out the architecture for its juju cobbler profile, similar to what zimmer-build/build already does.
-- 
https://code.launchpad.net/~jtv/orchestra/odev-setup-arch/+merge/90290
Your team orchestra is requested to review the proposed merge of lp:~jtv/orchestra/odev-setup-arch into lp:~orchestra/orchestra/odev.
=== modified file 'setup.py'
--- setup.py	2012-01-10 22:31:37 +0000
+++ setup.py	2012-01-26 17:02:02 +0000
@@ -3,6 +3,7 @@
 import yaml
 import Cheetah
 import os
+import re
 import sys
 import copy
 import pprint
@@ -166,9 +167,23 @@
 		raise Exception("failed to save %s" % system.name)
 	print "added %s" % system.name
 
+
+def get_profile_arch():
+	"""Get the system architecture for use in the cobbler setup profile."""
+	# This should, for any given system, match what the zimmer-build
+	# script does to determine the right architecture.
+	arch_text = subprocess.check_output(
+        ['/bin/uname', '-m'], stdout=subprocess.PIPE)
+	if re.match('i.86', arch_text):
+		return 'i386'
+	else:
+		return arch_text
+
+
 def cobbler_setup(config):
 	hostip = "%s.1" % config['network']['ip_pre']
-	profile = "precise-x86_64-juju"
+	arch = get_profile_arch()
+	profile = "precise-%s-juju" % arch
 	
 	cob = System(config, "zimmer")
 	server = xmlrpclib.Server("http://%s/cobbler_api"; % cob.ipaddr)

=== modified file 'zimmer-build/build'
--- zimmer-build/build	2012-01-26 15:22:13 +0000
+++ zimmer-build/build	2012-01-26 17:02:02 +0000
@@ -1,6 +1,15 @@
 #!/bin/bash
 
-DEF_ZIMG="http://cloud-images.ubuntu.com/server/precise/current/precise-server-cloudimg-amd64-disk1.img";
+# This should mirror what's in odev's setup.py, except here IA64 is called
+# amd64, not x86_64.
+GUEST_ARCHITECTURE=$(uname -m)
+case "$GUEST_ARCHITECTURE" in
+    i686) GUEST_ARCHITECTURE="i386" ;;
+    x86_64) GUEST_ARCHITECTURE="amd64" ;;
+esac
+
+
+DEF_ZIMG="http://cloud-images.ubuntu.com/server/precise/current/precise-server-cloudimg-${GUEST_ARCHITECTURE}-disk1.img";
 DEF_SAVE_D="pristine"
 DEF_CI_BZR="lp:cloud-init"
 DEF_UD_FILE="ud-build.txt"


Follow ups