Install from pip
This commit is contained in:
parent
4719a5eda4
commit
45d18248f1
|
@ -1,18 +1,5 @@
|
||||||
options:
|
options:
|
||||||
install-source:
|
pip-requirement-line:
|
||||||
type: string
|
type: string
|
||||||
default: "deb-resource"
|
default: "networking-generic-switch==0.4.0"
|
||||||
description: |
|
description: Pip requirement line.
|
||||||
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
|
|
||||||
default: "networking-generic-switch"
|
|
||||||
description: Debian package name. For installation with "deb" install source.
|
|
||||||
|
|
|
@ -11,10 +11,12 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
import shutil
|
||||||
|
|
||||||
import charms_openstack.adapters
|
import charms_openstack.adapters
|
||||||
import charms_openstack.charm
|
import charms_openstack.charm
|
||||||
import charmhelpers.contrib.openstack.utils as ch_utils
|
import charmhelpers.contrib.openstack.utils as ch_utils
|
||||||
|
from charmhelpers.contrib.python.packages import pip_install
|
||||||
from charmhelpers.core import hookenv
|
from charmhelpers.core import hookenv
|
||||||
from charmhelpers.core.hookenv import config
|
from charmhelpers.core.hookenv import config
|
||||||
|
|
||||||
|
@ -52,22 +54,17 @@ class NewtonNeutronAPIGenericSwitchCharm(charms_openstack.charm.OpenStackCharm):
|
||||||
restart_map = {ML2_CONF: []}
|
restart_map = {ML2_CONF: []}
|
||||||
adapters_class = charms_openstack.adapters.OpenStackRelationAdapters
|
adapters_class = charms_openstack.adapters.OpenStackRelationAdapters
|
||||||
|
|
||||||
# Custom configure for the class
|
genericswitch_config = '/etc/neutron/plugins/ml2/ml2_conf_genericswitch.ini'
|
||||||
# NOTE: LBaaS v2 for >= newton
|
|
||||||
service_plugins = ('router,firewall,vpnaas,metering,'
|
service_plugins = ('router,firewall,vpnaas,metering,'
|
||||||
'neutron_lbaas.services.loadbalancer.'
|
'neutron_lbaas.services.loadbalancer.'
|
||||||
'plugin.LoadBalancerPluginv2')
|
'plugin.LoadBalancerPluginv2')
|
||||||
|
|
||||||
def install(self):
|
def install(self):
|
||||||
# TODO(mmitchell): support modes other than deb-resource.
|
config_path = hookenv.resource_get('genericswitch-ml2-config')
|
||||||
if config('install-source') == 'deb-resource':
|
shutil.copy(config_path, self.genericswitch_config)
|
||||||
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]
|
|
||||||
|
|
||||||
|
pip_install(config('pip-requirement-line'))
|
||||||
super().install()
|
super().install()
|
||||||
|
|
||||||
def configure_plugin(self, api_principle):
|
def configure_plugin(self, api_principle):
|
||||||
|
|
|
@ -27,7 +27,7 @@ requires:
|
||||||
interface: juju-info
|
interface: juju-info
|
||||||
scope: container
|
scope: container
|
||||||
resources:
|
resources:
|
||||||
package:
|
genericswitch-ml2-config:
|
||||||
type: file
|
type: file
|
||||||
filename: neutron-api-genericswitch.deb
|
filename: ml2_conf_genericswitch.ini
|
||||||
description: Packaged version of the networking-generic-switch python package
|
description: Configuration file for generic switch devices.
|
||||||
|
|
Loading…
Reference in New Issue