launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24139
[Merge] lp:~mwhudson/launchpad-buildd/lp-1852518-again-again into lp:launchpad-buildd
Michael Hudson-Doyle has proposed merging lp:~mwhudson/launchpad-buildd/lp-1852518-again-again into lp:launchpad-buildd.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~mwhudson/launchpad-buildd/lp-1852518-again-again/+merge/376032
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mwhudson/launchpad-buildd/lp-1852518-again-again into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog 2019-11-26 12:23:40 +0000
+++ debian/changelog 2019-11-26 20:29:27 +0000
@@ -1,3 +1,10 @@
+launchpad-buildd (183) UNRELEASED; urgency=medium
+
+ * Invoke dmsetup with sudo when calculating the device major number for
+ device mapper.
+
+ -- Michael Hudson-Doyle <michael.hudson@xxxxxxxxxx> Wed, 27 Nov 2019 09:24:27 +1300
+
launchpad-buildd (182) xenial; urgency=medium
[ Michael Hudson-Doyle ]
=== modified file 'lpbuildd/target/lxd.py'
--- lpbuildd/target/lxd.py 2019-11-26 00:09:08 +0000
+++ lpbuildd/target/lxd.py 2019-11-26 20:29:27 +0000
@@ -44,11 +44,11 @@
if not os.path.exists("/dev/dm-0"):
created = True
subprocess.check_call(
- ["dmsetup", "create", "tmpdevice", "--notable"])
+ ["sudo", "dmsetup", "create", "tmpdevice", "--notable"])
major = os.major(os.stat("/dev/dm-0").st_rdev)
if created:
subprocess.check_call(
- ["dmsetup", "remove", "tmpdevice"])
+ ["sudo", "dmsetup", "remove", "tmpdevice"])
return major
=== modified file 'lpbuildd/target/tests/test_lxd.py'
--- lpbuildd/target/tests/test_lxd.py 2019-11-26 12:19:33 +0000
+++ lpbuildd/target/tests/test_lxd.py 2019-11-26 20:29:27 +0000
@@ -346,11 +346,12 @@
"/etc/hosts": [b"127.0.0.1\tlocalhost\n"],
})
processes_fixture = self.useFixture(FakeProcesses())
- processes_fixture.add(lambda _: {}, name="sudo")
- processes_fixture.add(lambda _: {}, name="lxc")
- def fake_dmsetup(args):
- command = args["args"][1]
+ def fake_sudo(args):
+ exe = args["args"][1]
+ if exe != "dmsetup":
+ return {}
+ command = args["args"][2]
if command == "create":
os.mknod(
"/dev/dm-0", 0o660 | stat.S_IFBLK,
@@ -360,8 +361,8 @@
else:
self.fail("unexpected dmsetup command %r" % (command,))
return {}
-
- processes_fixture.add(fake_dmsetup, name="dmsetup")
+ processes_fixture.add(fake_sudo, name="sudo")
+ processes_fixture.add(lambda _: {}, name="lxc")
processes_fixture.add(
FakeHostname("example", "example.buildd"), name="hostname")
LXD("1", "xenial", "amd64").start()
@@ -414,8 +415,8 @@
"b", "7", str(minor)]))
if not with_dm0:
expected_args.extend([
- Equals(["dmsetup", "create", "tmpdevice", "--notable"]),
- Equals(["dmsetup", "remove", "tmpdevice"]),
+ Equals(["sudo", "dmsetup", "create", "tmpdevice", "--notable"]),
+ Equals(["sudo", "dmsetup", "remove", "tmpdevice"]),
])
for minor in range(8):
expected_args.append(