Install package passed in via resource

This commit is contained in:
Mathieu Mitchell 2017-11-13 19:44:26 -05:00
parent 0d1751b518
commit 4719a5eda4
3 changed files with 34 additions and 22 deletions

View File

@ -1,21 +1,18 @@
options:
vlan-ranges:
install-source:
type: string
default: "physnet1:1000:2000"
default: "deb-resource"
description: |
Space-delimited list of Neutron network-provider & vlan-id-ranges using
the following format "<provider>:<start>:<end> ...".
overlay-network-type:
default: gre
Installation source for package. Valid options are:
.
deb-resource
deb
pip
.
deb-resource means the debian package as a provided resource.
deb is package provided by an official (or preconfigured) repository.
pip is installation directly from pip.
deb-package-name:
type: string
description: |
Overlay network types to use, valid options include:
.
gre
vxlan
.
Multiple types can be provided - field is space delimited.
security-groups:
default: false
type: boolean
description: Enable OpenDayLight managed security groups.
default: "networking-generic-switch"
description: Debian package name. For installation with "deb" install source.

View File

@ -15,7 +15,8 @@
import charms_openstack.adapters
import charms_openstack.charm
import charmhelpers.contrib.openstack.utils as ch_utils
from charmhelpers.core import hookenv
from charmhelpers.core.hookenv import config
ML2_CONF = '/etc/neutron/plugins/ml2/ml2_conf.ini'
VLAN = 'vlan'
@ -45,10 +46,7 @@ class NewtonNeutronAPIGenericSwitchCharm(charms_openstack.charm.OpenStackCharm):
release = 'newton'
packages = ['neutron-common',
'neutron-plugin-ml2',
'nginx-light',
]
packages = []
required_relations = ['neutron-plugin-api-subordinate']
restart_map = {ML2_CONF: []}
@ -60,6 +58,18 @@ class NewtonNeutronAPIGenericSwitchCharm(charms_openstack.charm.OpenStackCharm):
'neutron_lbaas.services.loadbalancer.'
'plugin.LoadBalancerPluginv2')
def install(self):
# TODO(mmitchell): support modes other than deb-resource.
if config('install-source') == 'deb-resource':
hookenv.log('Installing deb from resource file.')
package_path = hookenv.resource_get(name='package')
# NOTE(mmitchell): This puts the full package path as a package to install.
# Should be enough to get to the point where apt will install it.
self.packages = [package_path]
super().install()
def configure_plugin(self, api_principle):
"""Add sections and tuples to insert values into neutron-server's
neutron.conf

View File

@ -26,3 +26,8 @@ requires:
container:
interface: juju-info
scope: container
resources:
package:
type: file
filename: neutron-api-genericswitch.deb
description: Packaged version of the networking-generic-switch python package