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
=== modified file 'README.rst'
--- README.rst 2015-04-28 07:15:04 +0000
+++ README.rst 2015-05-08 16:39:53 +0000
@@ -99,3 +99,15 @@
9999
100Note however that the Python 3 test suite will have failures on Precise due to100Note however that the Python 3 test suite will have failures on Precise due to
101other missing packages (e.g. `python3-gpgme`). If it hurts, don't do it.101other missing packages (e.g. `python3-gpgme`). If it hurts, don't do it.
102
103
104See also
105========
106
107For more information on setting up a server see:
108
109 https://wiki.ubuntu.com/ImageBasedUpgrades/ServerSetup
110
111For more information on operating a server see:
112
113 https://wiki.ubuntu.com/ImageBasedUpgrades/ServerOperation
102114
=== modified file 'bin/copy-image'
--- bin/copy-image 2015-04-20 15:35:09 +0000
+++ bin/copy-image 2015-05-08 16:39:53 +0000
@@ -34,7 +34,7 @@
34 parser.add_argument("device", metavar="DEVICE")34 parser.add_argument("device", metavar="DEVICE")
35 parser.add_argument("version", metavar="VERSION", type=int)35 parser.add_argument("version", metavar="VERSION", type=int)
36 parser.add_argument("-k", "--keep-version", action="store_true",36 parser.add_argument("-k", "--keep-version", action="store_true",
37 help="Keep the original verison number")37 help="Keep the original version number")
38 parser.add_argument("-p", "--phased-percentage", type=int,38 parser.add_argument("-p", "--phased-percentage", type=int,
39 help="Set the phased percentage for the copied image",39 help="Set the phased percentage for the copied image",
40 default=100)40 default=100)
4141
=== modified file 'bin/si-shell'
--- bin/si-shell 2015-03-11 20:55:00 +0000
+++ bin/si-shell 2015-05-08 16:39:53 +0000
@@ -58,7 +58,7 @@
58 # Start the shell58 # Start the shell
59 banner = """Welcome to the system-image shell.59 banner = """Welcome to the system-image shell.
60The configuration is available as: conf60The configuration is available as: conf
61The system-image tree is availabe as: pub61The system-image tree is available as: pub
62"""62"""
6363
64 class CompleterConsole(code.InteractiveConsole):64 class CompleterConsole(code.InteractiveConsole):
6565
=== modified file 'lib/systemimage/tests/test_tools.py'
--- lib/systemimage/tests/test_tools.py 2015-03-31 20:51:38 +0000
+++ lib/systemimage/tests/test_tools.py 2015-05-08 16:39:53 +0000
@@ -300,3 +300,19 @@
300 tools.repack_recovery_keyring(self.config, "%s/recovery.tar.xz" %300 tools.repack_recovery_keyring(self.config, "%s/recovery.tar.xz" %
301 self.temp_directory,301 self.temp_directory,
302 "archive-master")302 "archive-master")
303
304 def test_system_image_30_symlinks(self):
305 # To support system-image 3.0, generate symlinks for config.d
306 version_tarball = "%s/version.tar" % self.temp_directory
307 tools.generate_version_tarball(self.config, "testing", "test",
308 "1.2.3.4",
309 version_tarball)
310 version_tarfile = tarfile.open(version_tarball, "r:")
311 default_ini = version_tarfile.getmember(
312 "system/etc/system-image/config.d/00_default.ini")
313 self.assertEqual(default_ini.type, tarfile.SYMTYPE)
314 self.assertEqual(default_ini.linkname, "../client.ini")
315 channel_ini = version_tarfile.getmember(
316 "system/etc/system-image/config.d/01_channel.ini")
317 self.assertEqual(channel_ini.type, tarfile.SYMTYPE)
318 self.assertEqual(channel_ini.linkname, "../channel.ini")
303319
=== modified file 'lib/systemimage/tools.py'
--- lib/systemimage/tools.py 2015-04-20 15:38:11 +0000
+++ lib/systemimage/tools.py 2015-05-08 16:39:53 +0000
@@ -124,6 +124,32 @@
124124
125 tarball.addfile(channel_file, BytesIO(channel.encode("utf-8")))125 tarball.addfile(channel_file, BytesIO(channel.encode("utf-8")))
126126
127 # With system-image 3.0, we need a couple of additional files. For now we
128 # can just use symlink, but once support for system-image < 3.0 is
129 # removed, these symlinks should become real files and the channel_file
130 # should be removed.
131 #
132 # We use relative paths in the links so that we don't have to worry
133 # about the recovery "system/" prefix.
134 path_00_default = os.path.join(
135 os.path.dirname(channel_path),
136 "config.d", "00_default.ini")
137 default_file = tarfile.TarInfo()
138 default_file.name = path_00_default
139 default_file.type = tarfile.SYMTYPE
140 default_file.linkname = "../client.ini"
141 tarball.addfile(default_file)
142
143 path_01_channel = os.path.join(
144 os.path.dirname(channel_path),
145 "config.d", "01_channel.ini")
146 channel_file = tarfile.TarInfo()
147 channel_file.name = path_01_channel
148 channel_file.type = tarfile.SYMTYPE
149 channel_file.linkname = os.path.join(
150 "..", os.path.basename(channel_path))
151 tarball.addfile(channel_file)
152
127 tarball.close()153 tarball.close()
128154
129155
@@ -169,13 +195,11 @@
169 if os.path.exists(destination):195 if os.path.exists(destination):
170 raise Exception("Destination already exists: %s" % destination)196 raise Exception("Destination already exists: %s" % destination)
171197
172 logger.debug("Ungzipping file: %s" % destination)198 logger.debug("Ungzipping {} to: {}".format(path, destination))
173199
174 compressed = gzip.open(path, "rb")200 with gzip.open(path, "rb") as compressed:
175 uncompressed = open(destination, "wb+")201 with open(destination, "wb+") as uncompressed:
176 uncompressed.writelines(compressed)202 uncompressed.writelines(compressed)
177 uncompressed.close()
178 compressed.close()
179203
180 return destination204 return destination
181205

Subscribers

People subscribed via source and target branches

to all changes: