diff --git a/config.yaml b/config.yaml index ba04c0b..cb62ff5 100644 --- a/config.yaml +++ b/config.yaml @@ -16,3 +16,8 @@ options: type: string description: | Provide the build version of PLUMgrid packages that needs to be installed + networking-plumgrid-version: + default: null + type: string + description: | + Provide the version of networking-plumgrid package that needs to be installed diff --git a/hooks/neutron_plumgrid_utils.py b/hooks/neutron_plumgrid_utils.py index d10d8f8..78b82fb 100644 --- a/hooks/neutron_plumgrid_utils.py +++ b/hooks/neutron_plumgrid_utils.py @@ -42,6 +42,11 @@ BASE_RESOURCE_MAP = OrderedDict([ }), ]) +NETWORKING_PLUMGRID_VERSION = OrderedDict([ + ('kilo', '2015.1.1.1'), + ('liberty', '2015.2.1.1'), +]) + def determine_packages(): ''' @@ -104,5 +109,18 @@ def ensure_files(): ''' Ensures PLUMgrid specific files exist before templates are written. ''' - pip_install('networking-plumgrid', fatal=True) + install_networking_plumgrid() os.chmod('/etc/sudoers.d/neutron_sudoers', 0o440) + + +def install_networking_plumgrid(): + ''' + Installs networking-plumgrid package + ''' + release = os_release('neutron-server', base='kilo') + if config('networking-plumgrid-version') is None: + package_version = NETWORKING_PLUMGRID_VERSION[release] + else: + package_version = config('networking-plumgrid-version') + package_name = 'networking-plumgrid==%s' % package_version + pip_install(package_name, fatal=True)