From afef2f68f32a07854d92cd331f474b7e5a32ad48 Mon Sep 17 00:00:00 2001 From: Luciano Lo Giudice Date: Mon, 6 Dec 2021 19:34:23 -0300 Subject: [PATCH] Modify the keys used for package installation in cinder plugins This patchset changes the keys used for package installation in the model config. The keys used are now 'driver-key' and 'driver-source', much like what the reactive cinder classes did. Change-Id: I8736717d3856afba1bc3f7eb9f2de21643006c25 --- ops_openstack/plugins/classes.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ops_openstack/plugins/classes.py b/ops_openstack/plugins/classes.py index 09d9176..c73f8fa 100644 --- a/ops_openstack/plugins/classes.py +++ b/ops_openstack/plugins/classes.py @@ -15,6 +15,11 @@ import json import ops_openstack.core +from charmhelpers.fetch import ( + apt_install, + apt_update, + add_source +) # ch_context needed for bluestore validation import charmhelpers.contrib.openstack.context as ch_context from ops.model import ( @@ -90,6 +95,14 @@ class CinderStoragePluginCharm(ops_openstack.core.OSBaseCharm): self.set_data(relation.data[self.unit], config, app_name) self.unit.status = ActiveStatus('Unit is ready') + def on_install(self, _): + source = self.model.config.get('driver-source') + if source: + add_source(source, self.model.config.get('driver-key')) + apt_update(fatal=True) + apt_install(self.PACKAGES, fatal=True) + self.update_status() + def on_storage_backend(self, event): self.set_data( event.relation.data[self.unit],