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:
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -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
|
||||
|
@@ -12,6 +12,7 @@ tags:
|
||||
series:
|
||||
- focal
|
||||
subordinate: false
|
||||
min-juju-version: 2.7.6
|
||||
extra-bindings:
|
||||
public:
|
||||
cluster:
|
||||
|
Submodule mod/ops-openstack updated: 58c9f3093e...18b8f1fcfe
11
src/charm.py
11
src/charm.py
@@ -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))
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user