Revert "Disable cloud-init network auto configuration"
The directory /etc/cloud/cloud.cfg.d/ doesn't exist. Thus fuel-bootstrap fails as it cannot create file that should be inside of that directory.
Closes-Bug: 1643139
This reverts commit b2be687081
.
Change-Id: Ie2bef3a83fb02bf7fe9634ede66998c5cf217f20
This commit is contained in:
parent
b2be687081
commit
fee38d0cd9
|
@ -187,7 +187,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
|
||||||
mock_yaml_dump.assert_called_once_with({
|
mock_yaml_dump.assert_called_once_with({
|
||||||
'cloud_init_modules': ['ssh'],
|
'cloud_init_modules': ['ssh'],
|
||||||
'cloud_config_modules': ['runcmd', 'write-files']
|
'cloud_config_modules': ['runcmd', 'write-files']
|
||||||
}, mock.ANY, encoding='utf-8', default_flow_style=False)
|
}, mock.ANY, default_flow_style=False)
|
||||||
|
|
||||||
@mock.patch('fuel_agent.utils.build.os.symlink')
|
@mock.patch('fuel_agent.utils.build.os.symlink')
|
||||||
@mock.patch('fuel_agent.utils.build.os.mkdir')
|
@mock.patch('fuel_agent.utils.build.os.mkdir')
|
||||||
|
@ -214,10 +214,8 @@ class BuildUtilsTestCase(unittest2.TestCase):
|
||||||
allow_unsigned_file='fake_unsigned',
|
allow_unsigned_file='fake_unsigned',
|
||||||
force_ipv4_file='fake_force_ipv4',
|
force_ipv4_file='fake_force_ipv4',
|
||||||
pipeline_depth_file='fake_pipeline_depth')
|
pipeline_depth_file='fake_pipeline_depth')
|
||||||
|
|
||||||
file_handle_mock = mock_open.return_value.__enter__.return_value
|
file_handle_mock = mock_open.return_value.__enter__.return_value
|
||||||
file_handle_mock.write.assert_called_once_with('manual\n')
|
file_handle_mock.write.assert_called_once_with('manual\n')
|
||||||
|
|
||||||
mock_exec_expected_calls = [
|
mock_exec_expected_calls = [
|
||||||
mock.call('sed',
|
mock.call('sed',
|
||||||
'-i',
|
'-i',
|
||||||
|
@ -243,17 +241,11 @@ class BuildUtilsTestCase(unittest2.TestCase):
|
||||||
mock.call('chroot', 'etc/init/mcollective.override'),
|
mock.call('chroot', 'etc/init/mcollective.override'),
|
||||||
mock.call('chroot', 'etc/systemd/system'),
|
mock.call('chroot', 'etc/systemd/system'),
|
||||||
mock.call('chroot', 'etc/systemd/system/mcollective.service'),
|
mock.call('chroot', 'etc/systemd/system/mcollective.service'),
|
||||||
mock.call('chroot',
|
|
||||||
'etc/cloud/cloud.cfg.d/99-disable-network-config.cfg'),
|
|
||||||
mock.call('chroot', 'etc/cloud/cloud.cfg'),
|
mock.call('chroot', 'etc/cloud/cloud.cfg'),
|
||||||
mock.call('/', bu.GRUB2_DMRAID_SETTINGS)]
|
mock.call('/', bu.GRUB2_DMRAID_SETTINGS)]
|
||||||
self.assertEqual(mock_path_join_expected_calls,
|
self.assertEqual(mock_path_join_expected_calls,
|
||||||
mock_path.join.call_args_list)
|
mock_path.join.call_args_list)
|
||||||
mock_symlink.assert_called_once_with('/dev/null', 'fake_path')
|
mock_symlink.assert_called_once_with('/dev/null', 'fake_path')
|
||||||
mock_yaml_dump.assert_called_with(mock.ANY,
|
|
||||||
mock.ANY,
|
|
||||||
encoding='utf-8',
|
|
||||||
default_flow_style=False)
|
|
||||||
|
|
||||||
@mock.patch('fuel_agent.utils.build.open',
|
@mock.patch('fuel_agent.utils.build.open',
|
||||||
create=True, new_callable=mock.mock_open)
|
create=True, new_callable=mock.mock_open)
|
||||||
|
|
|
@ -186,8 +186,7 @@ def fix_cloud_init_config(config_path):
|
||||||
config['cloud_init_modules'].remove('write-files')
|
config['cloud_init_modules'].remove('write-files')
|
||||||
config['cloud_config_modules'].append('write-files')
|
config['cloud_config_modules'].append('write-files')
|
||||||
with open(config_path, 'w') as cloud_conf:
|
with open(config_path, 'w') as cloud_conf:
|
||||||
yaml.safe_dump(config,
|
yaml.safe_dump(config, cloud_conf, default_flow_style=False)
|
||||||
cloud_conf, encoding='utf-8', default_flow_style=False)
|
|
||||||
|
|
||||||
|
|
||||||
def do_post_inst(chroot, hashed_root_password,
|
def do_post_inst(chroot, hashed_root_password,
|
||||||
|
@ -214,12 +213,6 @@ def do_post_inst(chroot, hashed_root_password,
|
||||||
if os.path.exists(os.path.join(chroot, 'etc/systemd/system')):
|
if os.path.exists(os.path.join(chroot, 'etc/systemd/system')):
|
||||||
os.symlink('/dev/null', os.path.join(chroot,
|
os.symlink('/dev/null', os.path.join(chroot,
|
||||||
'etc/systemd/system/mcollective.service'))
|
'etc/systemd/system/mcollective.service'))
|
||||||
with open(os.path.join(
|
|
||||||
chroot,
|
|
||||||
'etc/cloud/cloud.cfg.d/99-disable-network-config.cfg'), 'w') as cf:
|
|
||||||
yaml.safe_dump({'network': {'config': 'disabled'}}, cf,
|
|
||||||
encoding='utf-8',
|
|
||||||
default_flow_style=False)
|
|
||||||
cloud_init_conf = os.path.join(chroot, 'etc/cloud/cloud.cfg')
|
cloud_init_conf = os.path.join(chroot, 'etc/cloud/cloud.cfg')
|
||||||
if os.path.exists(cloud_init_conf):
|
if os.path.exists(cloud_init_conf):
|
||||||
fix_cloud_init_config(cloud_init_conf)
|
fix_cloud_init_config(cloud_init_conf)
|
||||||
|
|
Loading…
Reference in New Issue