def test_crm_init_complete(self):
        '''
        Test _crm_init method
        '''
        mock_cmd_run = MagicMock(return_value=True)

        with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_run}):
            result = crmshmod._crm_init('hacluster', 'dog', 'eth1', True,
                                        '192.168.1.50', True, ['dev1', 'dev2'],
                                        True, 'alice', True)
            assert result
            mock_cmd_run.assert_called_once_with(
                '{} cluster init -y -n {} -w {} -i {} -u -A {} '
                '-s {} -s {} --no-overwrite-sshkey --qnetd-hostname {} -q'.
                format(crmshmod.CRM_COMMAND, 'hacluster', 'dog', 'eth1',
                       '192.168.1.50', 'dev1', 'dev2', 'alice'))

        # SBD diskless
        mock_cmd_run.reset_mock()
        with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_run}):
            result = crmshmod._crm_init('hacluster', 'dog', 'eth1', True,
                                        '192.168.1.50', True, None, True,
                                        'alice', True)
            assert result
            mock_cmd_run.assert_called_once_with(
                '{} cluster init -y -n {} -w {} -i {} -u -A {} '
                '-S --no-overwrite-sshkey --qnetd-hostname {} -q'.format(
                    crmshmod.CRM_COMMAND, 'hacluster', 'dog', 'eth1',
                    '192.168.1.50', 'alice'))
    def test_crm_init_basic(self):
        '''
        Test _crm_init method
        '''
        mock_cmd_run = MagicMock(return_value=True)

        with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_run}):
            result = crmshmod._crm_init('hacluster')
            assert result
            mock_cmd_run.assert_called_once_with(
                '{crm_command} cluster init -y -n {name}'.format(
                    crm_command=crmshmod.CRM_COMMAND, name='hacluster'))
Beispiel #3
0
    def test_crm_init_complete(self):
        '''
        Test _crm_init method
        '''
        mock_cmd_run = MagicMock(return_value=True)

        with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_run}):
            result = crmshmod._crm_init(
                'hacluster', 'dog', 'eth1', True, '192.168.1.50', True, 'sbd_dev', True)
            assert result
            mock_cmd_run.assert_called_once_with(
                '{} cluster init -y -n {} -w {} -i {} -u -A {} --enable-sbd -s {} -q'.format(
                    crmshmod.CRM_COMMAND, 'hacluster', 'dog', 'eth1', '192.168.1.50', 'sbd_dev'))