Configure mcollective identity in startup scripts
As a part of handing over control over mcollective from nailgun agent to startup scripts lets get rid of of nodiscover file flag and perform mcollective configuration and start Change-Id: Ia2f984570b38642b1090f6483ed3fa78958550c5 Partial-Bug: #1585671
This commit is contained in:
parent
5c612875a6
commit
5877315c7f
|
@ -131,7 +131,6 @@ runcmd:
|
|||
- fi
|
||||
{% else %}
|
||||
- if [ -x /bin/systemctl ]; then
|
||||
- /bin/systemctl unmask mcollective
|
||||
- /bin/systemctl enable mcollective
|
||||
# TODO(dteselkin) rework start sequence when bug
|
||||
# https://bugs.launchpad.net/fuel/+bug/1543063 is fixed
|
||||
|
|
|
@ -2,6 +2,3 @@
|
|||
|
||||
# Perform fuel bootstrap configuration
|
||||
/usr/bin/fix-configs-on-startup || /bin/true
|
||||
|
||||
# Unlocking nailgun-agent for discovering
|
||||
/bin/rm -f /etc/nailgun-agent/nodiscover
|
||||
|
|
|
@ -61,8 +61,12 @@ systemctl restart ntp
|
|||
#
|
||||
# Update mcollective config
|
||||
#
|
||||
while true; do
|
||||
sleep 5
|
||||
grep --line-regexp "[[:digit:]]\+" /etc/nailgun_uid && break
|
||||
done
|
||||
sed -i "s/^plugin.rabbitmq.pool.1.host\b.*$/plugin.rabbitmq.pool.1.host = $masternode_ip/" /etc/mcollective/server.cfg
|
||||
sed -i "s/^plugin.rabbitmq.pool.1.user\b.*$/plugin.rabbitmq.pool.1.user = $mco_user/" /etc/mcollective/server.cfg
|
||||
sed -i "s/^plugin.rabbitmq.pool.1.password\b.*$/plugin.rabbitmq.pool.1.password= $mco_pass/" /etc/mcollective/server.cfg
|
||||
systemctl unmask mcollective
|
||||
systemctl start mcollective
|
||||
echo "identity = $(head -n 1 /etc/nailgun_uid)" >> /etc/mcollective/server.cfg
|
||||
service mcollective restart
|
||||
|
|
|
@ -189,7 +189,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
|
|||
'cloud_config_modules': ['runcmd', 'write-files']
|
||||
}, mock.ANY, encoding='utf-8', default_flow_style=False)
|
||||
|
||||
@mock.patch('fuel_agent.utils.build.os.symlink')
|
||||
@mock.patch('fuel_agent.utils.build.os.unlink')
|
||||
@mock.patch('fuel_agent.utils.build.os.mkdir')
|
||||
@mock.patch('fuel_agent.utils.build.open',
|
||||
create=True, new_callable=mock.mock_open)
|
||||
|
@ -201,7 +201,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
|
|||
@mock.patch('fuel_agent.utils.build.yaml.safe_load')
|
||||
def test_do_post_inst(self, mock_yaml_load, mock_yaml_dump, mock_exec,
|
||||
mock_files, mock_clean, mock_path,
|
||||
mock_open, mock_mkdir, mock_symlink):
|
||||
mock_open, mock_mkdir, mock_unlink):
|
||||
mock_path.join.return_value = 'fake_path'
|
||||
mock_path.exists.return_value = True
|
||||
|
||||
|
@ -241,8 +241,9 @@ class BuildUtilsTestCase(unittest2.TestCase):
|
|||
mock.call('chroot', 'etc/shadow'),
|
||||
mock.call('chroot', 'etc/init.d/puppet'),
|
||||
mock.call('chroot', 'etc/init/mcollective.override'),
|
||||
mock.call('chroot', 'etc/systemd/system'),
|
||||
mock.call('chroot', 'etc/systemd/system/mcollective.service'),
|
||||
mock.call('chroot',
|
||||
'etc/systemd/system'
|
||||
'/multi-user.target.wants/mcollective.service'),
|
||||
mock.call('chroot', 'etc/cloud/cloud.cfg.d/'),
|
||||
mock.call('chroot',
|
||||
'etc/cloud/cloud.cfg.d/99-disable-network-config.cfg'),
|
||||
|
@ -250,7 +251,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
|
|||
mock.call('/', bu.GRUB2_DMRAID_SETTINGS)]
|
||||
self.assertEqual(mock_path_join_expected_calls,
|
||||
mock_path.join.call_args_list)
|
||||
mock_symlink.assert_called_once_with('/dev/null', 'fake_path')
|
||||
mock_unlink.assert_called_once_with('fake_path')
|
||||
mock_yaml_dump.assert_called_with(mock.ANY,
|
||||
mock.ANY,
|
||||
encoding='utf-8',
|
||||
|
|
|
@ -211,9 +211,11 @@ def do_post_inst(chroot, hashed_root_password,
|
|||
# to prevent confusing messages in its log (regarding connection errors).
|
||||
with open(os.path.join(chroot, 'etc/init/mcollective.override'), 'w') as f:
|
||||
f.write("manual\n")
|
||||
if os.path.exists(os.path.join(chroot, 'etc/systemd/system')):
|
||||
os.symlink('/dev/null', os.path.join(chroot,
|
||||
'etc/systemd/system/mcollective.service'))
|
||||
service_link = os.path.join(
|
||||
chroot,
|
||||
'etc/systemd/system/multi-user.target.wants/mcollective.service')
|
||||
if os.path.exists(service_link):
|
||||
os.unlink(service_link)
|
||||
cloud_cfg = os.path.join(chroot, 'etc/cloud/cloud.cfg.d/')
|
||||
utils.makedirs_if_not_exists(os.path.dirname(cloud_cfg))
|
||||
with open(os.path.join(
|
||||
|
|
Loading…
Reference in New Issue