コード例 #1
0
ファイル: postgres.py プロジェクト: gardlt/fuel-octane
 def restore(self):
     for args in magic_consts.NAILGUN_ARCHIVATOR_PATCHES:
         docker.apply_patches(*args)
     try:
         super(NailgunArchivator, self).restore()
         self._post_restore_action()
     finally:
         for args in magic_consts.NAILGUN_ARCHIVATOR_PATCHES:
             docker.apply_patches(*args, revert=True)
コード例 #2
0
ファイル: postgres.py プロジェクト: rmoe/fuel-octane
 def restore(self):
     for args in magic_consts.NAILGUN_ARCHIVATOR_PATCHES:
         docker.apply_patches(*args)
     try:
         super(NailgunArchivator, self).restore()
         self._post_restore_action()
     finally:
         for args in magic_consts.NAILGUN_ARCHIVATOR_PATCHES:
             docker.apply_patches(*args, revert=True)
コード例 #3
0
ファイル: test_docker.py プロジェクト: openstack/fuel-octane
def test_apply_patches(mocker, container, prefix, patches, revert, files):
    kwargs = {}
    if revert is not None:
        kwargs['revert'] = revert

    mock_get_filenames = mocker.patch(
        "octane.util.patch.get_filenames_from_patches", return_value=files)
    mock_tempdir = mocker.patch("octane.util.tempfile.temp_dir")
    get_files_mock = mocker.patch("octane.util.docker.get_files_from_docker")
    put_files_mock = mocker.patch("octane.util.docker.put_files_to_docker")
    patch_mock = mocker.patch("octane.util.patch.patch_apply")

    docker.apply_patches(container, prefix, *patches, **kwargs)

    mock_get_filenames.assert_called_once_with(prefix, *patches)
    if files:
        mock_tempdir.assert_called_once_with(prefix='octane_docker_patches.')
        temp_dir = mock_tempdir.return_value.__enter__.return_value
        get_files_mock.assert_called_once_with(
            container, [os.path.join(prefix, f) for f in files], temp_dir)
        patch_mock.assert_called_once_with(
            os.path.join(temp_dir, prefix), patches, bool(revert))
        put_files_mock.assert_called_once_with(container, "/", temp_dir)
コード例 #4
0
ファイル: prepare.py プロジェクト: svnovikov/octane
def apply_patches(revert=False):
    for container, prefix, patch in magic_consts.PATCHES:
        docker.apply_patches(container, prefix,
                             os.path.join(magic_consts.CWD, patch),
                             revert=revert)
コード例 #5
0
ファイル: prepare.py プロジェクト: SlavaValAl/octane
def apply_patches(revert=False):
    for container, prefix, patch in magic_consts.PATCHES:
        docker.apply_patches(container,
                             prefix,
                             os.path.join(magic_consts.CWD, patch),
                             revert=revert)