Merge lp:~mvo/ubuntu-system-image/server-azure-device into lp:ubuntu-system-image/server

Proposed by Michael Vogt
Status: Merged
Merged at revision: 253
Proposed branch: lp:~mvo/ubuntu-system-image/server-azure-device
Merge into: lp:ubuntu-system-image/server
Diff against target: 59 lines (+11/-6)
2 files modified
lib/systemimage/generators.py (+9/-5)
tests/test_generators.py (+2/-1)
To merge this branch: bzr merge lp:~mvo/ubuntu-system-image/server-azure-device
Reviewer Review Type Date Requested Status
Registry Administrators Pending
Review via email: mp+242139@code.launchpad.net

Description of the change

This makes cdimage-device-raw more generic by supporting a device_name
so that we can support a different device tarfile for azure

To post a comment you must log in.
254. By Michael Vogt

device_name is azure_amd64

255. By Michael Vogt

fix rootfs lookup

256. By Michael Vogt

pep8 fix

257. By Michael Vogt

fix test coverage

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/systemimage/generators.py'
--- lib/systemimage/generators.py 2014-11-14 10:16:22 +0000
+++ lib/systemimage/generators.py 2014-11-18 23:15:56 +0000
@@ -368,7 +368,7 @@
368 arch = "armhf"368 arch = "armhf"
369 if environment['device_name'] in ("generic_x86", "generic_i386"):369 if environment['device_name'] in ("generic_x86", "generic_i386"):
370 arch = "i386"370 arch = "i386"
371 elif environment['device_name'] in ("generic_amd64",):371 elif environment['device_name'] in ("generic_amd64", "azure_amd64"):
372 arch = "amd64"372 arch = "amd64"
373373
374 # Check that the directory exists374 # Check that the directory exists
@@ -703,6 +703,8 @@
703 arch = "i386"703 arch = "i386"
704 elif environment['device_name'] in ("generic_amd64",):704 elif environment['device_name'] in ("generic_amd64",):
705 arch = "amd64"705 arch = "amd64"
706 elif environment['device_name'] == "azure_amd64":
707 arch = "amd64.azure"
706708
707 # Check that the directory exists709 # Check that the directory exists
708 if not os.path.exists(cdimage_path):710 if not os.path.exists(cdimage_path):
@@ -715,10 +717,11 @@
715 continue717 continue
716718
717 # Check for the custom tarball719 # Check for the custom tarball
718 raw_device_path = os.path.join(cdimage_path, version,720 raw_device_path = os.path.join(
719 "%s-preinstalled-%s-%s.device.tar.gz" %721 cdimage_path, version,
720 (series, options.get("product", "core"),722 "%s-preinstalled-%s-%s.device.tar.gz" %
721 arch))723 (series, options.get("product", "core"),
724 arch))
722 if not os.path.exists(raw_device_path):725 if not os.path.exists(raw_device_path):
723 continue726 continue
724727
@@ -783,6 +786,7 @@
783 metadata['series'] = series786 metadata['series'] = series
784 metadata['raw_device_path'] = raw_device_path787 metadata['raw_device_path'] = raw_device_path
785 metadata['raw_device_checksum'] = raw_device_hash788 metadata['raw_device_checksum'] = raw_device_hash
789 metadata['device'] = environment.get('device_name', 'none')
786790
787 with open(path.replace(".tar.xz", ".json"), "w+") as fd:791 with open(path.replace(".tar.xz", ".json"), "w+") as fd:
788 fd.write("%s\n" % json.dumps(metadata, sort_keys=True,792 fd.write("%s\n" % json.dumps(metadata, sort_keys=True,
789793
=== modified file 'tests/test_generators.py'
--- tests/test_generators.py 2014-11-14 14:59:34 +0000
+++ tests/test_generators.py 2014-11-18 23:15:56 +0000
@@ -363,7 +363,8 @@
363 for device_arch, cdimage_arch in (363 for device_arch, cdimage_arch in (
364 ("generic_x86", "i386"),364 ("generic_x86", "i386"),
365 ("generic_i386", "i386"),365 ("generic_i386", "i386"),
366 ("generic_amd64", "amd64")):366 ("generic_amd64", "amd64"),
367 ("azure_amd64", "amd64.azure")):
367 environment['device_name'] = device_arch368 environment['device_name'] = device_arch
368369
369 for filename in (370 for filename in (

Subscribers

People subscribed via source and target branches

to all changes: