Merge ~sdhd/curtin:devel-pyudev into curtin:master

Proposed by Sascha Dewald
Status: Needs review
Proposed branch: ~sdhd/curtin:devel-pyudev
Merge into: curtin:master
Diff against target: 1542 lines (+1262/-93)
11 files modified
Makefile (+9/-1)
curtin/block/__init__.py (+26/-32)
curtin/udev.py (+33/-1)
debian/README.source (+5/-0)
debian/changelog (+1133/-0)
debian/control (+2/-22)
debian/rules (+5/-4)
requirements.txt (+1/-0)
tests/unittests/test_block.py (+13/-33)
tests/unittests/test_udev.py (+33/-0)
tox.ini (+2/-0)
Reviewer Review Type Date Requested Status
Ryan Harper Pending
Review via email: mp+374777@code.launchpad.net

Description of the change

fix a bug with block devices which have special chars in the serial

e. g. my device has mixed braces in the serial nuumber

To post a comment you must log in.
Revision history for this message
Sascha Dewald (sdhd) wrote :

oh :-o

the previous discussion was deleted with the old branch :-(

~sdhd/curtin:devel-pyudev updated
1290e99... by Sascha Dewald on 2019-10-28

regression on maxsplits

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

"e. g. my device has mixed braces in the serial nuumber" can you provide the `udevadm info` for it please?

Unmerged commits

1290e99... by Sascha Dewald on 2019-10-28

regression on maxsplits

81b202f... by Sascha Dewald on 2019-10-27

Merge branch 'master' into pyudev

171b5b2... by Sascha Dewald on 2019-10-27

remove test_lookup_disk_wwn, because with pyudev it is duplicate

5583e48... by Sascha Dewald on 2019-10-27

new upstream

724f1df... by Sascha Dewald on 2019-10-27

fix test_get_dev_by_id

66bbf32... by Sascha Dewald on 2019-10-27

add search for wwn

0fdf6d7... by Sascha Dewald on 2019-10-25

add pyudev dependencies to debian/control

812319d... by Sascha Dewald on 2019-10-25

add distclean to Makefile

b40ea2f... by Sascha Dewald on 2019-10-24

fix nosetests

18c2ec8... by Sascha Dewald on 2019-10-24

fix flake

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 827102c..f1ec7ca 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -64,4 +64,12 @@ sync-images:
6 clean:
7 rm -rf doc/_build
8
9-.PHONY: all clean test pyflakes pyflakes3 pep8 build style-check check-doc-deps
10+distclean: clean
11+ find . -name '*.pyc' -delete -o -name __pycache__ -delete
12+ rm -rf .tox/
13+ rm -f .coverage
14+ rm -rf .pytest_cache/
15+ rm -rf curtin.egg-info/
16+ rm -f $(wildcard *.dsc *.deb *.build *.buildinfo *.changes *.tar.gz *.tar.xz *.upload)
17+
18+.PHONY: all clean distclean test pyflakes pyflakes3 pep8 build style-check check-doc-deps
19diff --git a/curtin/block/__init__.py b/curtin/block/__init__.py
20index f30c5df..6dda91d 100644
21--- a/curtin/block/__init__.py
22+++ b/curtin/block/__init__.py
23@@ -8,11 +8,12 @@ import stat
24 import sys
25 import tempfile
26
27+
28 from curtin import util
29 from curtin.block import lvm
30 from curtin.block import multipath
31 from curtin.log import LOG
32-from curtin.udev import udevadm_settle, udevadm_info
33+from curtin.udev import udevadm_settle, udevadm_info, get_disk_by_id
34 from curtin import storage_config
35
36
37@@ -735,38 +736,31 @@ def get_device_mapper_links(devpath, first=False):
38
39 def lookup_disk(serial):
40 """
41- Search for a disk by its serial number using /dev/disk/by-id/
42- """
43- # Get all volumes in /dev/disk/by-id/ containing the serial string. The
44- # string specified can be either in the short or long serial format
45- # hack, some serials have spaces, udev usually converts ' ' -> '_'
46- serial_udev = serial.replace(' ', '_')
47- LOG.info('Processing serial %s via udev to %s', serial, serial_udev)
48-
49- disks = list(filter(lambda x: serial_udev in x,
50- os.listdir("/dev/disk/by-id/")))
51- if not disks or len(disks) < 1:
52- raise ValueError("no disk with serial '%s' found" % serial_udev)
53-
54- # Sort by length and take the shortest path name, as the longer path names
55- # will be the partitions on the disk. Then use os.path.realpath to
56- # determine the path to the block device in /dev/
57- disks.sort(key=lambda x: len(x))
58- LOG.debug('lookup_disks found: %s', disks)
59- path = os.path.realpath("/dev/disk/by-id/%s" % disks[0])
60- LOG.debug('lookup_disks realpath(%s)=%s', disks[0], path)
61- if multipath.is_mpath_device(path):
62- LOG.debug('Detected multipath device, finding a members')
63- info = udevadm_info(path)
64- mpath_members = sorted(multipath.find_mpath_members(info['DM_NAME']))
65- LOG.debug('mpath members: %s', mpath_members)
66- if len(mpath_members):
67- path = mpath_members[0]
68+ Search for a disk by its serial number using udev
69+ """
70+ try:
71+ disk = next(get_disk_by_id(serial))
72+ LOG.debug('lookup_disks found: %s', disk.device_path)
73+ path = next(disk.device_links)
74+ path = os.path.realpath(path)
75
76- if not os.path.exists(path):
77- raise ValueError("path '%s' to block device for disk with serial '%s' \
78- does not exist" % (path, serial_udev))
79- return path
80+ LOG.debug('lookup_disks realpath=%s', path)
81+ if multipath.is_mpath_device(path):
82+ LOG.debug('Detected multipath device, finding a members')
83+ info = udevadm_info(path)
84+ mpath_members = sorted(
85+ multipath.find_mpath_members(info['DM_NAME']))
86+ LOG.debug('mpath members: %s', mpath_members)
87+ if len(mpath_members):
88+ path = mpath_members[0]
89+
90+ if not os.path.exists(path):
91+ raise ValueError("path '%s' to block device for disk with serial '%s' \
92+ does not exist" % (path, serial))
93+
94+ return path
95+ except StopIteration:
96+ raise ValueError("disk with serial '%s' does not exist" % serial)
97
98
99 def lookup_dasd(bus_id):
100diff --git a/curtin/udev.py b/curtin/udev.py
101index 106a7e7..51385e4 100644
102--- a/curtin/udev.py
103+++ b/curtin/udev.py
104@@ -1,6 +1,11 @@
105 # This file is part of curtin. See LICENSE file for copyright and license info.
106
107 import os
108+import itertools
109+
110+
111+import pyudev
112+
113 from curtin import util
114 from curtin.log import logged_call
115
116@@ -83,7 +88,8 @@ def udevadm_info(path=None):
117 continue
118 # maxsplit=2 gives us key and remaininng part of line is value
119 # py2.7 on Trusty doesn't have keyword, pass as argument
120- key, value = line.split('=', 2)
121+ splits = line.split('=')
122+ key, value = splits[0], ''.join(splits[1:])
123 if not value:
124 value = None
125 if value:
126@@ -98,4 +104,30 @@ def udevadm_info(path=None):
127 return info
128
129
130+def get_dev_by_id(serial):
131+ """ Return a chain-iter with devices
132+
133+ :params: serial: serial number of the device
134+ :returns: itertools.chain with pyudev.Device's
135+ :raises: FIXME
136+ """
137+ chain = itertools.chain
138+ context = pyudev.Context()
139+ return chain(context.list_devices(ID_SERIAL_SHORT=serial),
140+ context.list_devices(ID_SERIAL=serial),
141+ context.list_devices(ID_WWN=serial),
142+ context.list_devices(ID_WWN_WITH_EXTENSION=serial))
143+
144+
145+def get_disk_by_id(serial):
146+ """ Return a enumarator with disk-devices
147+
148+ :params: serial: serial number of the device
149+ :returns: enumerator with disk
150+ :raises: StopIterator
151+ """
152+ for dev in get_dev_by_id(serial):
153+ if dev.device_type == 'disk':
154+ yield dev
155+
156 # vi: ts=4 expandtab syntax=python
157diff --git a/debian/README.source b/debian/README.source
158new file mode 100644
159index 0000000..ccf4119
160--- /dev/null
161+++ b/debian/README.source
162@@ -0,0 +1,5 @@
163+To pull a new upstream snapshot, given lp:curtin in ../trunk:
164+
165+ ./debian/new-upstream-snapshot ../trunk
166+
167+Then, edit changelog and look at entries in 'new-changes.log'.
168diff --git a/debian/changelog b/debian/changelog
169new file mode 100644
170index 0000000..f93f3b2
171--- /dev/null
172+++ b/debian/changelog
173@@ -0,0 +1,1133 @@
174+curtin (19.2-9-g38ce22b0-0ubuntu2) eoan; urgency=medium
175+
176+ * add get_dev_by_id from udev
177+ * add get_disk_by_id from udev
178+ * add some docstrings to udev functions and tests
179+ * add pyudev requirement
180+ * update lookup_disk with udev function
181+ * fix flake
182+ * fix nosetests
183+ * add distclean to Makefile
184+ * add pyudev dependencies to debian/control
185+ * add search for wwn
186+ * fix test_get_dev_by_id
187+
188+ -- Sascha Dewald <sascha.dewald@gmail.com> Sun, 27 Oct 2019 17:16:36 +0100
189+
190+curtin (19.2-9-g38ce22b0-0ubuntu1) eoan; urgency=medium
191+
192+ * New upstream snapshot.
193+ - vmtest: fix typo in EoanBcacheBasic test name
194+ - storage schema: Update nvme wwn regex to allow for nvme wwid format
195+ (LP: #1841321)
196+ - Allow EUI-64 formatted WWNs for disks and accept NVMe partition naming
197+ [Reed Slaby] (LP: #1840524)
198+
199+ -- Ryan Harper <ryan.harper@canonical.com> Wed, 28 Aug 2019 11:40:32 -0500
200+
201+curtin (19.2-6-g88a1a7ec-0ubuntu1) eoan; urgency=medium
202+
203+ * New upstream snapshot.
204+ - Makefile: split Python 2 and Python 3 unittest targets apart
205+ * debian/*: drop python-curtin, making the package Python 3-only.
206+ * debian/control: drop Build-Depends on linting tools, they haven't been
207+ used by the upstream test suite in a while.
208+
209+ -- Daniel Watkins <oddbloke@ubuntu.com> Wed, 21 Aug 2019 13:29:50 -0400
210+
211+curtin (19.2-5-g44997e86-0ubuntu1) eoan; urgency=medium
212+
213+ * New upstream snapshot.
214+ - Switch to the new btrfs-progs package name, with btrfs-tools fallback.
215+ [Dimitri John Ledkov]
216+ - vmtest: bump ram size on Zfs tests for Disco and Eoan
217+ - vmtest: drop Cosmic test cases
218+ - unittests: mock subp in ChrootableTarget _exit_ test cases
219+ - util.ChrootableTarget: skip rename of resolv.conf if not present in
220+ target (LP: #1834382)
221+
222+ -- Daniel Watkins <oddbloke@ubuntu.com> Thu, 15 Aug 2019 12:27:10 -0400
223+
224+curtin (19.2-0ubuntu1) eoan; urgency=medium
225+
226+ * New upstream release.
227+ - Release 19.2 (LP: #1836951)
228+ - storage_config: a missing ID_PART_TABLE_TYPE key means no ptable
229+ [Michael Hudson-Doyle]
230+ - vmtests: drop skip_by_date decorators for bug 1813228
231+ - block: Add opportunistic zkey encryption if supported
232+ - vmtests: add support for CURTIN_VMTEST_APT_PROXY
233+ - vmtests: add use of CURTIN_VMTEST_ prefixed envvars to image sync
234+ - vmtest: dont raise SkipTest in class definition
235+
236+ -- Ryan Harper <ryan.harper@canonical.com> Wed, 17 Jul 2019 15:39:33 -0500
237+
238+curtin (19.1-7-g37a7a0f4-0ubuntu1) eoan; urgency=medium
239+
240+ * New upstream snapshot.
241+ - vmtests: determine block name via dname when verifying volume groups
242+ - vmtest: add Centos66/Centos70 FromBionic release and re-add tests
243+ - block-discover: add cli/API for exporting existing storage to config
244+ - vmtest: refactor test_network code for Eoan
245+ - curthoooks: disable daemons while reconfiguring mdadm
246+ [Michael Hudson-Doyle] (LP: #1829325.)
247+ - mdadm: fix install to existing raid [Michael Hudson-Doyle] (LP: #1830157)
248+ - apt_proxy env var set but empty => do not setup any proxy
249+ [Paride Legovini]
250+
251+ -- Chad Smith <chad.smith@canonical.com> Wed, 05 Jun 2019 10:45:42 -0600
252+
253+curtin (19.1-0ubuntu1) eoan; urgency=medium
254+
255+ * New upstream release.
256+ - release 19.1
257+ - vmtest: add missing skip_by_date on Eoan test_network_mtu
258+ - vmtest: remove skip_by_date on Disco Allindata test
259+ - block: support multipath devices in lookup and partition_kname
260+ (LP: #1813228)
261+ - grub: add grub config to control os_prober,terminal settings in target
262+ - vmtest: add eoan tests [Paride Legovini]
263+ - vmtest: add dependency on python3-jsonschema [Paride Legovini]
264+ - Pylint compatibility with Python 3.7 [Paride Legovini] (LP: #1828229)
265+ - vmtest: disable disco multipath test
266+ - vmtests: bump network mtu tests out a bit
267+ - Fix up yaml.load warnings
268+ - vmtest: disable trusty, it's dead jim
269+
270+ -- Daniel Watkins <oddbloke@ubuntu.com> Wed, 22 May 2019 10:26:52 -0400
271+
272+curtin (18.2-26-gd8e45d79-0ubuntu1) eoan; urgency=medium
273+
274+ * New upstream snapshot.
275+ - vmtest: reenable UEFI 4k tests, which got dropped when fixing
276+ subclassing.
277+ - vmtests: Add test_kernel_img_conf stub for PsuedoVMBaseClass
278+ - curthooks: chzdev_import must encode data if provided (LP: #1825007)
279+ - vmtest: test for kernel-img conf on ubuntu only
280+
281+ -- Ryan Harper <ryan.harper@canonical.com> Tue, 23 Apr 2019 09:32:56 -0500
282+
283+curtin (18.2-22-g08bf6ff7-0ubuntu1) disco; urgency=medium
284+
285+ * New upstream snapshot.
286+ - Setup kernel-img.conf like base-installer/live-installer did.
287+ [Dimitri John Ledkov] (LP: #1534162)
288+ - zfs: pass pool and fs properties to zpool_create
289+ [Jean-Baptiste Lallement] (LP: #1823682)
290+ - block_meta: pass lvm_partition size through human2bytes
291+ [Michael Hudson-Doyle]
292+
293+ -- Ryan Harper <ryan.harper@canonical.com> Thu, 11 Apr 2019 14:22:33 -0500
294+
295+curtin (18.2-19-g36351dea-0ubuntu1) disco; urgency=medium
296+
297+ * New upstream snapshot.
298+ - clear-holders: refactor bcache shutdown and add longer timeout
299+ (LP: #1796292)
300+ - schema-validate-storage: remove unused imports [Paride Legovini]
301+ - add subcommand schema for storage-config validation
302+ - clear-holders: wipe raid members at data offsets when not assembled
303+ (LP: #1815018)
304+ - Add support for s390 DASD devices
305+ - vmtest: skip DiscoTestAllindata while initrd lacks crypto modules
306+ - block_meta: allow passing a dm_crypt key by keyfile
307+ [Michael Hudson-Doyle]
308+ - ChrootableTarget: add /run to mounts for redhat targets (LP: #1815666)
309+ - vmtest: consolidate vm mem config, defaults via release, env override
310+
311+ -- Ryan Harper <ryan.harper@canonical.com> Wed, 03 Apr 2019 14:46:09 -0500
312+
313+curtin (18.2-10-g7afd77fa-0ubuntu1) disco; urgency=medium
314+
315+ * New upstream snapshot.
316+ - Support for multi-layers images fsimage-layered:// URI
317+ [Jean-Baptiste Lallement]
318+ - dname: relax dname req for disk serial/wwn presence for compatibility
319+ (LP: #1735839)
320+ - flake8: fix some E117 over-indented issues [Paride Legovini]
321+ - bcache: ensure partitions on bcache devices are detected as partition
322+ - vmtest: bump skip_by_date out a year for trusty bcache bug
323+ - Fix typo in doc/topics/integration-testing.rst. [Paride Legovini]
324+ - flake8: Fix two issues found with new version of flake8
325+ - clear-holders: handle FileNotFound when probing for bcache device slaves
326+ (LP: #1811117)
327+ - vmtests: network mtu fix-by bump to post 19.04 release
328+ - vmtest: Fix bug preventing explicit disabling of system_upgrade.
329+
330+ -- Ryan Harper <ryan.harper@canonical.com> Wed, 27 Feb 2019 16:43:21 -0600
331+
332+curtin (18.2-0ubuntu1) disco; urgency=medium
333+
334+ * New upstream release (18.2).
335+ - Release 18.2
336+ - Adjust helpers/common to edit GRUB_CMDLINE_LINUX_DEFAULT in place.
337+ (LP: #1527664)
338+ - dname: persistent names based on serial or wwn (LP: #1735839)
339+ - Fix bug in is_swap_device if a device was smaller than page_size.
340+ (LP: #1803672)
341+ - vmtest: add disco tests [Joshua Powers]
342+ - unittest: change directory to tmpdir for testing relative files.
343+ - Add clear-holders to meta-simple (LP: #1786736)
344+ - vmtests: check install log for Out of memory kernel messages and fail
345+ - unittest: correctly use tmpdir for my.img [Joshua Powers] (LP: #1803611)
346+ - block_meta: use wipe config when clearing partitions (LP: #1800153)
347+ - tests: fix vmtests for apt perserve_source_list changes
348+ - apt: Use new format apt config when writing preserve_sources_list.
349+ (LP: #1735950)
350+ - vmtests: multipath mount /home with nofail and validate in unittest
351+ - vmtests: fix common collect scripts to not exit failure.
352+ - vmtest: handle collect disk unpack failure
353+ - vmtests: dont use multiple subclasses in uefi 4k tests
354+ - vmtests: disable snapd/seeding to avoid boot hang
355+ - jenkins-runner: fix when using --filter only
356+
357+ -- Ryan Harper <ryan.harper@canonical.com> Thu, 06 Dec 2018 12:11:01 -0600
358+
359+curtin (18.1-59-g0f993084-0ubuntu1) cosmic; urgency=medium
360+
361+ * New upstream snapshot.
362+ - distro: fix system_upgrade command using string instead of function
363+ (LP: #1796968)
364+ - Capture stdout when using lxc file push
365+ - vmtest: boot ephemeral with 'ro' on the kernel command line.
366+
367+ -- Ryan Harper <ryan.harper@canonical.com> Wed, 10 Oct 2018 11:22:30 -0500
368+
369+curtin (18.1-56-g3aafe77d-0ubuntu1) cosmic; urgency=medium
370+
371+ * New upstream snapshot.
372+ - vmtest: Fix typo in skip-by-date.
373+ - vmtest: kick skip-by-date for 1671951.
374+ - tools/jenkins-runner: Error if both filters and tests are given.
375+ - vmtests: prevent tests from modifying cls.collect_scripts
376+
377+ -- Chad Smith <chad.smith@canonical.com> Tue, 02 Oct 2018 16:07:51 -0600
378+
379+curtin (18.1-52-g5f0082d1-0ubuntu1) cosmic; urgency=medium
380+
381+ * New upstream snapshot.
382+ - Enable custom storage configuration for centos images
383+
384+ -- Ryan Harper <ryan.harper@canonical.com> Fri, 21 Sep 2018 03:04:42 -0500
385+
386+curtin (18.1-51-gb812ae80-0ubuntu1) cosmic; urgency=medium
387+
388+ * New upstream snapshot.
389+ - vmtest: ensure we collect /var/log/journal only once
390+
391+ -- Chad Smith <chad.smith@canonical.com> Tue, 21 Aug 2018 11:44:46 -0600
392+
393+curtin (18.1-50-g2d9b2c6f-0ubuntu1) cosmic; urgency=medium
394+
395+ * New upstream snapshot.
396+ - clear-holders: handle missing zpool/zfs tools when wiping
397+ - clear-holders: rescan for lvm devices after assembling raid arrays
398+ - vmtest: enable persistent journal and collect at boot time
399+ - Add timing and logging functions.
400+ - parse_dpkg_version: support non-numeric in version string.
401+ - Don't allow reads of /proc and modprobe zfs through
402+
403+ -- Chad Smith <chad.smith@canonical.com> Mon, 20 Aug 2018 09:22:06 -0600
404+
405+curtin (18.1-44-g2b12b8fc-0ubuntu1) cosmic; urgency=medium
406+
407+ * New upstream snapshot.
408+ - Add main so that 'python3 -m curtin' does the right thing.
409+ - Add subcommand 'features'.
410+ - block: use uuid4 (random) when autogenerating UUIDS for filesystems
411+ - vmtests: Increase size of root filesystems.
412+ - clear-holders: reread ptable after wiping disks with partitions
413+ - vmtest: Skip proposed pocket on dev release when 'proposed' in ADD_REPOS.
414+ - tests: remove Ubuntu Artful [Joshua Powers]
415+ - vmtests: Let a raised SkipTest go through skip_by_date.
416+ - vmtests: Increase root fs to give upgrades to -proposed more space.
417+ - vmtest: Order the vmtest_pollinate late_command earlier.
418+ - vmtest: always add 'curtin/vmtest' to installed pollinate user_agent.
419+ - vmtests: make skip_by_date a decorator that runs and reports.
420+ - vmtests: always declare certain attributes and remove redundant tests.
421+ - vmtests: Add Cosmic release to tests [Joshua Powers]
422+ - vmtests: skip TrustyTestMdadmBcache until 2019-01-22.
423+ - tox: use simplestreams from git repository rather than bzr.
424+ - document that you can set ptable on raids [Michael Hudson-Doyle]
425+ - vmtests: move skip-by date of xfs root and xfs boot out 1 year.
426+ - vmtests: network_mtu move fixby date out 4 months from last value
427+
428+ -- Chad Smith <chad.smith@canonical.com> Fri, 10 Aug 2018 09:22:12 -0600
429+
430+curtin (18.1-25-g9d0e557e-0ubuntu1) cosmic; urgency=medium
431+
432+ * New upstream snapshot.
433+ - Fix WorkingDir class to support already existing target directory.
434+ (LP: #1775622)
435+ - Fix extraction of local filesystem image. (LP: #1775630)
436+ - Fix tip-pyflakes imported but unused call to util.get_platform_arch
437+ - subp: update return value of subp with combine_capture=True.
438+ - tox: add a xenial environments, default envlist changes.
439+ - tests: Fix race on utcnow during timestamped curtin-log dir creation
440+ (LP: #1772481)
441+ - curtainer: patch source version from --source.
442+ - pyflakes: fix unused variable references identified by pyflakes 2.0.0.
443+
444+ -- Scott Moser <smoser@ubuntu.com> Thu, 07 Jun 2018 14:59:20 -0400
445+
446+curtin (18.1-17-gae48e86f-0ubuntu1) cosmic; urgency=medium
447+
448+ * New upstream snapshot.
449+ - tests: replace usage of mock.assert_called
450+
451+ -- Scott Moser <smoser@ubuntu.com> Fri, 18 May 2018 14:58:06 -0400
452+
453+curtin (18.1-16-g18835845-0ubuntu1) cosmic; urgency=medium
454+
455+ * New upstream snapshot.
456+ - tools: jenkins-runner show curtin version in output.
457+
458+ -- Scott Moser <smoser@ubuntu.com> Fri, 18 May 2018 10:29:17 -0400
459+
460+curtin (18.1-15-g5313b9e2-0ubuntu1) cosmic; urgency=medium
461+
462+ * New upstream snapshot.
463+ - zfs: implement a supported check to handle i386 (LP: #1768709)
464+ - Support mount entries not tied to a device, including bind and tmpfs.
465+ (LP: #1767979)
466+ - block/clear_holders/mdadm: refactor handling of layered device wiping
467+ (LP: #1768893, #1769742)
468+ - clear_holders: only export zpools that have been imported (LP: #1770280)
469+ - vmtests: allow env control of apt, system_upgrade, package upgrade
470+ - util.get_efibootmgr: filter bootorder by found entries (LP: #1767584)
471+ - vmtests: adjust lvm_iscsi dnames to match configuration
472+ - vmtest: always boot with BOOTIF and ip=:::::BOOTIF:dhcp
473+ - make_dname for bcache should use backing device uuid
474+ - zfsroot: add additional checks, do not require disk 'serial' attribute
475+ (LP: #1760879, #1760880)
476+
477+ -- Scott Moser <smoser@ubuntu.com> Fri, 18 May 2018 10:19:45 -0400
478+
479+curtin (18.1-5-g572ae5d6-0ubuntu1) bionic; urgency=medium
480+
481+ * New upstream snapshot.
482+ - clear-holders: fix lvm name use when shutting down (LP: #1764602)
483+ - install: prevent unmount: disabled from swallowing installation failures
484+ (LP: #1764210)
485+ - vmtest: bionic images no longer use the vlan package
486+ - pycodestyle: Fix invalid escape sequences in string literals.
487+
488+ -- Ryan Harper <ryan.harper@canonical.com> Wed, 18 Apr 2018 10:15:46 -0500
489+
490+curtin (18.1-1-g45564eef-0ubuntu1) bionic; urgency=medium
491+
492+ * New upstream snapshot.
493+ - Drop ubuntu branch management script new-upstream-snapshot.
494+ - Release 18.1
495+ - zfs/zpool version=28 by default, allow users to override default values.
496+ (LP: #1754013)
497+
498+ -- Chad Smith <chad.smith@canonical.com> Wed, 28 Mar 2018 14:22:58 -0600
499+
500+curtin (17.1-51-gbd40234f-0ubuntu1) bionic; urgency=medium
501+
502+ * New upstream snapshot.
503+ - helpers/shell-archive: drop use of tar --sparse flag (LP: #1757565)
504+ - vmtest: In Basic install, add entry for swap to fstab and verify its use.
505+ - vmtest: skip some bcache tests pending kernel fixes
506+ - vmtests: extend skip_by_date for lvmroot_xfsroot and network_mtu
507+ - vmtest: fix pollinate re.search to use groupdict()
508+ - Add pollinate user-agent configuration support.
509+
510+ -- Ryan Harper <ryan.harper@canonical.com> Fri, 23 Mar 2018 10:51:50 -0500
511+
512+curtin (17.1-45-g1a5fe18a-0ubuntu1) bionic; urgency=medium
513+
514+ * New upstream snapshot.
515+ - vmtest: Remove xenial and trusty specific workaround for rooturl.
516+ - vmtest: Add Filesystem Battery test.
517+ - Remove grub2/xenial specific workarounds for zfsroot.
518+ - Disable dirty_disks mode for mdadm + iscsi tests
519+ - tools/curtainer: Try harder to get source at binary version.
520+
521+ -- Scott Moser <smoser@ubuntu.com> Wed, 07 Mar 2018 12:20:40 -0500
522+
523+curtin (17.1-40-g46f8000f-0ubuntu1) bionic; urgency=medium
524+
525+ * New upstream snapshot.
526+ - clear_holders: wipe complex devices before disassembly (LP: #1750519)
527+ - vmtests: network_mtu: fix bug number and move date out one month
528+ - fix /usr/bin/curtin exit code in install failure (LP: #1751176)
529+
530+ -- Scott Moser <smoser@ubuntu.com> Wed, 07 Mar 2018 02:55:23 -0500
531+
532+curtin (17.1-37-g82622f12-0ubuntu1) bionic; urgency=medium
533+
534+ * New upstream snapshot.
535+ - docs: Document use of format command with fstype: zfsroot
536+ - docs: Add HACKING.rst doc to top level dir and readthedocs.
537+ - vmtest: fix centos root-tgz image sync
538+ - block_meta: Ensure offset input to sgdisk are integers.
539+ - Fix error in url_helper and vmtest from previous commit.
540+ - tools: fix curtainer to specify source version to apt-get source.
541+ - Add support for installing sources that are a filesystem image.
542+ (LP: #1746348)
543+ - clear-holders: detect and remove devices from kernel swap as needed.
544+ (LP: #1743643)
545+ - tests: remove xfs filesystem from basic uefi test.
546+ - tools: fix curtainer --source with trusty.
547+ - apply_net: do not write to stderr directly.
548+ - vmtest: Drop use of root-image.gz and maas2roottar.
549+ - in-target: use ChrootableTarget so that unshare pid is used.
550+ - tools/curtainer: check that binary and source version are the same.
551+ (LP: #1747077)
552+ - Add zfsroot as a filesystem type
553+ - fix modeline for shell syntax files.
554+ - error logs: Create error_tarfile path if path does not exist
555+ [Chad Smith] (LP: #1746363)
556+ - zfs: only load zfs on xenial+ skip artful/bionic zfs env export
557+ - error logs: automatically collect and tar curtin logs upon error.
558+ [Chad Smith]
559+ - vmtests: Support skipping skip_by_date tests based on environment.
560+ - Add zpool, zfs storage commands for experimental support of ZFS on root.
561+ - tests: revert workaround for bug in overlayroot that is now fixed.
562+ - tests: Bump skip_by_dates for bug 1652822 and 1671952.
563+ - cli: add curtin collect-logs sub-command [Chad Smith]
564+ - vmtest: Do not run tests of unsupported Ubuntu releases.
565+ - Make license headers and file footers consistent and simplify.
566+
567+ -- Scott Moser <smoser@ubuntu.com> Wed, 21 Feb 2018 12:19:07 -0500
568+
569+curtin (17.1-11-ga4c9636b-0ubuntu1) bionic; urgency=medium
570+
571+ * New upstream snapshot.
572+ - tests: cleanup the apt custom sources test.
573+ - apt: Be more lenient when replacing mirrors in /etc/apt/sources.list
574+ (LP: #1744038)
575+ - vmtest: Drop Zesty release
576+ - vmtest: initialize logger with class names for easy parsing
577+ - packaging: Do not mention primary contributors in debian/changelog.
578+
579+ -- Scott Moser <smoser@ubuntu.com> Thu, 18 Jan 2018 16:31:27 -0500
580+
581+curtin (17.1-6-g8b145067-0ubuntu1) bionic; urgency=medium
582+
583+ * New upstream snapshot.
584+ - packaging: Update new-upstream-snapshot to work with git.
585+ - Bump pylint to 1.8.1.
586+ - vmtests: switch to MAAS v3 streams for images and kernels [Ryan Harper]
587+ - tests: update pack tests to clear out pyc files more completely.
588+ - debian/control: drop conflicts that had bzr version
589+ - Switch uses of bzr to git, borrow from cloud-init git workflow.
590+
591+ -- Ryan Harper <ryan.harper@canonical.com> Tue, 16 Jan 2018 15:42:36 -0600
592+
593+curtin (17.1-0ubuntu1) bionic; urgency=medium
594+
595+ * New upstream release (17.1).
596+
597+ -- Scott Moser <smoser@ubuntu.com> Fri, 15 Dec 2017 16:53:09 -0500
598+
599+curtin (17.0~bzr552-0ubuntu1) bionic; urgency=medium
600+
601+ * New upstream snapshot.
602+ - packaging: update debian/build-deb to remove ~bzrREV when using equal tag
603+ - pack: fix packing when curtin is installed inside a snap.
604+ - tox: move to pylint 1.7.4
605+ - vmtests: iscsi minor cleanup.
606+ - vmtests: exercise rootfs over an lvm logical volume
607+ - Switch network dep filter to test for ifupdown/nplan instead of release
608+ name
609+ - Allow control of curtin install unmounting
610+ - vmtests: Add Bionic release to tests and update classes.
611+ - storage: add 'options' key mount type to specify mount parameters for
612+ filesystems (LP: #1709284)
613+ - Re-add curthooks.write_files method for backwards compat (LP: #1731709)
614+ - vmtest: Remove ArtfulTestBridging skip_by_date check, bug fixed
615+
616+ -- Ryan Harper <ryan.harper@canonical.com> Fri, 08 Dec 2017 14:48:42 -0600
617+
618+curtin (0.1.0~bzr541-0ubuntu1) bionic; urgency=medium
619+
620+ * New upstream snapshot.
621+ - Drop Precise from vmtest
622+ - clear_holders: bcache log IO/OS exceptions but do not raise
623+ - vmtest: Support newer qemu and multipath.
624+ - block: enable control over exclusive_open use when wiping volumes
625+ - block: handle wiping bcache parts (LP: #1718699)
626+ - vmtests: Defer ArtfulNetworkMtu SkipbyDate to 2018
627+ - bcache: accept sysfs write failure in shutdown handler if path missing
628+ (LP: #1700564)
629+ - vmtest: Rephrase a message about no disks to be less scary
630+ - block_meta: use block.wipe_volume(mode=superblock) to clear MBR/GPT tables
631+ (LP: #1722322)
632+
633+ -- Ryan Harper <ryan.harper@canonical.com> Tue, 07 Nov 2017 11:13:00 -0600
634+
635+curtin (0.1.0~bzr532-0ubuntu1) artful; urgency=medium
636+
637+ * New upstream snapshot.
638+ - vmtest: fix artful networking (LP: #1714028, LP: #1718216, LP: #1706744)
639+ - docs: Trivial doc fix for enabling proposed.
640+ - setup.py: fix to allow installation into a virtualenv (LP: #1703755)
641+ - doc: update documentation on curtin-hooks and non-ubuntu installation.
642+ - reporter: Add journald reporter to send events to journald
643+ - vmtests: add option to tar disk images after test run
644+ - install: ensure iscsi service is running to handle shutdown properly
645+ - mdadm: handle write failures to sysfs entries when stopping mdadm
646+ (LP: #1708052)
647+ - vmtest: catch exceptions in curtin-log-print
648+ - iscsi: use curtin storage config to disconnect iscsi targets
649+ (LP: #1713537)
650+ - vmtests: bump skip_by_date values out to give cloud-init SRU more time
651+ - vmtest: get info about collected symlinks and then delete them.
652+ - Update network cloud-init related skiptest dates, SRU still pending
653+
654+ -- Ryan Harper <ryan.harper@canonical.com> Thu, 05 Oct 2017 19:15:28 -0500
655+
656+curtin (0.1.0~bzr519-0ubuntu1) artful; urgency=medium
657+
658+ * New upstream snapshot.
659+ - tests: Add CiTestCase common parent for all curtin tests.
660+ - vmtests: Remove force flag for centos curthooks
661+ - tools/jenkins-runner: improve tgtd cleanup logic
662+ - tests: Drop EOL Wily Vivid and Yakkety tests.
663+ - Disable yum plugins when installing packages, update ca-certs for https
664+ - Rename centos_network_curthooks -> centos_apply_network_config.
665+ - tests: in centos_defaults use write_files for grub serial.
666+ - write_files: write files after extract, change write_files signature.
667+ - pass network configuration through to target for ubuntu and centos
668+ - tests: disable yakkety tests.
669+ - tools/launch: automatically pass on proxy settings to curtin
670+ - Add top level 'proxy' to config, deprecate top level http_proxy.
671+ - tools/curtainer: fix to enable deb-src for -proposed.
672+ - Use unshare to put chroot commands in own pid namespace.
673+
674+ -- Scott Moser <smoser@ubuntu.com> Thu, 03 Aug 2017 15:51:19 -0400
675+
676+curtin (0.1.0~bzr505-0ubuntu1) artful; urgency=medium
677+
678+ * debian/new-upstream-snapshot: fix issue with whitespace at end of line.
679+ * New upstream snapshot.
680+ - vmtest: let the socket level select a port rather than us picking one.
681+ - Fix deb build by mocking call to udevadm settle
682+ - Clear and re-order UEFI boot methods during UEFI grub installation.
683+ - Resolve bcache race-conditions
684+ - tests: clean up usage of collect files
685+
686+ -- Scott Moser <smoser@ubuntu.com> Mon, 12 Jun 2017 15:45:33 -0400
687+
688+curtin (0.1.0~bzr500-0ubuntu1) artful; urgency=medium
689+
690+ * New upstream snapshot.
691+ - Allow re-use of vmtest output
692+ - Fix stacked storage configurations with iSCSI (LP: #1683910)
693+ - vmtests: enable tests to apply storage config to validate clear_holders path
694+ - mdadm_stop: Add retry and additional steps to halt a resync
695+ - vmtests: Add Artful release and update classes
696+ - clear-holders: mdadm use /proc/mdstat to wait for array to stop (LP: #1682584)
697+ - uc16 curthooks: add 'network' key to config file (LP: #1685000)
698+ - Doc and makefile updates for build and test on new systems.
699+ - clear-holders: make bcache handler wait for device shutdown (LP: #1680409)
700+ - vmtest: Use utf-8 and fix pseudo test collect_output
701+ - vmtest: fix path to install log, and utilize the globally copied paths.
702+ - Copy curtin install log into target. (LP: #1684128)
703+ - vmtest: add in post-test log post-processing
704+ - vmtest: update source.list test
705+ - add recursive flag to do_umount, add --umount to block-meta
706+ - load_command_environment: fix strict flag, and unit tests.
707+ - block_meta: Attempt to mount by UUID= if possible (LP: #1676991)
708+ - Make systems with root on bcache use root=UUID=. (LP: #1680591)
709+
710+ -- Scott Moser <smoser@ubuntu.com> Fri, 19 May 2017 16:57:07 -0400
711+
712+curtin (0.1.0~bzr482-0ubuntu1) zesty; urgency=medium
713+
714+ * New upstream snapshot.
715+ - Fix iscsi disks that have a ':' in the target name. (LP: #1679222)
716+ - tests: re-enable ZestyTestMdadmBcache.
717+ - curthooks: fix pylint reported error when using ubuntu_core_curthooks.
718+
719+ -- Scott Moser <smoser@ubuntu.com> Wed, 05 Apr 2017 15:22:25 -0400
720+
721+curtin (0.1.0~bzr479-0ubuntu1) zesty; urgency=medium
722+
723+ * New upstream snapshot.
724+ - Add support for installing Ubuntu-Core 16 images.
725+ - Add 'STORAGE_CONFIG_V1_DD' to the feature list.
726+ - flake8: fix flake8 issues with previous merge.
727+ - Support selection of target disk for dd images install via
728+ storage config. (LP: #1640301)
729+ - vmtest: have vmtest-sync-images avoid running when jenkins-runner is.
730+ - tools/curtin-from-container: do not use lxc file push --create-dirs
731+ - tests: enable curtainer to pull down curtin source locally
732+ - tests: make nose output always include class name and method.
733+ - tools/curtin-from-container: default to verbosity level 0, not 2.
734+
735+ -- Scott Moser <smoser@ubuntu.com> Thu, 23 Mar 2017 13:06:43 -0400
736+
737+curtin (0.1.0~bzr470-0ubuntu1) zesty; urgency=medium
738+
739+ * New upstream snapshot.
740+ - vmtest: allow time-based skipping of tests, apply to ZestyMdadmBcache
741+ (LP: #1667078)
742+ - Add iSCSI disk support. (LP: #1645515)
743+ - vmtest: handle change in btrfs-progs when finding fs UUID. (LP: #1665701)
744+ - pycodestyle: fix bare except in vmtests
745+ - unittests: add subp coverage for retries, and rcs
746+ - reporting: Add better descriptions and granularity of events
747+ - tox: do not bother with pep8 from trusty in trusty-check
748+ - tests: add two scripts used for running vmtest with installed package.
749+ - Make add-apt-repository command retry
750+ - Add tests for network bridging configuration
751+ - debian/rules: remove debug 'find'
752+
753+ -- Scott Moser <smoser@ubuntu.com> Tue, 28 Feb 2017 10:30:43 -0500
754+
755+curtin (0.1.0~bzr460-0ubuntu1) zesty; urgency=medium
756+
757+ * New upstream snapshot.
758+ - Install zipl in target on s390x arch. (LP: #1662346)
759+
760+ -- Scott Moser <smoser@ubuntu.com> Wed, 08 Feb 2017 17:09:34 -0500
761+
762+curtin (0.1.0~bzr459-0ubuntu1) zesty; urgency=medium
763+
764+ * New upstream snapshot.
765+ - Remove style checking during build and add latest style checks to tox
766+ - avoid UnicodeDecode error on passing non-utf8 into shlex
767+ - adjustments to version string handling, improved pack unit tests.
768+ - helpers/common: Add grub install debugging output
769+ - curtin: add version module and display in output and logs
770+ - content decoding in load_file, apply_net raise exception on errors
771+ - gpg: retry when recv'ing gpg keys fail (LP: #1661337)
772+ - Add clear_holders checks to disk and partition handlers (LP: #1659509)
773+ - net: add new lines after rendered static routes. (LP: #1649652)
774+ - multipath: don't run update-grub; setup_grub will handle this better.
775+ (LP: #1656369)
776+ - test related changes:
777+ - vmtest: Add tests for zesty and Trusty HWE-X kernels.
778+ - tests: fix tox tip-pycodestyle complaints
779+ - image-sync: add debugging output to help diagnose errors
780+ - vmtest: change get_curtin_version to use version subcommand.
781+ - subp doc an unit test improvements.
782+ - vmtest: Add the ability to add extra config files to test execution.
783+ - vmtest: overhaul image sync
784+ - vmtest: skip apt-proxy test if not set
785+ - vmtest: add 'webserv' helper
786+ - vmtest: add CURTIN_VMTEST_CURTIN_EXE variable.
787+
788+ -- Scott Moser <smoser@ubuntu.com> Wed, 08 Feb 2017 15:29:57 -0500
789+
790+curtin (0.1.0~bzr435-0ubuntu1) zesty; urgency=medium
791+
792+ * New upstream snapshot.
793+ - pep8: fix pep8 errors found with 'make pep8' on zesty.
794+ - Workaround failures caused by gpg2 daemons left running in chroot.
795+ (LP: #1645680)
796+ - Install u-boot-tools when running on a system with u-boot.
797+ (LP: #1640519)
798+ - block: fix partition kname for raid devices (LP: #1641661)
799+ - Fix up tox errors that slipped in and new pycodestyle 2.1.0 complaints.
800+ - vmtests: adjust vmtest image sync metadata filenames
801+ - vmtests: Add centos support
802+ - Disable WilyTestRaid5Bcache vmtest
803+ - tools/xkvm: fix --netdev=<bridge>
804+ - bytes2human: fix for values larger than 32 bit int on 32 bit python2.
805+
806+ -- Scott Moser <smoser@ubuntu.com> Thu, 01 Dec 2016 21:05:30 -0500
807+
808+curtin (0.1.0~bzr425-0ubuntu1) yakkety; urgency=medium
809+
810+ [ Scott Moser ]
811+ * debian/new-upstream-snapshot: add writing of debian changelog entries.
812+
813+ [ Ryan Harper ]
814+ * New upstream snapshot.
815+ - unittest,tox.ini: catch and fix issue with trusty-level mock of open
816+ - block/mdadm: add option to ignore mdadm_assemble errors (LP: #1618429)
817+ - curtin/doc: overhaul curtin documentation for readthedocs.org
818+ (LP: #1351085)
819+ - curtin.util: re-add support for RunInChroot (LP: #1617375)
820+ - curtin/net: overhaul of eni rendering to handle mixed ipv4/ipv6 configs
821+ - curtin.block: refactor clear_holders logic into block.clear_holders and
822+ cli cmd
823+ - curtin.apply_net should exit non-zero upon exception. (LP: #1615780)
824+ - apt: fix bug in disable_suites if sources.list line is blank.
825+ - vmtests: disable Wily in vmtests
826+ - Fix the unittests for test_apt_source.
827+
828+ -- Scott Moser <smoser@ubuntu.com> Thu, 29 Sep 2016 14:55:29 -0400
829+
830+curtin (0.1.0~bzr415-0ubuntu1) yakkety; urgency=medium
831+
832+ * New upstream snapshot.
833+ - Add apt configuration features. (LP: #1574113)
834+ - mkfs.vfat: add force flag for formating whole disks (LP: #1597923)
835+ - block.mkfs: fix sectorsize flag (LP: #1597522)
836+ - block_meta: cleanup use of sys_block_path and handle cciss knames
837+ (LP: #1562249)
838+ - block.get_blockdev_sector_size: handle _lsblock multi result return
839+ (LP: #1598310)
840+ - util: add target (chroot) support to subp, add target_path helper
841+ - block_meta: fallback to parted if blkid does not produce output
842+ (LP: #1524031)
843+ - commands.block_wipe: correct default wipe mode to 'superblock'
844+
845+ -- Scott Moser <smoser@ubuntu.com> Fri, 05 Aug 2016 16:51:20 -0400
846+
847+curtin (0.1.0~bzr399-0ubuntu1) yakkety; urgency=medium
848+
849+ * debian/new-upstream-snapshot: fix for specifying revision.
850+ * New upstream snapshot.
851+ - curtin/net: fix inet value for subnets, don't add interface attributes
852+ to alias (LP: #1588547)
853+ - improve net-meta network configuration (LP: #1592149)
854+ - reporting: set webhook handler level to DEBUG, no filtering
855+ (LP: #1590846)
856+ - tests/vmtests: add yakkety, remove vivid
857+ - curtin/net: use post-up for interface alias, resolve 120 second time out
858+ on Trusty when using interface aliases
859+ - vmtest: provide info on images used
860+ - fix multipath configuration and add multipath tests (LP: #1551937)
861+ - tools/launch and tools/xkvm: whitespace cleanup and bash -x
862+ - tools/launch: boot by root=LABEL=cloudimg-rootfs
863+ - Initial vmtest power8 support and TestSimple test.
864+
865+ -- Scott Moser <smoser@ubuntu.com> Tue, 12 Jul 2016 12:31:34 -0400
866+
867+curtin (0.1.0~bzr389-0ubuntu1) yakkety; urgency=medium
868+
869+ * New upstream snapshot.
870+ * Detect and remove legacy /etc/network/interfaces.d/eth0.cfg from
871+ target (LP: #1582410)
872+
873+ -- Scott Moser <smoser@ubuntu.com> Fri, 03 Jun 2016 09:34:17 -0400
874+
875+curtin (0.1.0~bzr387-0ubuntu1) yakkety; urgency=medium
876+
877+ * New upstream snapshot.
878+ * fix timestamp in reporting events.
879+
880+ -- Scott Moser <smoser@ubuntu.com> Tue, 10 May 2016 10:19:20 -0400
881+
882+curtin (0.1.0~bzr385-0ubuntu2) yakkety; urgency=medium
883+
884+ * debian/control: add bcache-tools dependency to curtin.
885+
886+ -- Scott Moser <smoser@ubuntu.com> Thu, 05 May 2016 16:35:37 -0400
887+
888+curtin (0.1.0~bzr385-0ubuntu1) yakkety; urgency=medium
889+
890+ * debian/control: drop python from curtin-common Depends.
891+ remove unnecessary Depends on util-linux as it is essential.
892+ python3-curtin, python-curtin: drop unnecessary 'curl' from Depends.
893+ python3-curtin, python-curtin: list oauthlib and yaml explicitly.
894+
895+ * New upstream snapshot.
896+ * mdadm: resolve mdadm/bcache and trusty+hwe issues
897+ (LP: #1569549, LP: #1514094)
898+ * fix support for 4k disks (LP: #1436632, LP: #1564977)
899+ * emit source /etc/network/interfaces.d/*.cfg in
900+ rendered /etc/network/interfaces
901+ * net: introduce 'control' field to network configuration to allow
902+ for declaring manual controlled interfaces
903+ * disable cloud-init networking as curtin is the source of network config
904+ * block: wipe_volume improvements
905+ * reporter: enhance reporting events to include levels and
906+ improve usefullness of messages
907+ * network: add bonding tests and cleanup newline rendering
908+ * block: fix partition path issue with nvme devices
909+ * fix logic error in kernel installation
910+ * block: add debug regarding raid modules being missing on mdadm create
911+ * add s390x support to curtin and vmtest
912+
913+
914+ -- Scott Moser <smoser@ubuntu.com> Thu, 05 May 2016 12:43:40 -0400
915+
916+curtin (0.1.0~bzr365-0ubuntu1) xenial; urgency=medium
917+
918+ * New upstream snapshot.
919+ * mkfs: handle fstype: vfat (LP: #1557334)
920+ * save the curtin install config to /root/curtin-install-cfg.yaml
921+ * deps: when 'curtin --install-deps' is run, it will now invoke
922+ apt-get install with '--no-install-recommends'
923+ * debian/control: adjust build dependency as python3-pyflakes in xenial
924+ now provides python3 modules for pyflakes.
925+
926+ -- Scott Moser <smoser@ubuntu.com> Fri, 18 Mar 2016 10:18:21 -0400
927+
928+curtin (0.1.0~bzr359-0ubuntu1) xenial; urgency=medium
929+
930+ * debian/new-upstream-snapshot, debian/README.source: add
931+ new-upstream-snapshot and mention it in README.source
932+ * New upstream snapshot.
933+ * curtin/net: Add bond parsing & improved source, source-directory
934+ parsing for ENI
935+ * curtin/net: move global dns-* options under auto lo in ENI (LP: #1543263)
936+
937+ -- Scott Moser <smoser@ubuntu.com> Fri, 26 Feb 2016 16:28:31 -0500
938+
939+curtin (0.1.0~bzr351-0ubuntu1) xenial; urgency=medium
940+
941+ * New upstream snapshot.
942+ * partitioning: limited support for odd ordering of partition
943+ numbers (LP: #1543263). Specifically targetted at MAAS and
944+ powerVM support.
945+ * many upstream test improvements (LP: #1533770)
946+ * general upstream code improvements
947+ * use mkfs.vfat rather than mkfs.fat to support precise.
948+ * use removable devices for installation if no non-removable devices are
949+ found [Robert Clark] (LP: #1532062)
950+ * mkfs: fix for lack of uuid in btrfs tools on precise or trusty
951+ * added 'curtin mkfs' command for easily making filesystems.
952+ * mdadm: fix issues exposed by use via block_meta (LP: #1531520)
953+ * improvements and small bug fix for oauth on systems with bad clock
954+ * support bcache installation on precise
955+ * fix bug in install_grub to partition when storage_config
956+ provided. (LP: #1523779)
957+ * url_helper: raise import error on lack of oauth only when oauth used
958+ * block_meta: handle 'preserve' flag for raid devices (LP: #1522147)
959+ * close file descriptors from --config= arguments
960+ * xenial: disable update-motd during an apt-get update (LP: #1527710)
961+ * curthooks: know kernel mapping for xenial (4.4.0)
962+ * fix python executable selection when 'curtin --help' is called
963+ * subp: add decode parameter, defaulting to replace (LP: #1526127)
964+ * support passing an integer or valid float to human2bytes
965+ * Use /proc/mounts to find missing mountpoints
966+
967+ -- Scott Moser <smoser@ubuntu.com> Fri, 12 Feb 2016 17:07:33 -0500
968+
969+curtin (0.1.0~bzr314-0ubuntu1) xenial; urgency=medium
970+
971+ * New upstream snapshot.
972+ * support installing .tar.xz, .tar.gz, .tar.bz2 or .tar via smtar helper
973+ * improve dependency checking (LP: #1514888)
974+ * Allow re-use of bcache cache devices with separate backing devices
975+ (LP: #1514094)
976+ * call mkfs.ext3 or mkfs.ext4 with -F (force)
977+ * Partition alignment and sizing fixes (LP: #1513085)
978+ * Set bcache cache_mode if present in storage config (LP: #1510334)
979+ * apt-get update: do not download translation files and source files
980+ during installation.
981+ * new sub-commands 'system-upgrade' and 'system-install' for package
982+ upgrade and installation.
983+ * debian/control: do not list unversioned e2fsprogs as it is essential.
984+
985+ -- Scott Moser <smoser@ubuntu.com> Mon, 23 Nov 2015 11:28:52 -0500
986+
987+curtin (0.1.0~bzr276-0ubuntu1) wily; urgency=medium
988+
989+ * New upstream snapshot.
990+ * debian/control: add python3-curtin depends to curtin (LP: #1503507)
991+
992+ -- Scott Moser <smoser@ubuntu.com> Wed, 07 Oct 2015 09:50:34 -0400
993+
994+curtin (0.1.0~bzr275-0ubuntu1) wily; urgency=medium
995+
996+ * debian/README.source: tweak to doc on how to generate snapshot
997+ * New upstream snapshot.
998+ * add advanced storage layout
999+ * add advanced networking configuration
1000+ * add 'vmtest' framework for automated test.
1001+ * add 'tox' for unit testing
1002+ * add reporting framework for reporting status events to MAAS or other
1003+ webhook listener.
1004+ * enable configuring of verbosity and stacktrace info in config as opposed
1005+ to command line only
1006+ * faster swap creation using fallocate (LP: #1482994)
1007+ * support specifying kernel without 'mapping' in config
1008+ * add 'system-upgrade' command and config for enabling upgrading the target
1009+
1010+ -- Scott Moser <smoser@ubuntu.com> Fri, 02 Oct 2015 16:19:07 -0400
1011+
1012+curtin (0.1.0~bzr227-0ubuntu1) wily; urgency=medium
1013+
1014+ * New upstream snapshot.
1015+ * support '---' or '--' as token to indicate the subsequent kernel command
1016+ line parameters should be copied from install envionrment to installed
1017+ environment. (LP: #1402042)
1018+ * partition: when partitioning mbr and boot partition verify that
1019+ both partitions exist.
1020+ * partition: when creating mbr table, leave space for secondary gpt header
1021+ * fix uefi install path on nvme devices (LP: #1471928)
1022+
1023+ -- Scott Moser <smoser@ubuntu.com> Thu, 09 Jul 2015 16:17:20 -0400
1024+
1025+curtin (0.1.0~bzr221-0ubuntu1) wily; urgency=medium
1026+
1027+ * debian/README.source: minor fixes in doc on merging upstream
1028+ * New upstream snapshot.
1029+ * force re-reading of partition information before looking
1030+ for multipath UUID matches.
1031+
1032+ -- Scott Moser <smoser@ubuntu.com> Wed, 24 Jun 2015 14:08:55 -0400
1033+
1034+curtin (0.1.0~bzr220-0ubuntu1) wily; urgency=medium
1035+
1036+ * New upstream snapshot.
1037+ * more multipath work. hopefully reliable multipath boot on ppc64 now.
1038+ * some cleanups to partitioning code.
1039+ * know expected kernel mapping for wily (4.2)
1040+ * support UEFI-based ARM64 systems (LP: #1447834)
1041+ * catch one more usage of lsblk (LP: #1386275)
1042+
1043+ -- Scott Moser <smoser@ubuntu.com> Thu, 18 Jun 2015 14:19:55 -0400
1044+
1045+curtin (0.1.0~bzr215-0ubuntu1) wily; urgency=medium
1046+
1047+ * New upstream snapshot.
1048+ * multipath: Generate /etc/multipath/bindings file during installation.
1049+
1050+ -- Scott Moser <smoser@ubuntu.com> Tue, 16 Jun 2015 15:39:29 -0400
1051+
1052+curtin (0.1.0~bzr214-0ubuntu1) wily; urgency=medium
1053+
1054+ * New upstream snapshot.
1055+ * Use filesystem uuid rather than scsi_id to avoid false positives
1056+ when detecting multipath (LP: #1463043).
1057+
1058+ -- Scott Moser <smoser@ubuntu.com> Tue, 09 Jun 2015 16:35:21 -0400
1059+
1060+curtin (0.1.0~bzr213-0ubuntu1) wily; urgency=medium
1061+
1062+ * New upstream snapshot.
1063+ * retry apt-get update to avoid transient failures (LP: #1403133)
1064+ * detect and handle multipath devices (LP: #1371634)
1065+ * udevadm settle before unmounting target's /dev (LP: #1462139)
1066+ * doc/ improved developer doc and tools using maas images for test
1067+ * use --no-nvram option to grub-install if available (LP: #1311827)
1068+
1069+ -- Scott Moser <smoser@ubuntu.com> Fri, 05 Jun 2015 15:06:31 -0400
1070+
1071+curtin (0.1.0~bzr205-0ubuntu1) wily; urgency=medium
1072+
1073+ * New upstream snapshot.
1074+ * improve finding devices and partitions to account for
1075+ non-standard names (LP: #1401190, LP: #1263181)
1076+ * do not consider removable devices or devices < 1G as installable
1077+ * add internal function wipe_partition and use that rather than
1078+ wipefs for wiping filesystem header data on a partition.
1079+
1080+ -- Scott Moser <smoser@ubuntu.com> Fri, 15 May 2015 16:52:07 -0400
1081+
1082+curtin (0.1.0~bzr201-0ubuntu1) vivid; urgency=medium
1083+
1084+ * New upstream snapshot.
1085+ * curtin.deps.install: actually install, rather than --dry-run.
1086+
1087+ -- Scott Moser <smoser@ubuntu.com> Fri, 20 Mar 2015 16:30:11 -0400
1088+
1089+curtin (0.1.0~bzr200-0ubuntu1) vivid; urgency=medium
1090+
1091+ * New upstream snapshot.
1092+ * support installation of vivid on vivid via python3 (LP: #1427950)
1093+ * know kernel mapping for vivid (3.19)
1094+ * debian/control: update standards versions, wrap-and-sort
1095+
1096+ -- Scott Moser <smoser@ubuntu.com> Wed, 11 Mar 2015 13:19:43 -0400
1097+
1098+curtin (0.1.0~bzr196-0ubuntu1) vivid; urgency=medium
1099+
1100+ * New upstream snapshot.
1101+ * fix bug installing to UEFI systems (LP: #1383727)
1102+
1103+ -- Scott Moser <smoser@ubuntu.com> Mon, 08 Dec 2014 20:01:44 -0500
1104+
1105+curtin (0.1.0~bzr195-0ubuntu1) vivid; urgency=medium
1106+
1107+ * New upstream snapshot.
1108+ * move install log from /var/log/curtin_install.log to
1109+ /var/log/curtin/install.log (LP: #1378910)
1110+ * to not use '--acl' when extracting tar files (LP: #1382632)
1111+ as it inadvertently writes default directory acls.
1112+ * invoke lsblk with '--output' rather than '--out' to avoid
1113+ ambiguity in newer versions of lsblk (LP: #1386275)
1114+
1115+ -- Scott Moser <smoser@ubuntu.com> Mon, 27 Oct 2014 12:25:27 -0400
1116+
1117+curtin (0.1.0~bzr190-0ubuntu1) utopic; urgency=medium
1118+
1119+ * New upstream snapshot.
1120+ * add log reporter (LP: #1369129, LP: #1371218)
1121+ * allow debug messages of helper programs to be seen
1122+ * fix 'make check'
1123+ * handle utf-8 output correctly. (LP: #1370249)
1124+ * set root device correctly on ppc64 (LP: #1371133)
1125+ * call update-grub to ensure grub.cfg is written (LP: #1373137)
1126+ * fix dd-tgz mode, only call partprobe on target device.
1127+
1128+ -- Scott Moser <smoser@ubuntu.com> Fri, 26 Sep 2014 17:26:34 -0400
1129+
1130+curtin (0.1.0~bzr162-0ubuntu1) utopic; urgency=medium
1131+
1132+ * New upstream snapshot.
1133+ * block-meta: fix '--boot' when used with mbr.
1134+ * human2bytes: support floating point numbers (.5G or 2G).
1135+ * sanitize_source: fix detection of url prefixes that specify type
1136+ * fix reference to variable before use (LP: #1361350)
1137+
1138+ -- Scott Moser <smoser@ubuntu.com> Thu, 04 Sep 2014 17:10:14 -0400
1139+
1140+curtin (0.1.0~bzr155-0ubuntu1) utopic; urgency=medium
1141+
1142+ * New upstream snapshot.
1143+ - fix '--maxsize' argument to 'curtin swap' (LP: #1360318) [Jason Hobbs]
1144+ * d/README.source: add file describing how snapshot releases are made.
1145+
1146+ -- Scott Moser <smoser@ubuntu.com> Fri, 22 Aug 2014 11:54:49 -0400
1147+
1148+curtin (0.1.0~bzr153-0ubuntu1) utopic; urgency=medium
1149+
1150+ * New upstream snapshot.
1151+ * support for creating swap file.
1152+ * fix bug when specifying kernel mapping in config.
1153+ * install_kernel: run apt-get udpate before searching cache (LP: #1358424)
1154+ * correctly check for availability of eatmydata (LP: #1358350)
1155+ * support installation on ppc64 systems (ubuntu ppc64el)
1156+
1157+ -- Scott Moser <smoser@ubuntu.com> Thu, 21 Aug 2014 03:35:53 -0400
1158+
1159+curtin (0.1.0~bzr143-0ubuntu1) utopic; urgency=medium
1160+
1161+ * New upstream snapshot.
1162+ * better choose a default boot fstype.
1163+
1164+ -- Scott Moser <smoser@ubuntu.com> Mon, 04 Aug 2014 04:57:29 -0400
1165+
1166+curtin (0.1.0~bzr142-0ubuntu1) utopic; urgency=medium
1167+
1168+ * New upstream snapshot.
1169+ * add utility for parsing /etc/network/interfaces
1170+ * aarm64 support [Newell Jensen]
1171+ * run update-initramfs in aarm64
1172+ * create boot partition when necessary (LP: #1338851 LP: #1340942)
1173+ * know kernel mapping for utopic (3.16)
1174+ * properly write fstype into /etc/fstab per provided fstype
1175+ * add support for disk images as type 'dd-tgz'
1176+ * correctly call finalize in target (LP: #1328521)
1177+ * support invoking tar with --xattrs if available (LP: #1307636)
1178+ * increase size of uefi partition to 512M (LP: #1306164)
1179+
1180+ -- Scott Moser <smoser@ubuntu.com> Tue, 22 Jul 2014 18:53:38 -0400
1181+
1182+curtin (0.1.0~bzr126-0ubuntu1) trusty; urgency=medium
1183+
1184+ * New upstream snapshot.
1185+ * create 500M EFI System Partition (ESP) instead of 100M. (LP: #1306164)
1186+
1187+ -- Scott Moser <smoser@ubuntu.com> Thu, 10 Apr 2014 15:11:18 -0400
1188+
1189+curtin (0.1.0~bzr125-0ubuntu1) trusty; urgency=medium
1190+
1191+ * New upstream snapshot.
1192+ * fix regression in installation on pc-bios systems (LP: #1303617)
1193+
1194+ -- Scott Moser <smoser@ubuntu.com> Mon, 07 Apr 2014 10:18:34 -0400
1195+
1196+curtin (0.1.0~bzr124-0ubuntu1) trusty; urgency=medium
1197+
1198+ * New upstream snapshot.
1199+ * install correctly on UEFI booted systems (LP: #1300910)
1200+ [Blake Rouse]
1201+ * whitespace fixes and other small fixes.
1202+
1203+ -- Scott Moser <smoser@ubuntu.com> Thu, 03 Apr 2014 14:47:01 -0400
1204+
1205+curtin (0.1.0~bzr121-0ubuntu1) trusty; urgency=medium
1206+
1207+ * New upstream snapshot.
1208+ * support installing kernel package of booted kernel
1209+ to enable hardware enablement kernels through maas.
1210+ * support Calxeda highbank and other ARMv7 systems
1211+ * fix gpt partitioning. It wouldn't allow grub installation
1212+ * support for using kexec to boot into the installed system
1213+ to avoid a hardware bios post.
1214+ * support declaring target device via config
1215+ * support installing from a local url (file:///)
1216+ * fix bug where 'console=' parms were not removed from image's
1217+ settings (problematic when image was cloud image)
1218+ * run apt-get update if installing packages
1219+
1220+ -- Scott Moser <smoser@ubuntu.com> Wed, 26 Mar 2014 17:34:57 -0400
1221+
1222+curtin (0.1.0~bzr95-0ubuntu2) trusty; urgency=medium
1223+
1224+ * Rebuild to drop files installed into /usr/share/pyshared.
1225+
1226+ -- Matthias Klose <doko@ubuntu.com> Sun, 23 Feb 2014 13:46:42 +0000
1227+
1228+curtin (0.1.0~bzr95-0ubuntu1) trusty; urgency=low
1229+
1230+ * New upstream snapshot.
1231+ * fix bug in block-meta resulting in first disk not always being used
1232+ (LP: #1244026)
1233+
1234+ -- Scott Moser <smoser@ubuntu.com> Thu, 24 Oct 2013 01:41:47 -0400
1235+
1236+curtin (0.1.0~bzr94-0ubuntu1) saucy-proposed; urgency=low
1237+
1238+ * New upstream snapshot.
1239+ * fix bug where /usr/sbin/policy-rc.d was not being removed after
1240+ being utilized during installation to disable daemons. (LP: #1238915)
1241+
1242+ -- Scott Moser <smoser@ubuntu.com> Tue, 15 Oct 2013 14:45:16 -0400
1243+
1244+curtin (0.1.0~bzr93-0ubuntu1) saucy; urgency=low
1245+
1246+ * New upstream snapshot.
1247+ * curtin/commands/in_target.py, curtin/commands/main.py:
1248+ fix 'curtin -v' and 'curtin in-target' (LP: #1237139)
1249+ * non-production / development changes:
1250+ * doc/devel/README.txt: development doc update
1251+ * tools/build-deb, tools/export-tarball:
1252+ trunk development changes for creating tarball and building debs.
1253+ * tools/launch: support '--add' for adding files such as config files
1254+
1255+ -- Scott Moser <smoser@ubuntu.com> Tue, 08 Oct 2013 20:20:11 -0400
1256+
1257+curtin (0.1.0~bzr87-0ubuntu1) saucy; urgency=low
1258+
1259+ * New upstream snapshot.
1260+ * fix bug that prevented some systems from booting because
1261+ 'dpkg-reconfigure grub-pc' was not being run.
1262+
1263+ -- Scott Moser <smoser@ubuntu.com> Wed, 25 Sep 2013 16:35:30 -0400
1264+
1265+curtin (0.1.0~bzr86-0ubuntu1) saucy; urgency=low
1266+
1267+ * New upstream snapshot.
1268+ * correctly install grub to device rather than partition
1269+ * correctly write /etc/network/interfaces
1270+ * get cloud-init configure to work with preseed data.
1271+ * use tar with --numeric owner when extracting
1272+
1273+ -- Scott Moser <smoser@ubuntu.com> Tue, 24 Sep 2013 22:32:08 -0400
1274+
1275+curtin (0.1.0~bzr85-0ubuntu1) saucy; urgency=low
1276+
1277+ * New upstream snapshot.
1278+ * fix 'pack_install' usage for maas (LP: #1227944)
1279+ * debian/rules: fix 'curtin' package to install as python2
1280+
1281+ -- Scott Moser <smoser@ubuntu.com> Fri, 20 Sep 2013 16:59:25 -0400
1282+
1283+curtin (0.1.0~bzr82-0ubuntu1) saucy; urgency=low
1284+
1285+ * New upstream snapshot.
1286+ * 'net-meta auto' is now default for interfaces.
1287+ * power_state config can now cause reboot after install.
1288+
1289+ -- Scott Moser <smoser@ubuntu.com> Thu, 19 Sep 2013 17:07:17 -0400
1290+
1291+curtin (0.1.0~bzr75-0ubuntu1) saucy; urgency=low
1292+
1293+ * New upstream snapshot.
1294+ * change 'curtin' installer to be python2 for better compatibility
1295+ * split up packaging. Provide curtin, curtin-common, python-curtin and
1296+ python3-curtin.
1297+ * add 'curtin in-target' command for chrooting to target
1298+ * support http_proxy, apt_proxy, and specifying ubuntu mirrors.
1299+
1300+ -- Scott Moser <smoser@ubuntu.com> Thu, 19 Sep 2013 04:07:25 -0400
1301+
1302+curtin (0.1.0~bzr54-0ubuntu1) saucy; urgency=low
1303+
1304+ * Initial release
1305+
1306+ -- Scott Moser <smoser@ubuntu.com> Mon, 29 Jul 2013 16:12:09 -0400
1307diff --git a/debian/control b/debian/control
1308index cea1af8..b1d5fb8 100644
1309--- a/debian/control
1310+++ b/debian/control
1311@@ -5,21 +5,13 @@ Standards-Version: 3.9.6
1312 Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
1313 Build-Depends: debhelper (>= 7),
1314 dh-python,
1315- pep8,
1316- pyflakes,
1317- python-all,
1318- python-coverage,
1319- python-mock,
1320- python-nose,
1321- python-oauthlib,
1322- python-setuptools,
1323- python-yaml,
1324 python3,
1325 python3-coverage,
1326 python3-mock,
1327 python3-nose,
1328 python3-oauthlib,
1329 python3-pyflakes | pyflakes (<< 1.1.0-2),
1330+ python3-pyudev,
1331 python3-setuptools,
1332 python3-yaml
1333 Homepage: http://launchpad.net/curtin
1334@@ -54,25 +46,13 @@ Depends: ${misc:Depends}
1335 Description: Library and tools for curtin installer
1336 This package contains utilities for the curtin installer.
1337
1338-Package: python-curtin
1339-Section: python
1340-Architecture: all
1341-Priority: extra
1342-Depends: curtin-common (= ${binary:Version}),
1343- python-oauthlib,
1344- python-yaml,
1345- wget,
1346- ${misc:Depends},
1347- ${python:Depends}
1348-Description: Library and tools for curtin installer
1349- This package provides python library for use by curtin.
1350-
1351 Package: python3-curtin
1352 Section: python
1353 Architecture: all
1354 Priority: extra
1355 Depends: curtin-common (= ${binary:Version}),
1356 python3-oauthlib,
1357+ python3-pyudev,
1358 python3-yaml,
1359 wget,
1360 ${misc:Depends},
1361diff --git a/debian/rules b/debian/rules
1362index af2ebab..74be87c 100755
1363--- a/debian/rules
1364+++ b/debian/rules
1365@@ -1,6 +1,5 @@
1366 #!/usr/bin/make -f
1367
1368-PYVERS := $(shell pyversions -r)
1369 PY3VERS := $(shell py3versions -r)
1370
1371 DEB_VERSION := $(shell dpkg-parsechangelog --show-field=Version)
1372@@ -8,14 +7,16 @@ UPSTREAM_VERSION := $(shell x="$(DEB_VERSION)"; echo "$${x%-*}")
1373 PKG_VERSION := $(shell x="$(DEB_VERSION)"; echo "$${x\#\#*-}")
1374
1375 %:
1376- dh $@ --with=python2,python3
1377+ dh $@ --with=python3
1378
1379 override_dh_auto_install:
1380 dh_auto_install
1381- set -ex; for python in $(PY3VERS) $(PYVERS); do \
1382+ set -ex; for python in $(PY3VERS); do \
1383 $$python setup.py build --executable=/usr/bin/python && \
1384 $$python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
1385 done
1386 chmod 755 $(CURDIR)/debian/tmp/usr/lib/curtin/helpers/*
1387- find $(CURDIR)/debian/tmp
1388 for f in $$(find $(CURDIR)/debian/tmp/usr/lib -type f -name version.py); do [ -f "$$f" ] || continue; sed -i 's,@@PACKAGED_VERSION@@,$(DEB_VERSION),' "$$f"; done
1389+
1390+override_dh_auto_test:
1391+ make unittest3
1392diff --git a/requirements.txt b/requirements.txt
1393index 9066728..81347e5 100644
1394--- a/requirements.txt
1395+++ b/requirements.txt
1396@@ -2,3 +2,4 @@ pyyaml
1397 oauthlib
1398 # For validation of storate configuration format
1399 jsonschema
1400+pyudev
1401\ No newline at end of file
1402diff --git a/tests/unittests/test_block.py b/tests/unittests/test_block.py
1403index e70503d..ac7c173 100644
1404--- a/tests/unittests/test_block.py
1405+++ b/tests/unittests/test_block.py
1406@@ -76,19 +76,25 @@ class TestBlock(CiTestCase):
1407 @mock.patch("curtin.block.multipath")
1408 @mock.patch("curtin.block.os.path.realpath")
1409 @mock.patch("curtin.block.os.path.exists")
1410- @mock.patch("curtin.block.os.listdir")
1411- def test_lookup_disk(self, mock_os_listdir, mock_os_path_exists,
1412- mock_os_path_realpath, mock_mpath):
1413+ @mock.patch("curtin.block.get_disk_by_id")
1414+ @mock.patch("curtin.udev.pyudev.Device")
1415+ def test_lookup_disk(self, mock_device, mock_udev_get_disk_by_id,
1416+ mock_os_path_exists, mock_os_path_realpath,
1417+ mock_mpath):
1418 serial = "SERIAL123"
1419- mock_os_listdir.return_value = ["sda_%s-part1" % serial,
1420- "sda_%s" % serial, "other"]
1421+
1422+ MockDev = mock_device.return_value
1423+ MockDev.device_path = '/dev/sda'
1424+ MockDev.device_links = (x for x in ['/dev/disk/by-id/sda_%s' % serial])
1425+
1426+ mock_udev_get_disk_by_id.return_value = (x for x in [MockDev]*3)
1427+
1428 mock_os_path_exists.return_value = True
1429 mock_os_path_realpath.return_value = "/dev/sda"
1430 mock_mpath.is_mpath_device.return_value = False
1431
1432 path = block.lookup_disk(serial)
1433
1434- mock_os_listdir.assert_called_with("/dev/disk/by-id/")
1435 mock_os_path_realpath.assert_called_with("/dev/disk/by-id/sda_%s" %
1436 serial)
1437 self.assertTrue(mock_os_path_exists.called)
1438@@ -100,35 +106,9 @@ class TestBlock(CiTestCase):
1439
1440 with self.assertRaises(ValueError):
1441 mock_os_path_exists.return_value = True
1442- mock_os_listdir.return_value = ["other"]
1443+ MockDev.device_links = (x for x in [])
1444 block.lookup_disk(serial)
1445
1446- @mock.patch("curtin.block.multipath")
1447- @mock.patch("curtin.block.os.path.realpath")
1448- @mock.patch("curtin.block.os.path.exists")
1449- @mock.patch("curtin.block.os.listdir")
1450- def test_lookup_disk_find_wwn(self, mock_os_listdir, mock_os_path_exists,
1451- mock_os_path_realpath, mock_mpath):
1452- wwn = "eui.0025388b710116a1"
1453- expected_link = 'nvme-%s' % wwn
1454- device = '/wark/nvme0n1'
1455- mock_os_listdir.return_value = [
1456- "nvme-eui.0025388b710116a1",
1457- "nvme-eui.0025388b710116a1-part1",
1458- "nvme-eui.0025388b710116a1-part2",
1459- ]
1460- mock_os_path_exists.return_value = True
1461- mock_os_path_realpath.return_value = device
1462- mock_mpath.is_mpath_device.return_value = False
1463-
1464- path = block.lookup_disk(wwn)
1465-
1466- mock_os_listdir.assert_called_with("/dev/disk/by-id/")
1467- mock_os_path_realpath.assert_called_with("/dev/disk/by-id/" +
1468- expected_link)
1469- self.assertTrue(mock_os_path_exists.called)
1470- self.assertEqual(device, path)
1471-
1472 @mock.patch('curtin.block.udevadm_info')
1473 def test_get_device_mapper_links_returns_first_non_none(self, m_info):
1474 """ get_device_mapper_links returns first by sort entry in DEVLINKS."""
1475diff --git a/tests/unittests/test_udev.py b/tests/unittests/test_udev.py
1476index 0a070d5..2276515 100644
1477--- a/tests/unittests/test_udev.py
1478+++ b/tests/unittests/test_udev.py
1479@@ -4,6 +4,7 @@ import mock
1480
1481 from curtin import udev
1482 from curtin import util
1483+from curtin.udev import get_dev_by_id, get_disk_by_id
1484 from .helpers import CiTestCase
1485
1486
1487@@ -66,3 +67,35 @@ class TestUdevInfo(CiTestCase):
1488 m_subp.side_effect = util.ProcessExecutionError()
1489 with self.assertRaises(util.ProcessExecutionError):
1490 udev.udevadm_info(mypath)
1491+
1492+ @mock.patch('curtin.udev.pyudev.Context')
1493+ @mock.patch('curtin.udev.pyudev.Device')
1494+ def test_get_dev_by_id(self, MockDevice, MockContext):
1495+ """ get a list of udev devices """
1496+ import itertools
1497+ serial = '12345678'
1498+ context = MockContext.return_value
1499+ context.list_devices.return_value = [MockDevice()]
1500+
1501+ devs = get_dev_by_id(serial)
1502+
1503+ self.assertIsInstance(devs, itertools.chain)
1504+ self.assertTrue(len(list(devs)) == 4)
1505+
1506+ @mock.patch('curtin.udev.get_dev_by_id')
1507+ @mock.patch('curtin.udev.pyudev.Device', autospec=False)
1508+ def test_get_disk_by_id(self, MockDevice, fun_get_dev):
1509+ """ test if disk was found """
1510+ serial = '12345678'
1511+ diskA = mock.Mock()
1512+ diskA.device_type = 'partition'
1513+
1514+ diskB = mock.Mock()
1515+ diskB.device_type = 'disk'
1516+
1517+ fun_get_dev.return_value = [diskA, diskB]
1518+
1519+ disk = next(get_disk_by_id(serial))
1520+
1521+ self.assertTrue(disk.device_type == 'disk')
1522+ # TODO: test StopIteration
1523diff --git a/tox.ini b/tox.ini
1524index 3a8e40e..8c9d0f3 100644
1525--- a/tox.ini
1526+++ b/tox.ini
1527@@ -79,6 +79,7 @@ deps = pyflakes==0.8.1
1528 nose==1.3.1
1529 pyyaml==3.10
1530 oauthlib==0.6.1
1531+ pyudev==0.16.1
1532
1533 [testenv:trusty-check]
1534 deps = {[testenv:trusty]deps}
1535@@ -104,6 +105,7 @@ deps =
1536 nose==1.3.7
1537 pyyaml==3.11
1538 oauthlib==1.0.3
1539+ pyudev==0.16.1
1540
1541 [testenv:xenial-py27]
1542 basepython = python27

Subscribers

People subscribed via source and target branches