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