General fixes

* Specify minimum Juju version
* Stop cluster count block being overwritted on setup
* Fix cluster count in peer relation when relation is not ready
* Move location of ops-openstack to openstack-charmers
This commit is contained in:
Liam Young
2020-05-01 07:26:47 +00:00
parent 8e28648b0d
commit fdf5dec34c
5 changed files with 19 additions and 4 deletions

2
.gitmodules vendored
View File

@@ -6,7 +6,7 @@
url = https://github.com/gnuoy/oper-interface-ceph-client.git
[submodule "mod/ops-openstack"]
path = mod/ops-openstack
url = https://github.com/gnuoy/ops-openstack.git
url = https://github.com/openstack-charmers/ops-openstack.git
[submodule "mod/charm-helpers"]
path = mod/charm-helpers
url = https://github.com/juju/charm-helpers.git

View File

@@ -12,6 +12,7 @@ tags:
series:
- focal
subordinate: false
min-juju-version: 2.7.6
extra-bindings:
public:
cluster:

View File

@@ -131,6 +131,13 @@ class CephISCSIGatewayCharmBase(ops_openstack.OSBaseCharm):
self.framework.observe(self.on.config_changed, self)
self.framework.observe(self.on.upgrade_charm, self)
def on_install(self, event):
if ch_host.is_container():
logging.info("Installing into a container is not supported")
self.update_status()
else:
self.install_pkgs()
def on_add_trusted_ip_action(self, event):
self.state.additional_trusted_ips.append(
event.params['ips'].split(' '))
@@ -296,6 +303,10 @@ class CephISCSIGatewayCharmBase(ops_openstack.OSBaseCharm):
self.on_pools_available(event)
def custom_status_check(self):
if ch_host.is_container():
self.unit.status = ops.model.BlockedStatus(
'Charm cannot be deployed into a container')
return False
if self.peers.unit_count not in self.ALLOWED_UNIT_COUNTS:
self.unit.status = ops.model.BlockedStatus(
'{} is an invalid unit count'.format(self.peers.unit_count))

View File

@@ -102,8 +102,11 @@ class CephISCSIGatewayPeers(Object):
@property
def peer_count(self):
return len(self.peer_rel.units)
if self.peer_rel:
return len(self.peer_rel.units)
else:
return 0
@property
def unit_count(self):
return len(self.peer_rel.units) + 1
return self.peer_count + 1