diff options
author | Gonéri Le Bouder <goneri@lebouder.net> | 2019-05-24 21:39:19 +0000 |
---|---|---|
committer | Server Team CI Bot <josh.powers+server-team-bot@canonical.com> | 2019-05-24 21:39:19 +0000 |
commit | 0f8695323262e41c699588c7cd140f6b58c62017 (patch) | |
tree | a31c1befa154bed078270115dbc9d8eb31bfebcf /tests | |
parent | baa478546d8cac98a706010699d64f8c2f70b5bf (diff) | |
download | vyos-cloud-init-0f8695323262e41c699588c7cd140f6b58c62017.tar.gz vyos-cloud-init-0f8695323262e41c699588c7cd140f6b58c62017.zip |
freebsd: NoCloud data source support
blkid is a Linux-only command. With this patch, cloud-init uses another
approach to find the data source on FreeBSD.
LP: #1645824
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittests/test_datasource/test_nocloud.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unittests/test_datasource/test_nocloud.py b/tests/unittests/test_datasource/test_nocloud.py index b785362f..18bea0b9 100644 --- a/tests/unittests/test_datasource/test_nocloud.py +++ b/tests/unittests/test_datasource/test_nocloud.py @@ -278,6 +278,24 @@ class TestNoCloudDataSource(CiTestCase): self.assertEqual(netconf, dsrc.network_config) self.assertNotIn(gateway, str(dsrc.network_config)) + @mock.patch("cloudinit.util.blkid") + def test_nocloud_get_devices_freebsd(self, m_is_lxd, fake_blkid): + populate_dir(os.path.join(self.paths.seed_dir, "nocloud"), + {'user-data': b"ud", 'meta-data': "instance-id: IID\n"}) + + sys_cfg = {'datasource': {'NoCloud': {'fs_label': None}}} + + self.mocks.enter_context( + mock.patch.object(util, 'is_FreeBSD', return_value=True)) + + self.mocks.enter_context( + mock.patch.object(os.path, 'exists', return_value=True)) + + dsrc = dsNoCloud(sys_cfg=sys_cfg, distro=None, paths=self.paths) + ret = dsrc._get_devices('foo') + self.assertEqual(['/dev/msdosfs/foo', '/dev/iso9660/foo'], ret) + fake_blkid.assert_not_called() + class TestParseCommandLineData(CiTestCase): |