Пример #1
0
    def test_execute_clean_step_version_mismatch(self, mock_version,
                                                 mock_dispatch):
        mock_version.side_effect = errors.CleanVersionMismatch(
            {'GenericHardwareManager': 1}, {'GenericHardwareManager': 2})

        async_result = self.agent_extension.execute_clean_step(
            step=self.step['GenericHardwareManager'][0], node=self.node,
            ports=self.ports, clean_version=self.version)
        async_result.join()
        self.assertEqual('CLEAN_VERSION_MISMATCH', async_result.command_status)

        mock_version.assert_called_once_with(self.version)
Пример #2
0
def _check_clean_version(clean_version=None):
    """Ensure the clean version hasn't changed."""
    # If the version is None, assume this is the first run
    if clean_version is None:
        return
    agent_version = _get_current_clean_version()
    if clean_version != agent_version:
        LOG.warning(
            'Mismatched clean versions. Agent version: %(agent), '
            'node version: %(node)', {
                'agent': agent_version,
                'node': clean_version
            })
        raise errors.CleanVersionMismatch(agent_version=agent_version,
                                          node_version=clean_version)
Пример #3
0
def _check_clean_version(clean_version=None):
    """Ensure the clean version hasn't changed.

    :param clean_version: Hardware manager versions used during this
                          cleaning cycle.
    :raises: errors.CleanVersionMismatch if any hardware manager version on
             the currently running agent doesn't match the one stored in
             clean_version.
    :returns: None
    """
    # If the version is None, assume this is the first run
    if clean_version is None:
        return
    agent_version = _get_current_clean_version()
    if clean_version != agent_version:
        LOG.warning('Mismatched clean versions. Agent version: %(agent), '
                    'node version: %(node)', {'agent': agent_version,
                                              'node': clean_version})
        raise errors.CleanVersionMismatch(agent_version=agent_version,
                                          node_version=clean_version)