diff -Nru netplan.io-0.40/debian/changelog netplan.io-0.40.2/debian/changelog --- netplan.io-0.40/debian/changelog 2018-09-13 21:29:41.000000000 +0000 +++ netplan.io-0.40.2/debian/changelog 2018-10-04 20:02:53.000000000 +0000 @@ -1,3 +1,17 @@ +netplan.io (0.40.2) cosmic; urgency=medium + + * tests/integration.py: Mark regexes with r to pacify pycodestyle's W605. + + -- Mathieu Trudel-Lapierre Thu, 04 Oct 2018 16:02:53 -0400 + +netplan.io (0.40.1) cosmic; urgency=medium + + * tests/generate.py: use random.sample() instead of random.choices() to + better support older pythons. + * Deal gracefully with empty files on 'netplan apply' (LP: #1795343) + + -- Mathieu Trudel-Lapierre Thu, 04 Oct 2018 12:05:49 -0400 + netplan.io (0.40) cosmic; urgency=medium * New upstream release: Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/cli/commands/__pycache__/apply.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/cli/commands/__pycache__/apply.cpython-36.pyc differ Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/cli/commands/__pycache__/generate.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/cli/commands/__pycache__/generate.cpython-36.pyc differ Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/cli/commands/__pycache__/__init__.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/cli/commands/__pycache__/__init__.cpython-36.pyc differ Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/cli/commands/__pycache__/ip.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/cli/commands/__pycache__/ip.cpython-36.pyc differ Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/cli/commands/__pycache__/migrate.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/cli/commands/__pycache__/migrate.cpython-36.pyc differ Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/cli/commands/__pycache__/try_command.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/cli/commands/__pycache__/try_command.cpython-36.pyc differ Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/cli/__pycache__/core.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/cli/__pycache__/core.cpython-36.pyc differ Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/cli/__pycache__/__init__.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/cli/__pycache__/__init__.cpython-36.pyc differ Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/cli/__pycache__/utils.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/cli/__pycache__/utils.cpython-36.pyc differ diff -Nru netplan.io-0.40/netplan/configmanager.py netplan.io-0.40.2/netplan/configmanager.py --- netplan.io-0.40/netplan/configmanager.py 2018-09-12 22:41:00.000000000 +0000 +++ netplan.io-0.40.2/netplan/configmanager.py 2018-10-04 17:56:54.000000000 +0000 @@ -194,7 +194,9 @@ try: with open(yaml_file) as f: yaml_data = yaml.load(f, Loader=yaml.CSafeLoader) - network = yaml_data.get('network') + network = None + if yaml_data is not None: + network = yaml_data.get('network') if network: if 'ethernets' in network: new = self._merge_interface_config(self.ethernets, network.get('ethernets')) Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/__pycache__/configmanager.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/__pycache__/configmanager.cpython-36.pyc differ Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/__pycache__/__init__.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/__pycache__/__init__.cpython-36.pyc differ Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/netplan/__pycache__/terminal.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/netplan/__pycache__/terminal.cpython-36.pyc differ diff -Nru netplan.io-0.40/tests/cli.py netplan.io-0.40.2/tests/cli.py --- netplan.io-0.40/tests/cli.py 2018-09-12 22:41:28.000000000 +0000 +++ netplan.io-0.40.2/tests/cli.py 2018-10-04 17:56:54.000000000 +0000 @@ -67,6 +67,20 @@ self.assertEqual(out, b'') self.assertEqual(os.listdir(self.workdir.name), []) + def test_with_empty_config(self): + c = os.path.join(self.workdir.name, 'etc', 'netplan') + os.makedirs(c) + open(os.path.join(c, 'a.yaml'), 'w').close() + with open(os.path.join(c, 'b.yaml'), 'w') as f: + f.write('''network: + version: 2 + ethernets: + enlol: {dhcp4: yes}''') + out = subprocess.check_output(exe_cli + ['generate', '--root-dir', self.workdir.name], stderr=subprocess.STDOUT) + self.assertEqual(out, b'') + self.assertEqual(os.listdir(os.path.join(self.workdir.name, 'run', 'systemd', 'network')), + ['10-netplan-enlol.network']) + def test_with_config(self): c = os.path.join(self.workdir.name, 'etc', 'netplan') os.makedirs(c) diff -Nru netplan.io-0.40/tests/generate.py netplan.io-0.40.2/tests/generate.py --- netplan.io-0.40/tests/generate.py 2018-09-12 23:05:32.000000000 +0000 +++ netplan.io-0.40.2/tests/generate.py 2018-10-04 16:04:57.000000000 +0000 @@ -87,7 +87,7 @@ Use when you need a link name for a test but don't want to encode a made up name in the test. """ - return 'eth' + ''.join(random.choices(string.ascii_letters + string.digits, k=4)) + return 'eth' + ''.join(random.sample(string.ascii_letters + string.digits, k=4)) def assert_networkd(self, file_contents_map): networkd_dir = os.path.join(self.workdir.name, 'run', 'systemd', 'network') diff -Nru netplan.io-0.40/tests/integration.py netplan.io-0.40.2/tests/integration.py --- netplan.io-0.40/tests/integration.py 2018-09-13 20:39:00.000000000 +0000 +++ netplan.io-0.40.2/tests/integration.py 2018-10-04 19:59:22.000000000 +0000 @@ -64,7 +64,7 @@ # set regulatory domain "EU", so that we can use 80211.a 5 GHz channels out = subprocess.check_output(['iw', 'reg', 'get'], universal_newlines=True) - m = re.match('^(?:global\n)?country (\S+):', out) + m = re.match(r'^(?:global\n)?country (\S+):', out) assert m klass.orig_country = m.group(1) subprocess.check_call(['iw', 'reg', 'set', 'EU']) @@ -365,6 +365,11 @@ class _CommonTests: + def test_empty_yaml_lp1795343(self): + with open(self.config, 'w') as f: + f.write('''''') + self.generate_and_settle() + @unittest.skip("Unsupported matching by driver / wifi matching makes this untestable for now") def test_mapping_for_driver(self): self.setup_ap('hw_mode=b\nchannel=1\nssid=fake net', None) @@ -420,7 +425,7 @@ expected_state = (self.backend == 'NetworkManager') and 'connected' or 'unmanaged' out = subprocess.check_output(['nmcli', 'dev'], universal_newlines=True) for i in [self.dev_e_client, self.dev_e2_client, 'mybr']: - self.assertRegex(out, '%s\s+(ethernet|bridge)\s+%s' % (i, expected_state)) + self.assertRegex(out, r'%s\s+(ethernet|bridge)\s+%s' % (i, expected_state)) def test_eth_mtu(self): self.setup_eth(None) @@ -1085,7 +1090,7 @@ expected_state = (self.backend == 'NetworkManager') and 'connected' or 'unmanaged' out = subprocess.check_output(['nmcli', 'dev'], universal_newlines=True) for i in [self.dev_e_client, self.dev_e2_client]: - self.assertRegex(out, '%s\s+(ethernet|bridge)\s+%s' % (i, expected_state)) + self.assertRegex(out, r'%s\s+(ethernet|bridge)\s+%s' % (i, expected_state)) with open('/etc/resolv.conf') as f: resolv_conf = f.read() Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/tests/__pycache__/test_configmanager.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/tests/__pycache__/test_configmanager.cpython-36.pyc differ Binary files /tmp/tmpPEOgTl/sGh70Ow2T3/netplan.io-0.40/tests/__pycache__/test_terminal.cpython-36.pyc and /tmp/tmpPEOgTl/itZZfrbupC/netplan.io-0.40.2/tests/__pycache__/test_terminal.cpython-36.pyc differ