get last deps corect
This commit is contained in:
parent
a17361c7fd
commit
47a802fbde
@ -41,6 +41,8 @@ from charmhelpers.core.hookenv import (
|
|||||||
relation_ids,
|
relation_ids,
|
||||||
related_units,
|
related_units,
|
||||||
relation_get,
|
relation_get,
|
||||||
|
local_unit,
|
||||||
|
network_get_primary_address,
|
||||||
)
|
)
|
||||||
from charmhelpers.fetch import (
|
from charmhelpers.fetch import (
|
||||||
apt_cache,
|
apt_cache,
|
||||||
@ -123,9 +125,35 @@ def get_host_ip(hostname=None):
|
|||||||
return answers[0].address
|
return answers[0].address
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@cached
|
||||||
|
def get_public_addr():
|
||||||
|
if config('ceph-public-network'):
|
||||||
|
return get_network_addrs('ceph-public-network')[0]
|
||||||
|
|
||||||
|
try:
|
||||||
|
return network_get_primary_address('public')
|
||||||
|
except NotImplementedError:
|
||||||
|
log("network-get not supported", DEBUG)
|
||||||
|
|
||||||
|
return get_host_ip()
|
||||||
|
|
||||||
|
|
||||||
|
@cached
|
||||||
|
def get_cluster_addr():
|
||||||
|
if config('ceph-cluster-network'):
|
||||||
|
return get_network_addrs('ceph-cluster-network')[0]
|
||||||
|
|
||||||
|
try:
|
||||||
|
return network_get_primary_address('cluster')
|
||||||
|
except NotImplementedError:
|
||||||
|
log("network-get not supported", DEBUG)
|
||||||
|
|
||||||
|
return get_host_ip()
|
||||||
|
|
||||||
|
|
||||||
def get_networks(config_opt='ceph-public-network'):
|
def get_networks(config_opt='ceph-public-network'):
|
||||||
"""Get all configured networks from provided config option.
|
"""Get all configured networks from provided config option.
|
||||||
|
|
||||||
If public network(s) are provided, go through them and return those for
|
If public network(s) are provided, go through them and return those for
|
||||||
which we have an address configured.
|
which we have an address configured.
|
||||||
"""
|
"""
|
||||||
@ -137,13 +165,8 @@ def get_networks(config_opt='ceph-public-network'):
|
|||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
def get_public_addr():
|
|
||||||
return get_network_addrs('ceph-public-network')[0]
|
|
||||||
|
|
||||||
|
|
||||||
def get_network_addrs(config_opt):
|
def get_network_addrs(config_opt):
|
||||||
"""Get all configured public networks addresses.
|
"""Get all configured public networks addresses.
|
||||||
|
|
||||||
If public network(s) are provided, go through them and return the
|
If public network(s) are provided, go through them and return the
|
||||||
addresses we have configured on any of those networks.
|
addresses we have configured on any of those networks.
|
||||||
"""
|
"""
|
||||||
@ -173,6 +196,20 @@ def assert_charm_supports_ipv6():
|
|||||||
"versions less than Trusty 14.04")
|
"versions less than Trusty 14.04")
|
||||||
|
|
||||||
|
|
||||||
|
def get_peer_units():
|
||||||
|
"""
|
||||||
|
Returns a dictionary of unit names from the mon peer relation with
|
||||||
|
a flag indicating whether the unit has presented its address
|
||||||
|
"""
|
||||||
|
units = {}
|
||||||
|
units[local_unit()] = True
|
||||||
|
for relid in relation_ids('mon'):
|
||||||
|
for unit in related_units(relid):
|
||||||
|
addr = relation_get('ceph-public-address', unit, relid)
|
||||||
|
units[unit] = addr is not None
|
||||||
|
return units
|
||||||
|
|
||||||
|
|
||||||
LEADER = 'leader'
|
LEADER = 'leader'
|
||||||
PEON = 'peon'
|
PEON = 'peon'
|
||||||
QUORUM = [LEADER, PEON]
|
QUORUM = [LEADER, PEON]
|
||||||
|
@ -5,6 +5,7 @@ import charms.apt
|
|||||||
from charms.ceph_base import (
|
from charms.ceph_base import (
|
||||||
# get_networks,
|
# get_networks,
|
||||||
# get_public_addr,
|
# get_public_addr,
|
||||||
|
get_peer_units,
|
||||||
get_mon_hosts,
|
get_mon_hosts,
|
||||||
is_bootstrapped,
|
is_bootstrapped,
|
||||||
is_quorum,
|
is_quorum,
|
||||||
@ -28,11 +29,11 @@ from charmhelpers.core.hookenv import (
|
|||||||
|
|
||||||
from charmhelpers.core.sysctl import create as create_sysctl
|
from charmhelpers.core.sysctl import create as create_sysctl
|
||||||
|
|
||||||
# from charmhelpers.contrib.hardening.harden import harden
|
from charms_hardening.harden import harden
|
||||||
|
|
||||||
|
|
||||||
@when_not('ceph.installed')
|
@when_not('ceph.installed')
|
||||||
# @harden()
|
@harden()
|
||||||
def install_ceph_base():
|
def install_ceph_base():
|
||||||
charms.apt.add_source(config('source'), key=config('key'))
|
charms.apt.add_source(config('source'), key=config('key'))
|
||||||
charms.apt.queue_install(charms.ceph_base.PACKAGES)
|
charms.apt.queue_install(charms.ceph_base.PACKAGES)
|
||||||
@ -41,7 +42,7 @@ def install_ceph_base():
|
|||||||
|
|
||||||
|
|
||||||
@when('config.changed', 'ceph.installed')
|
@when('config.changed', 'ceph.installed')
|
||||||
# @harden()
|
@harden()
|
||||||
def config_changed():
|
def config_changed():
|
||||||
# # Check if an upgrade was requested
|
# # Check if an upgrade was requested
|
||||||
# check_for_upgrade()
|
# check_for_upgrade()
|
||||||
@ -124,20 +125,6 @@ def log_monitor():
|
|||||||
# reboot the ceph-mon process
|
# reboot the ceph-mon process
|
||||||
|
|
||||||
|
|
||||||
def get_peer_units():
|
|
||||||
"""
|
|
||||||
Returns a dictionary of unit names from the mon peer relation with
|
|
||||||
a flag indicating whether the unit has presented its address
|
|
||||||
"""
|
|
||||||
units = {}
|
|
||||||
units[local_unit()] = True
|
|
||||||
for relid in relation_ids('mon'):
|
|
||||||
for unit in related_units(relid):
|
|
||||||
addr = relation_get('ceph-public-address', unit, relid)
|
|
||||||
units[unit] = addr is not None
|
|
||||||
return units
|
|
||||||
|
|
||||||
|
|
||||||
def log_osds():
|
def log_osds():
|
||||||
if not is_state('ceph_mon.installed'):
|
if not is_state('ceph_mon.installed'):
|
||||||
# Check for mon relation
|
# Check for mon relation
|
||||||
|
@ -3,3 +3,5 @@ dnspython3
|
|||||||
#charms_storage
|
#charms_storage
|
||||||
#git+https://github.com/openstack-charmers/charms.storage.git#egg=charms.storage
|
#git+https://github.com/openstack-charmers/charms.storage.git#egg=charms.storage
|
||||||
git+https://github.com/chrismacnaughton/charms.storage.git#egg=charms.storage
|
git+https://github.com/chrismacnaughton/charms.storage.git#egg=charms.storage
|
||||||
|
#charms_hardening
|
||||||
|
git+https://github.com/ChrisMacNaughton/charms.hardening.git#egg=charms.hardening
|
Loading…
x
Reference in New Issue
Block a user