コード例 #1
0
ファイル: upgrade.py プロジェクト: nebril/fuel-web
    def _on_success(self):
        """Do some useful job if upgrade was done successfully.
        """
        # Remove saved version files for all upgrades
        #
        # NOTE(eli): It solves several problems:
        #
        # 1. user runs upgrade 5.0 -> 5.1 which fails
        # upgrade system saves version which we upgrade
        # from in file working_dir/5.1/version.yaml.
        # Then user runs upgrade 5.0 -> 5.0.1 which
        # successfully upgraded. Then user runs again
        # upgrade 5.0.1 -> 5.1, but there is saved file
        # working_dir/5.1/version.yaml which contains
        # 5.0 version, and upgrade system thinks that
        # it's upgrading from 5.0 version, as result
        # it tries to make database dump from wrong
        # version of container.
        #
        # 2. without this hack user can run upgrade
        # second time and loose his data, this hack
        # prevents this case because before upgrade
        # checker will use current version instead
        # of saved version to determine version which
        # we run upgrade from.
        for version_file in glob.glob(self._config.version_files_mask):
            utils.remove(version_file)

        self._setup_update_repos()
コード例 #2
0
ファイル: upgrade.py プロジェクト: kansuke4649/fuel-web
 def _on_success(self):
     """Do some useful job if upgrade was done successfully.
     """
     # Remove saved version files for all upgrades
     #
     # NOTE(eli): It solves several problems:
     #
     # 1. user runs upgrade 5.0 -> 5.1 which fails
     # upgrade system saves version which we upgrade
     # from in file working_dir/5.1/version.yaml.
     # Then user runs upgrade 5.0 -> 5.0.1 which
     # successfully upgraded. Then user runs again
     # upgrade 5.0.1 -> 5.1, but there is saved file
     # working_dir/5.1/version.yaml which contains
     # 5.0 version, and upgrade system thinks that
     # it's upgrading from 5.0 version, as result
     # it tries to make database dump from wrong
     # version of container.
     #
     # 2. without this hack user can run upgrade
     # second time and loose his data, this hack
     # prevents this case because before upgrade
     # checker will use current version instead
     # of saved version to determine version which
     # we run upgrade from.
     for version_file in glob.glob(self._config.version_files_mask):
         utils.remove(version_file)
コード例 #3
0
ファイル: docker_engine.py プロジェクト: toby82/fuel-web
    def on_success(self):
        """Remove saved version files for all upgrades

        NOTE(eli): It solves several problems:

        1. user runs upgrade 5.0 -> 5.1 which fails
        upgrade system saves version which we upgrade
        from in file working_dir/5.1/version.yaml.
        Then user runs upgrade 5.0 -> 5.0.1 which
        successfully upgraded. Then user runs again
        upgrade 5.0.1 -> 5.1, but there is saved file
        working_dir/5.1/version.yaml which contains
        5.0 version, and upgrade system thinks that
        it's upgrading from 5.0 version, as result
        it tries to make database dump from wrong
        version of container.

        2. without this hack user can run upgrade
        second time and loose his data, this hack
        prevents this case because before upgrade
        checker will use current version instead
        of saved version to determine version which
        we run upgrade from.
        """
        for version_file in glob.glob(self.config.version_files_mask):
            utils.remove(version_file)
コード例 #4
0
ファイル: host_system.py プロジェクト: SergK/fuel-web
 def remove_repos(self):
     sources = glob.glob(self.host_system_config['repos']['src'])
     for source in sources:
         destination = os.path.join(
             self.host_system_config['repos']['dst'],
             os.path.basename(source))
         utils.remove(destination)
コード例 #5
0
ファイル: docker_engine.py プロジェクト: igajsin/fuel-web
    def on_success(self):
        """Remove saved version files for all upgrades

        NOTE(eli): It solves several problems:

        1. user runs upgrade 5.0 -> 5.1 which fails
        upgrade system saves version which we upgrade
        from in file working_dir/5.1/version.yaml.
        Then user runs upgrade 5.0 -> 5.0.1 which
        successfully upgraded. Then user runs again
        upgrade 5.0.1 -> 5.1, but there is saved file
        working_dir/5.1/version.yaml which contains
        5.0 version, and upgrade system thinks that
        it's upgrading from 5.0 version, as result
        it tries to make database dump from wrong
        version of container.

        2. without this hack user can run upgrade
        second time and loose his data, this hack
        prevents this case because before upgrade
        checker will use current version instead
        of saved version to determine version which
        we run upgrade from.
        """
        for version_file in glob.glob(self.config.version_files_mask):
            utils.remove(version_file)
コード例 #6
0
ファイル: host_system.py プロジェクト: kansuke4649/fuel-web
 def remove_repos(self):
     sources = glob.glob(self.host_system_config['repos']['src'])
     for source in sources:
         destination = os.path.join(
             self.host_system_config['repos']['dst'],
             os.path.basename(source))
         utils.remove(destination)
コード例 #7
0
ファイル: docker_engine.py プロジェクト: romcheg/fuel-web
 def save_astute_keys(self):
     """Copy any astute generated keys."""
     container_name = self.make_container_name('astute', self.from_version)
     utils.remove(self.config.astute_keys_path)
     try:
         utils.exec_cmd('docker cp {0}:{1} {2}'.format(
             container_name,
             self.config.astute_container_keys_path,
             self.config.working_directory))
     except errors.ExecutedErrorNonZeroExitCode as exc:
         # If there was error, mostly it's because of error
         #
         #   Error: Could not find the file /var/lib/astute
         #   in container fuel-core-5.0-astute
         #
         # It means that user didn't run deployment on his
         # env, because this directory is created by orchestrator
         # during the first deployment.
         # Also it can fail if there was no running container
         # in both case we should create empty directory to copy
         # it in after container creation section
         logger.debug(
             'Cannot copy astute keys, creating empty directory '
             '%s: %s', self.config.astute_keys_path, exc)
         if not utils.file_exists(self.config.astute_keys_path):
             os.mkdir(self.config.astute_keys_path)
コード例 #8
0
 def run(self):
     # save dhcrelay.conf to versioned folder
     copy_file(self._save_from, self._save_to)
     # remove dhcrelay.conf from global supervisor scope
     remove(self._save_from)
     # stop dhcrelay in supervisord, otherwise it will be re-ran
     # automatically
     safe_exec_cmd('supervisorctl stop dhcrelay_monitor')
コード例 #9
0
ファイル: openstack.py プロジェクト: koder-ua/nailgun-fcert
    def remove_repos(self):
        logger.info('Removing repositories...')

        sources = glob.glob(self.config.openstack['repos']['src'])
        for source in sources:
            destination = os.path.join(self.config.openstack['repos']['dst'],
                                       os.path.basename(source))
            utils.remove(destination)
 def run(self):
     # save dhcrelay.conf to versioned folder
     copy_file(self._save_from, self._save_to)
     # remove dhcrelay.conf from global supervisor scope
     remove(self._save_from)
     # stop dhcrelay in supervisord, otherwise it will be re-ran
     # automatically
     safe_exec_cmd('supervisorctl stop dhcrelay_monitor')
コード例 #11
0
ファイル: openstack.py プロジェクト: koder-ua/nailgun-fcert
    def remove_puppets(self):
        logger.info('Removing puppet manifests...')

        sources = glob.glob(self.config.openstack['puppets']['src'])
        for source in sources:
            destination = os.path.join(self.config.openstack['puppets']['dst'],
                                       os.path.basename(source))
            utils.remove(destination)
コード例 #12
0
    def remove_puppets(self):
        logger.info('Removing puppet manifests...')

        sources = glob.glob(self.config.openstack['puppets']['src'])
        for source in sources:
            destination = os.path.join(
                self.config.openstack['puppets']['dst'],
                os.path.basename(source))
            utils.remove(destination)
コード例 #13
0
ファイル: openstack.py プロジェクト: Zipfer/fuel-web
    def remove_repos(self):
        logger.info('Removing repositories...')

        sources = glob.glob(self.config.openstack['repos']['src'])
        for source in sources:
            destination = os.path.join(
                self.config.openstack['repos']['dst'],
                os.path.basename(source))
            utils.remove(destination)
コード例 #14
0
ファイル: actions.py プロジェクト: andrei4ka/fuel-web
    def undo(self):
        # destination should be a path/to/file in case source was a file
        destination = self._to
        if not os.path.isdir(self._from) and os.path.isdir(self._to):
            basename = os.path.basename(self._from)
            destination = os.path.join(self._to, basename)

        # do nothing if destination doesn't exist
        remove(destination, ignore_errors=True)
コード例 #15
0
ファイル: openstack.py プロジェクト: isuzdal/fuel-upgrade
    def remove_versions(self):
        """Copy openstack release versions"""
        logger.info('Copy openstack release versions...')
        release_versions_cfg = self.config.openstack['release_versions']
        versions = glob.glob(release_versions_cfg['src'])

        for version_file in versions:
            dst = os.path.join(
                release_versions_cfg['dst'],
                os.path.basename(version_file))
            utils.remove(dst)
コード例 #16
0
ファイル: openstack.py プロジェクト: koder-ua/nailgun-fcert
    def remove_versions(self):
        """Copy openstack release versions
        """
        logger.info('Copy openstack release versions...')
        release_versions_cfg = self.config.openstack['release_versions']
        versions = glob.glob(release_versions_cfg['src'])

        for version_file in versions:
            dst = os.path.join(release_versions_cfg['dst'],
                               os.path.basename(version_file))
            utils.remove(dst)
コード例 #17
0
 def test_remove_dir(self, remove_mock, _, __):
     utils.remove('path')
     remove_mock.assert_called_once_with('path', ignore_errors=True)
コード例 #18
0
 def test_remove_file_does_not_exist(self, remove_mock, _, __):
     utils.remove('path')
     self.method_was_not_called(remove_mock)
コード例 #19
0
 def test_remove_link_to_dir(self, remove_mock, _, __, ___):
     utils.remove('path')
     remove_mock.assert_called_once_with('path')
コード例 #20
0
 def test_remove_file(self, remove_mock, _, __):
     utils.remove('path')
     remove_mock.assert_called_once_with('path')
コード例 #21
0
ファイル: test_utils.py プロジェクト: koder-ua/nailgun-fcert
 def test_remove_dir(self, remove_mock, _, __):
     utils.remove('path')
     remove_mock.assert_called_once_with('path', ignore_errors=True)
コード例 #22
0
ファイル: test_utils.py プロジェクト: koder-ua/nailgun-fcert
 def test_remove_link_to_dir(self, remove_mock, _, __, ___):
     utils.remove('path')
     remove_mock.assert_called_once_with('path')
コード例 #23
0
ファイル: test_utils.py プロジェクト: koder-ua/nailgun-fcert
 def test_remove_file(self, remove_mock, _, __):
     utils.remove('path')
     remove_mock.assert_called_once_with('path')
コード例 #24
0
ファイル: actions.py プロジェクト: andrei4ka/fuel-web
 def undo(self):
     remove(self._to)
コード例 #25
0
ファイル: supervisor_client.py プロジェクト: SergK/fuel-web
 def remove_new_configs(self):
     """Remove new version of configs from the filesystem.
     """
     utils.remove(self.supervisor_config_dir)
コード例 #26
0
ファイル: test_utils.py プロジェクト: koder-ua/nailgun-fcert
 def test_remove_file_does_not_exist(self, remove_mock, _, __):
     utils.remove('path')
     self.method_was_not_called(remove_mock)
コード例 #27
0
 def remove_new_configs(self):
     """Remove new version of configs from the filesystem.
     """
     utils.remove(self.supervisor_config_dir)