Beispiel #1
0
def commit_config(task):
    """Commits pending changes added by set_config

    :param task: is the ironic task for running the config job.
    :raises: DracClientError on an error from pywsman library.
    :raises: DracPendingConfigJobExists if the job is already created.
    :raises: DracOperationFailed if the client received response with an
             error message.
    :raises: DracUnexpectedReturnValue if the client received a response
             with unexpected return value

    """
    node = task.node
    management.check_for_config_job(node)
    management.create_config_job(node)
Beispiel #2
0
def commit_config(task):
    """Commits pending changes added by set_config

    :param task: is the ironic task for running the config job.
    :raises: DracClientError on an error from pywsman library.
    :raises: DracPendingConfigJobExists if the job is already created.
    :raises: DracOperationFailed if the client received response with an
             error message.
    :raises: DracUnexpectedReturnValue if the client received a response
             with unexpected return value

    """
    node = task.node
    management.check_for_config_job(node)
    management.create_config_job(node)
Beispiel #3
0
    def test_create_config_job(self, mock_client_pywsman):
        result_xml = test_utils.build_soap_xml(
            [{'ReturnValue': drac_client.RET_CREATED}],
            resource_uris.DCIM_BIOSService)

        mock_xml = test_utils.mock_wsman_root(result_xml)
        mock_pywsman = mock_client_pywsman.Client.return_value
        mock_pywsman.invoke.return_value = mock_xml

        result = drac_mgmt.create_config_job(self.node)

        self.assertIsNone(result)
        mock_pywsman.invoke.assert_called_once_with(
            mock.ANY, resource_uris.DCIM_BIOSService,
            'CreateTargetedConfigJob', None)
Beispiel #4
0
    def test_create_config_job(self, mock_client_pywsman):
        result_xml = test_utils.build_soap_xml(
            [{'ReturnValue': drac_client.RET_CREATED}],
            resource_uris.DCIM_BIOSService)

        mock_xml = test_utils.mock_wsman_root(result_xml)
        mock_pywsman = mock_client_pywsman.Client.return_value
        mock_pywsman.invoke.return_value = mock_xml

        result = drac_mgmt.create_config_job(self.node)

        self.assertIsNone(result)
        mock_pywsman.invoke.assert_called_once_with(
            mock.ANY, resource_uris.DCIM_BIOSService,
            'CreateTargetedConfigJob', None)
Beispiel #5
0
    def test_create_config_job_with_reboot(self, mock_client_pywsman):
        result_xml = test_utils.build_soap_xml(
            [{'ReturnValue': drac_client.RET_CREATED}],
            resource_uris.DCIM_BIOSService)
        mock_xml = test_utils.mock_wsman_root(result_xml)
        mock_pywsman = mock_client_pywsman.Client.return_value
        mock_pywsman.invoke.return_value = mock_xml

        mock_pywsman_clientopts = (
            mock_client_pywsman.ClientOptions.return_value)

        result = drac_mgmt.create_config_job(self.node, reboot=True)

        self.assertIsNone(result)
        mock_pywsman_clientopts.add_property.assert_has_calls([
            mock.call('RebootJobType', '3'),
        ])
        mock_pywsman.invoke.assert_called_once_with(
            mock.ANY, resource_uris.DCIM_BIOSService,
            'CreateTargetedConfigJob', None)
Beispiel #6
0
    def test_create_config_job_with_reboot(self, mock_client_pywsman):
        result_xml = test_utils.build_soap_xml(
            [{
                'ReturnValue': drac_client.RET_CREATED
            }], resource_uris.DCIM_BIOSService)
        mock_xml = test_utils.mock_wsman_root(result_xml)
        mock_pywsman = mock_client_pywsman.Client.return_value
        mock_pywsman.invoke.return_value = mock_xml

        mock_pywsman_clientopts = (
            mock_client_pywsman.ClientOptions.return_value)

        result = drac_mgmt.create_config_job(self.node, reboot=True)

        self.assertIsNone(result)
        mock_pywsman_clientopts.add_property.assert_has_calls([
            mock.call('RebootJobType', '3'),
        ])
        mock_pywsman.invoke.assert_called_once_with(
            mock.ANY, resource_uris.DCIM_BIOSService,
            'CreateTargetedConfigJob', None)