Resynced helpers

This commit is contained in:
James Page
2014-03-25 17:04:58 +00:00
parent d5b768bb9f
commit 5cc5a53ccb
4 changed files with 27 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
branch: lp:~openstack-charmers/charm-helpers/icehouse branch: lp:charm-helpers
destination: hooks/charmhelpers destination: hooks/charmhelpers
include: include:
- core - core

View File

@@ -199,6 +199,7 @@ class AMQPContext(OSContextGenerator):
ctxt = {} ctxt = {}
for rid in relation_ids('amqp'): for rid in relation_ids('amqp'):
ha_vip_only = False
for unit in related_units(rid): for unit in related_units(rid):
if relation_get('clustered', rid=rid, unit=unit): if relation_get('clustered', rid=rid, unit=unit):
ctxt['clustered'] = True ctxt['clustered'] = True
@@ -213,16 +214,18 @@ class AMQPContext(OSContextGenerator):
unit=unit), unit=unit),
'rabbitmq_virtual_host': vhost, 'rabbitmq_virtual_host': vhost,
}) })
if relation_get('ha_queues', rid=rid, unit=unit) is not None:
ctxt['rabbitmq_ha_queues'] = True
ha_vip_only = relation_get('ha-vip-only',
rid=rid, unit=unit) is not None
if context_complete(ctxt): if context_complete(ctxt):
# Sufficient information found = break out! # Sufficient information found = break out!
break break
# Used for active/active rabbitmq >= grizzly # Used for active/active rabbitmq >= grizzly
if ('clustered' not in ctxt or relation_get('ha-vip-only') == 'True') and \ if ('clustered' not in ctxt or ha_vip_only) \
len(related_units(rid)) > 1: and len(related_units(rid)) > 1:
if relation_get('ha_queues'):
ctxt['rabbitmq_ha_queues'] = relation_get('ha_queues')
else:
ctxt['rabbitmq_ha_queues'] = False
rabbitmq_hosts = [] rabbitmq_hosts = []
for unit in related_units(rid): for unit in related_units(rid):
rabbitmq_hosts.append(relation_get('private-address', rabbitmq_hosts.append(relation_get('private-address',

View File

@@ -3,8 +3,8 @@
# cinder configuration file maintained by Juju # cinder configuration file maintained by Juju
# local changes may be overwritten. # local changes may be overwritten.
############################################################################### ###############################################################################
{% if auth -%}
[global] [global]
{% if auth -%}
auth_supported = {{ auth }} auth_supported = {{ auth }}
keyring = /etc/ceph/$cluster.$name.keyring keyring = /etc/ceph/$cluster.$name.keyring
mon host = {{ mon_hosts }} mon host = {{ mon_hosts }}
@@ -12,3 +12,4 @@
log to syslog = {{ use_syslog }} log to syslog = {{ use_syslog }}
err to syslog = {{ use_syslog }} err to syslog = {{ use_syslog }}
clog to syslog = {{ use_syslog }} clog to syslog = {{ use_syslog }}

View File

@@ -423,9 +423,7 @@ def get_hostname(address, fqdn=True):
Resolves hostname for given IP, or returns the input Resolves hostname for given IP, or returns the input
if it is already a hostname. if it is already a hostname.
""" """
if not is_ip(address): if is_ip(address):
return address
try: try:
import dns.reversename import dns.reversename
except ImportError: except ImportError:
@@ -436,6 +434,8 @@ def get_hostname(address, fqdn=True):
result = ns_query(rev) result = ns_query(rev)
if not result: if not result:
return None return None
else:
result = address
if fqdn: if fqdn:
# strip trailing . # strip trailing .