From 8fe19c4a3da25605ae5b70e8a83d516a0f9ec612 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Wed, 13 Jul 2016 13:43:53 +0000 Subject: [PATCH] Put charm into its own venv This adds the venv option to the layer configuration and removes the custom install hook as it's no longer needed. --- src/hooks/install | 25 ------------------------- src/hooks/install.real | 19 ------------------- src/layer.yaml | 4 ++++ 3 files changed, 4 insertions(+), 44 deletions(-) delete mode 100755 src/hooks/install delete mode 100755 src/hooks/install.real diff --git a/src/hooks/install b/src/hooks/install deleted file mode 100755 index b0771bf..0000000 --- a/src/hooks/install +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# Wrapper to deal with newer Ubuntu versions that don't have py2 installed -# by default. - -check_and_install() { - pkg="${1}" - if ! dpkg -s ${pkg} 2>&1 > /dev/null; then - apt-get -y install ${pkg} - fi -} -status-set maintenance "Install hook running" - -juju-log "Installing tox" -check_and_install 'tox' - -declare -a DEPS=('libssl-dev' 'libffi-dev' 'apt' 'python3-netaddr' 'python3-netifaces' 'python3-pip' 'python3-yaml' 'python-cinderclient' 'python-glanceclient' 'python-heatclient' 'python-keystoneclient' 'python-neutronclient' 'python-novaclient' 'python-swiftclient' 'python-ceilometerclient' 'openvswitch-test' 'python3-cinderclient' 'python3-glanceclient' 'python3-heatclient' 'python3-keystoneclient' 'python3-neutronclient' 'python3-novaclient' 'python3-swiftclient' 'python3-ceilometerclient') - - -PYTHON="python" - -for dep in ${DEPS[@]}; do - check_and_install ${dep} -done - -exec ./hooks/install.real diff --git a/src/hooks/install.real b/src/hooks/install.real deleted file mode 100755 index d36afe1..0000000 --- a/src/hooks/install.real +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env python3 - -# Load modules from $CHARM_DIR/lib -import sys -sys.path.append('lib') - -from charms.layer import basic -basic.bootstrap_charm_deps() -basic.init_config_states() - - -# This will load and run the appropriate @hook and other decorated -# handlers from $CHARM_DIR/reactive, $CHARM_DIR/hooks/reactive, -# and $CHARM_DIR/hooks/relations. -# -# See https://jujucharms.com/docs/stable/authors-charm-building -# for more information on this pattern. -from charms.reactive import main -main() diff --git a/src/layer.yaml b/src/layer.yaml index 2b5c10f..38ca019 100644 --- a/src/layer.yaml +++ b/src/layer.yaml @@ -4,4 +4,8 @@ includes: - interface:rabbitmq - interface:keystone - interface:barbican-hsm-plugin +options: + basic: + use_venv: True + include_system_packages: True repo: git@github.com:openstack-charmers/charm-barbican.git