Merge "Catch FileExistsError when creating /etc/corosync dir."
This commit is contained in:
commit
073095a613
|
@ -153,7 +153,10 @@ DEPRECATED_TRANSPORT_VALUES = {"multicast": "udp", "unicast": "udpu"}
|
|||
def install():
|
||||
# LP:1874719 Configure a corosync.conf file to avoid a spurious node1 to
|
||||
# be created in the cluster.
|
||||
try:
|
||||
os.mkdir('/etc/corosync', mode=0o755)
|
||||
except FileExistsError:
|
||||
pass
|
||||
if emit_corosync_conf():
|
||||
log('Installed initial corosync.conf file', level=INFO)
|
||||
else:
|
||||
|
|
|
@ -402,6 +402,15 @@ class TestHooks(test_utils.CharmTestCase):
|
|||
apt_install.assert_called_once_with(expected_pkgs, fatal=True)
|
||||
setup_ocf_files.assert_called_once_with()
|
||||
|
||||
mkdir.reset_mock()
|
||||
|
||||
def raise_():
|
||||
raise FileExistsError()
|
||||
|
||||
mkdir.side_effect = lambda p, mode: raise_()
|
||||
hooks.install()
|
||||
mkdir.assert_called_once_with('/etc/corosync', mode=0o755)
|
||||
|
||||
@mock.patch('pcmk.set_property')
|
||||
@mock.patch.object(hooks, 'is_stonith_configured')
|
||||
@mock.patch.object(hooks, 'configure_stonith')
|
||||
|
|
Loading…
Reference in New Issue