def test_normversion(self): cases = [ # (input, output) ('6', '6.0.0'), ('6.0', '6.0.0'), ('6.1', '6.1.0'), ('6.1.0', '6.1.0'), ('6.1.1', '6.1.1'), ('6.1.1.1', '6.1.1.1'), ] for input_, output in cases: self.assertEqual(utils.normversion(input_), output)
def get_host_system(update_path, new_version): """Returns host-system settings. The function was designed to build a dictionary with settings for host-sytem upgrader. Why we can't just use static settings? Because we need to build paths to latest centos repos (tarball could contain a few openstack releases, so we need to pick right centos repo) and to latest puppet manifests. :param update_path: path to update folder :param new_version: fuel version to install :returns: a host-system upgrade settings """ openstack_versions = glob.glob( join(update_path, 'repos', '[0-9.-]*{0}'.format(new_version))) openstack_versions = [basename(v) for v in openstack_versions] openstack_version = sorted(openstack_versions, reverse=True)[0] return { 'install_packages': [ 'fuel-{0}'.format(normversion(new_version)), ], 'manifest_path': join( '/etc/puppet', openstack_version, 'modules/nailgun/examples/host-upgrade.pp'), 'puppet_modules_path': join( '/etc/puppet', openstack_version, 'modules'), 'repo_config_path': join( '/etc/yum.repos.d', '{0}_nailgun.repo'.format(new_version)), 'repo_aux_config_path': '/etc/yum.repos.d/auxiliary.repo', 'repos': { 'src': join(update_path, 'repos', '[0-9.-]*'), 'dst': join('/var', 'www', 'nailgun')}, 'repo_master': join( 'file:/var/www/nailgun', openstack_version, 'centos/x86_64'), }
def get_host_system(update_path, new_version): """Returns host-system settings. The function was designed to build a dictionary with settings for host-sytem upgrader. Why we can't just use static settings? Because we need to build paths to latest centos repos (tarball could contain a few openstack releases, so we need to pick right centos repo) and to latest puppet manifests. :param update_path: path to update folder :param new_version: fuel version to install :returns: a host-system upgrade settings """ openstack_versions = glob.glob( join(update_path, 'repos', '[0-9.-]*{0}'.format(new_version))) openstack_versions = [basename(v) for v in openstack_versions] openstack_version = sorted(openstack_versions, reverse=True)[0] centos_repo_path = join( update_path, 'repos', openstack_version, 'centos/x86_64') return { 'install_packages': [ 'fuel-release-{0}'.format(normversion(new_version)), ], 'manifest_path': join( '/etc/puppet', openstack_version, 'modules/nailgun/examples/host-upgrade.pp'), 'puppet_modules_path': join( '/etc/puppet', openstack_version, 'modules'), 'repo_config_path': join( '/etc/yum.repos.d', '{0}_nailgun.repo'.format(new_version)), 'repo_path': { 'src': centos_repo_path, 'dst': join( '/var/www/nailgun', openstack_version, 'centos/x86_64')}}