diff --git a/config.yaml b/config.yaml index a08da95..8b2e69c 100644 --- a/config.yaml +++ b/config.yaml @@ -25,3 +25,13 @@ options: default: null type: string description: Provide the respective keys of the install sources + plumgrid-build: + default: 'latest' + type: string + description: | + Provide the build version of PLUMgrid packages that needs to be installed + iovisor-build: + default: 'latest' + type: string + description: | + Provide the build version of iovisor package that needs to be installed diff --git a/hooks/charmhelpers/contrib/openstack/neutron.py b/hooks/charmhelpers/contrib/openstack/neutron.py index 91ce1e2..c43d857 100644 --- a/hooks/charmhelpers/contrib/openstack/neutron.py +++ b/hooks/charmhelpers/contrib/openstack/neutron.py @@ -204,8 +204,8 @@ def neutron_plugins(): database=config('database'), ssl_dir=NEUTRON_CONF_DIR)], 'services': [], - 'packages': [['plumgrid-lxc'], - ['iovisor-dkms']], + 'packages': ['plumgrid-lxc', + 'iovisor-dkms'], 'server_packages': ['neutron-server', 'neutron-plugin-plumgrid'], 'server_services': ['neutron-server'] diff --git a/hooks/pg_gw_utils.py b/hooks/pg_gw_utils.py index 667e6a9..302d913 100644 --- a/hooks/pg_gw_utils.py +++ b/hooks/pg_gw_utils.py @@ -19,6 +19,9 @@ from charmhelpers.core.host import ( service_start, service_stop, ) +from charmhelpers.fetch import ( + apt_cache +) from charmhelpers.contrib.storage.linux.ceph import modprobe from charmhelpers.core.host import set_nic_mtu from charmhelpers.contrib.openstack import templating @@ -71,7 +74,25 @@ def determine_packages(): Returns list of packages required by PLUMgrid Gateway as specified in the neutron_plugins dictionary in charmhelpers. ''' - return neutron_plugin_attribute('plumgrid', 'packages', 'neutron') + pkgs = [] + tag = 'latest' + for pkg in neutron_plugin_attribute('plumgrid', 'packages', 'neutron'): + if 'plumgrid' in pkg: + tag = config('plumgrid-build') + elif pkg == 'iovisor-dkms': + tag = config('iovisor-build') + + if tag == 'latest': + pkgs.append(pkg) + else: + if tag in [i.ver_str for i in apt_cache()[pkg].version_list]: + pkgs.append('%s=%s' % (pkg, tag)) + else: + error_msg = \ + "Build version '%s' for package '%s' not available" \ + % (tag, pkg) + raise ValueError(error_msg) + return pkgs def register_configs(release=None):