コード例 #1
0
    def check_if_required(self):
        # not required if fuel is already higher than 6.1
        if compare_version('6.1', self.config.from_version) > 0:
            return False

        # not required if container is in privileged mode already
        container = json.loads('\n'.join(
            exec_cmd_iterator('docker inspect {0}'.format(self._container))))
        if container[0].get('HostConfig', {}).get('Privileged'):
            return False

        # not required if docker is already higher than 0.11
        output = '\n'.join(exec_cmd_iterator('docker --version'))
        match = self._docker_version.match(output)
        if match:
            version = match.group(1)
            return compare_version('0.11.0', version) < 0
        return False
    def check_if_required(self):
        # not required if fuel is already higher than 6.1
        if compare_version('6.1', self.config.from_version) > 0:
            return False

        # not required if container is in privileged mode already
        container = json.loads('\n'.join(
            exec_cmd_iterator('docker inspect {0}'.format(self._container))))
        if container[0].get('HostConfig', {}).get('Privileged'):
            return False

        # not required if docker is already higher than 0.11
        output = '\n'.join(exec_cmd_iterator('docker --version'))
        match = self._docker_version.match(output)
        if match:
            version = match.group(1)
            return compare_version('0.11.0', version) < 0
        return False
コード例 #3
0
ファイル: host_system.py プロジェクト: kansuke4649/fuel-web
    def remove_repo_config(self):
        """Remove yum repository config
        """
        utils.remove_if_exists(self.repo_config_path)

        # One more damn hack! We have to remove auxiliary repo config
        # if we're rollbacking to the Fuel version that doesn't have
        # auxiliary repo at all.
        if utils.compare_version(self.config.from_version, '6.1') > 0:
            utils.remove_if_exists(
                self.host_system_config['repo_aux_config_path'])
コード例 #4
0
ファイル: host_system.py プロジェクト: nebril/fuel-web
    def remove_repo_config(self):
        """Remove yum repository config
        """
        utils.remove_if_exists(self.repo_config_path)

        # One more damn hack! We have to remove auxiliary repo config
        # if we're rollbacking to the Fuel version that doesn't have
        # auxiliary repo at all.
        if utils.compare_version(self.config.from_version, '6.1') > 0:
            utils.remove_if_exists(
                self.host_system_config['repo_aux_config_path'])
コード例 #5
0
    def check(self):
        """Compares two versions previous and new

        :raises: WrongVersionError
        """
        logger.info('Check upgrade versions')

        result = utils.compare_version(self.from_version, self.to_version)
        err_msg = None
        if result == 0:
            err_msg = 'Cannot upgrade to the same version of fuel ' \
                      '{0} -> {1}'.format(
                          self.from_version, self.to_version)
        elif result == -1:
            err_msg = 'Cannot upgrade from higher version of fuel ' \
                      'to lower {0} -> {1}'.format(
                          self.from_version, self.to_version)

        if err_msg:
            raise errors.WrongVersionError(err_msg)
コード例 #6
0
    def check(self):
        """Compares two versions previous and new

        :raises: WrongVersionError
        """
        logger.info('Check upgrade versions')

        result = utils.compare_version(self.from_version, self.to_version)
        err_msg = None
        if result == 0:
            err_msg = 'Cannot upgrade to the same version of fuel ' \
                      '{0} -> {1}'.format(
                          self.from_version, self.to_version)
        elif result == -1:
            err_msg = 'Cannot upgrade from higher version of fuel ' \
                      'to lower {0} -> {1}'.format(
                          self.from_version, self.to_version)

        if err_msg:
            raise errors.WrongVersionError(err_msg)
コード例 #7
0
ファイル: host_system.py プロジェクト: isuzdal/fuel-upgrade
    def remove_repo_config(self):
        """Remove yum repository config"""
        utils.remove_if_exists(self.repo_config_path)

        # One more damn hack! We have to remove auxiliary repo config
        # if we're rollbacking to the Fuel version that doesn't have
        # auxiliary repo at all.
        if utils.compare_version(self.config.from_version, '6.1') > 0:
            utils.remove_if_exists(
                self.host_system_config['repo_aux_config_path'])
        else:
            # By some pity reason we're managing auxiliary repo in puppet
            # manifests, but there's no management code for rollbacking.
            # Therefore, we need to clean-up its artifacts in case of
            # upgrade rollback procedure here; otherwise another try
            # of upgrade will fail.
            path, name = os.path.split(
                self.host_system_config['repo_aux_config_path'])
            utils.remove_if_exists(os.path.join(path, '{0}_{1}'.format(
                self.config.new_version,
                name)))
コード例 #8
0
ファイル: host_system.py プロジェクト: SergK/fuel-web
    def remove_repo_config(self):
        """Remove yum repository config
        """
        utils.remove_if_exists(self.repo_config_path)

        # One more damn hack! We have to remove auxiliary repo config
        # if we're rollbacking to the Fuel version that doesn't have
        # auxiliary repo at all.
        if utils.compare_version(self.config.from_version, '6.1') > 0:
            utils.remove_if_exists(
                self.host_system_config['repo_aux_config_path'])
        else:
            # By some pity reason we're managing auxiliary repo in puppet
            # manifests, but there's no management code for rollbacking.
            # Therefore, we need to clean-up its artifacts in case of
            # upgrade rollback procedure here; otherwise another try
            # of upgrade will fail.
            path, name = os.path.split(
                self.host_system_config['repo_aux_config_path'])
            utils.remove_if_exists(os.path.join(path, '{0}_{1}'.format(
                self.config.new_version,
                name)))
コード例 #9
0
 def test_compare_version(self):
     self.assertEqual(utils.compare_version('0.1', '0.2'), 1)
     self.assertEqual(utils.compare_version('0.1', '0.1.5'), 1)
     self.assertEqual(utils.compare_version('0.2', '0.1'), -1)
     self.assertEqual(utils.compare_version('0.2', '0.2'), 0)
コード例 #10
0
 def check_if_required(self):
     """The hack is required if we're going to upgrade from version < 6.1.
     """
     return utils.compare_version(self.config.from_version, '6.1') > 0
コード例 #11
0
ファイル: test_utils.py プロジェクト: koder-ua/nailgun-fcert
 def test_compare_version(self):
     self.assertEqual(utils.compare_version('0.1', '0.2'), 1)
     self.assertEqual(utils.compare_version('0.1', '0.1.5'), 1)
     self.assertEqual(utils.compare_version('0.2', '0.1'), -1)
     self.assertEqual(utils.compare_version('0.2', '0.2'), 0)
コード例 #12
0
 def check_if_required(self):
     # should be applied if from_version < 6.1
     return utils.compare_version(self.config.from_version, "6.1") > 0
コード例 #13
0
 def check_if_required(self):
     """The hack is required if we're going to upgrade from version < 6.1.
     """
     return utils.compare_version(self.config.from_version, '6.1') > 0
 def check_if_required(self):
     # not required if fuel is already higher than 6.1
     if utils.compare_version('6.1', self.config.from_version) >= 0:
         return False
     return True
コード例 #15
0
 def check_if_required(self):
     # not required if fuel is already higher than 6.1
     if utils.compare_version('6.1', self.config.from_version) >= 0:
         return False
     return True
コード例 #16
0
 def check_if_required(self):
     # should be applied if from_version < 6.1
     return utils.compare_version(self.config.from_version, '6.1') > 0