Merge lp:~barry/ubuntu-system-image/server-si30-configd into lp:ubuntu-system-image/server

Proposed by Barry Warsaw
Status: Merged
Merged at revision: 266
Proposed branch: lp:~barry/ubuntu-system-image/server-si30-configd
Merge into: lp:ubuntu-system-image/server
Diff against target: 123 lines (+60/-8)
5 files modified
README.rst (+12/-0)
bin/copy-image (+1/-1)
bin/si-shell (+1/-1)
lib/systemimage/tests/test_tools.py (+16/-0)
lib/systemimage/tools.py (+30/-6)
To merge this branch: bzr merge lp:~barry/ubuntu-system-image/server-si30-configd
Reviewer Review Type Date Requested Status
Steve Langasek (community) Needs Information
Stéphane Graber Pending
Review via email: mp+257647@code.launchpad.net

This proposal supersedes a proposal from 2015-04-03.

Description of the change

  * Add support for system-image client 3.0 via symlinks from config.d.
  * Add some helpful links to README.rst
  * Fix some typos.

To post a comment you must log in.
Revision history for this message
Barry Warsaw (barry) wrote : Posted in a previous version of this proposal

I think the conflicts are because the prereq branch moves some things around. Probably best to merge that first, and then resubmit this against trunk.

Revision history for this message
Barry Warsaw (barry) wrote : Posted in a previous version of this proposal

Updated against the current toxify branch (which transitively updates to the current trunk). The conflicts are bogus. This branch is ready again.

Revision history for this message
Barry Warsaw (barry) wrote : Posted in a previous version of this proposal

Merged latest toxify branch. This branch should be ready to go too. The conflicts are bogus.

Revision history for this message
Steve Langasek (vorlon) wrote : Posted in a previous version of this proposal

See inline comment.

review: Needs Information
Revision history for this message
Barry Warsaw (barry) wrote :

Resubmitted against server trunk since prereq branch has landed. Hopefully this will eliminate the bogus conflicts.

Revision history for this message
Steve Langasek (vorlon) wrote :

Hi Barry,

Porting over my review inline comment from the previous MP.

review: Needs Information
Revision history for this message
Barry Warsaw (barry) wrote :

On Apr 28, 2015, at 11:32 PM, Steve Langasek wrote:

>This appears to be testing that the target of the symlink is an absolute path
>of system/etc/system-image/client.ini. This may be what the current code
>does, but is that the right result? Have you tested that this will be
>unpacked correctly on the client?

I'm actually trying to stand up a local server on a vm, but wow, entropy
creation in vm seems unbelievably slow!

276. By Barry Warsaw

* Use relative paths for the etc/system-image/config.d symlinks
* Provide some better debugging messages.
* Handle resource management better.
* Watch out for initrd.img not being gzip'd, but LP: #1452856

Revision history for this message
Barry Warsaw (barry) :
277. By Barry Warsaw

Fix the test.

Revision history for this message
Barry Warsaw (barry) wrote :

r277 is ready for re-review.

278. By Barry Warsaw

Undo a change that doesn't really help.

Revision history for this message
Barry Warsaw (barry) wrote :

Make that r278.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'README.rst'
2--- README.rst 2015-04-28 07:15:04 +0000
3+++ README.rst 2015-05-08 16:39:53 +0000
4@@ -99,3 +99,15 @@
5
6 Note however that the Python 3 test suite will have failures on Precise due to
7 other missing packages (e.g. `python3-gpgme`). If it hurts, don't do it.
8+
9+
10+See also
11+========
12+
13+For more information on setting up a server see:
14+
15+ https://wiki.ubuntu.com/ImageBasedUpgrades/ServerSetup
16+
17+For more information on operating a server see:
18+
19+ https://wiki.ubuntu.com/ImageBasedUpgrades/ServerOperation
20
21=== modified file 'bin/copy-image'
22--- bin/copy-image 2015-04-20 15:35:09 +0000
23+++ bin/copy-image 2015-05-08 16:39:53 +0000
24@@ -34,7 +34,7 @@
25 parser.add_argument("device", metavar="DEVICE")
26 parser.add_argument("version", metavar="VERSION", type=int)
27 parser.add_argument("-k", "--keep-version", action="store_true",
28- help="Keep the original verison number")
29+ help="Keep the original version number")
30 parser.add_argument("-p", "--phased-percentage", type=int,
31 help="Set the phased percentage for the copied image",
32 default=100)
33
34=== modified file 'bin/si-shell'
35--- bin/si-shell 2015-03-11 20:55:00 +0000
36+++ bin/si-shell 2015-05-08 16:39:53 +0000
37@@ -58,7 +58,7 @@
38 # Start the shell
39 banner = """Welcome to the system-image shell.
40 The configuration is available as: conf
41-The system-image tree is availabe as: pub
42+The system-image tree is available as: pub
43 """
44
45 class CompleterConsole(code.InteractiveConsole):
46
47=== modified file 'lib/systemimage/tests/test_tools.py'
48--- lib/systemimage/tests/test_tools.py 2015-03-31 20:51:38 +0000
49+++ lib/systemimage/tests/test_tools.py 2015-05-08 16:39:53 +0000
50@@ -300,3 +300,19 @@
51 tools.repack_recovery_keyring(self.config, "%s/recovery.tar.xz" %
52 self.temp_directory,
53 "archive-master")
54+
55+ def test_system_image_30_symlinks(self):
56+ # To support system-image 3.0, generate symlinks for config.d
57+ version_tarball = "%s/version.tar" % self.temp_directory
58+ tools.generate_version_tarball(self.config, "testing", "test",
59+ "1.2.3.4",
60+ version_tarball)
61+ version_tarfile = tarfile.open(version_tarball, "r:")
62+ default_ini = version_tarfile.getmember(
63+ "system/etc/system-image/config.d/00_default.ini")
64+ self.assertEqual(default_ini.type, tarfile.SYMTYPE)
65+ self.assertEqual(default_ini.linkname, "../client.ini")
66+ channel_ini = version_tarfile.getmember(
67+ "system/etc/system-image/config.d/01_channel.ini")
68+ self.assertEqual(channel_ini.type, tarfile.SYMTYPE)
69+ self.assertEqual(channel_ini.linkname, "../channel.ini")
70
71=== modified file 'lib/systemimage/tools.py'
72--- lib/systemimage/tools.py 2015-04-20 15:38:11 +0000
73+++ lib/systemimage/tools.py 2015-05-08 16:39:53 +0000
74@@ -124,6 +124,32 @@
75
76 tarball.addfile(channel_file, BytesIO(channel.encode("utf-8")))
77
78+ # With system-image 3.0, we need a couple of additional files. For now we
79+ # can just use symlink, but once support for system-image < 3.0 is
80+ # removed, these symlinks should become real files and the channel_file
81+ # should be removed.
82+ #
83+ # We use relative paths in the links so that we don't have to worry
84+ # about the recovery "system/" prefix.
85+ path_00_default = os.path.join(
86+ os.path.dirname(channel_path),
87+ "config.d", "00_default.ini")
88+ default_file = tarfile.TarInfo()
89+ default_file.name = path_00_default
90+ default_file.type = tarfile.SYMTYPE
91+ default_file.linkname = "../client.ini"
92+ tarball.addfile(default_file)
93+
94+ path_01_channel = os.path.join(
95+ os.path.dirname(channel_path),
96+ "config.d", "01_channel.ini")
97+ channel_file = tarfile.TarInfo()
98+ channel_file.name = path_01_channel
99+ channel_file.type = tarfile.SYMTYPE
100+ channel_file.linkname = os.path.join(
101+ "..", os.path.basename(channel_path))
102+ tarball.addfile(channel_file)
103+
104 tarball.close()
105
106
107@@ -169,13 +195,11 @@
108 if os.path.exists(destination):
109 raise Exception("Destination already exists: %s" % destination)
110
111- logger.debug("Ungzipping file: %s" % destination)
112+ logger.debug("Ungzipping {} to: {}".format(path, destination))
113
114- compressed = gzip.open(path, "rb")
115- uncompressed = open(destination, "wb+")
116- uncompressed.writelines(compressed)
117- uncompressed.close()
118- compressed.close()
119+ with gzip.open(path, "rb") as compressed:
120+ with open(destination, "wb+") as uncompressed:
121+ uncompressed.writelines(compressed)
122
123 return destination
124

Subscribers

People subscribed via source and target branches

to all changes: