charm-helpers sync
Synchronize charm-helpers to get service token related patches. Change-Id: I999900d6e68ceef901b8d34e54d32fa06e849f72 Related-Bug: #1992840
This commit is contained in:
@@ -221,6 +221,13 @@ def https():
|
||||
return True
|
||||
if config_get('ssl_cert') and config_get('ssl_key'):
|
||||
return True
|
||||
# Local import to avoid ciruclar dependency.
|
||||
import charmhelpers.contrib.openstack.cert_utils as cert_utils
|
||||
if (
|
||||
cert_utils.get_certificate_request() and not
|
||||
cert_utils.get_requests_for_local_unit("certificates")
|
||||
):
|
||||
return False
|
||||
for r_id in relation_ids('certificates'):
|
||||
for unit in relation_list(r_id):
|
||||
ca = relation_get('ca', rid=r_id, unit=unit)
|
||||
|
||||
@@ -409,6 +409,9 @@ def get_requests_for_local_unit(relation_name=None):
|
||||
relation_name = relation_name or 'certificates'
|
||||
bundles = []
|
||||
for rid in relation_ids(relation_name):
|
||||
sent = relation_get(rid=rid, unit=local_unit())
|
||||
legacy_keys = ['certificate_name', 'common_name']
|
||||
is_legacy_request = set(sent).intersection(legacy_keys)
|
||||
for unit in related_units(rid):
|
||||
data = relation_get(rid=rid, unit=unit)
|
||||
if data.get(raw_certs_key):
|
||||
@@ -416,6 +419,14 @@ def get_requests_for_local_unit(relation_name=None):
|
||||
'ca': data['ca'],
|
||||
'chain': data.get('chain'),
|
||||
'certs': json.loads(data[raw_certs_key])})
|
||||
elif is_legacy_request:
|
||||
bundles.append({
|
||||
'ca': data['ca'],
|
||||
'chain': data.get('chain'),
|
||||
'certs': {sent['common_name']:
|
||||
{'cert': data.get(local_name + '.server.cert'),
|
||||
'key': data.get(local_name + '.server.key')}}})
|
||||
|
||||
return bundles
|
||||
|
||||
|
||||
|
||||
@@ -500,6 +500,7 @@ class IdentityServiceContext(OSContextGenerator):
|
||||
int_host = format_ipv6_addr(int_host) or int_host
|
||||
svc_protocol = _resolve('service_protocol') or 'http'
|
||||
auth_protocol = _resolve('auth_protocol') or 'http'
|
||||
admin_role = _resolve('admin_role') or 'Admin'
|
||||
int_protocol = _resolve('internal_protocol') or 'http'
|
||||
api_version = _resolve('api_version') or '2.0'
|
||||
ctxt.update({'service_port': _resolve('service_port'),
|
||||
@@ -511,6 +512,7 @@ class IdentityServiceContext(OSContextGenerator):
|
||||
'admin_tenant_name': _resolve('service_tenant'),
|
||||
'admin_user': _resolve('service_username'),
|
||||
'admin_password': _resolve('service_password'),
|
||||
'admin_role': admin_role,
|
||||
'service_protocol': svc_protocol,
|
||||
'auth_protocol': auth_protocol,
|
||||
'internal_protocol': int_protocol,
|
||||
|
||||
@@ -12,4 +12,6 @@ signing_dir = {{ signing_dir }}
|
||||
{% if service_type -%}
|
||||
service_type = {{ service_type }}
|
||||
{% endif -%}
|
||||
service_token_roles = {{ admin_role }}
|
||||
service_token_roles_required = True
|
||||
{% endif -%}
|
||||
|
||||
@@ -22,4 +22,6 @@ signing_dir = {{ signing_dir }}
|
||||
{% if use_memcache == true %}
|
||||
memcached_servers = {{ memcache_url }}
|
||||
{% endif -%}
|
||||
service_token_roles = {{ admin_role }}
|
||||
service_token_roles_required = True
|
||||
{% endif -%}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{% if auth_host -%}
|
||||
[service_user]
|
||||
send_service_user_token = true
|
||||
auth_type = password
|
||||
auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}
|
||||
project_domain_id = default
|
||||
user_domain_id = default
|
||||
project_name = {{ admin_tenant_name }}
|
||||
username = {{ admin_user }}
|
||||
password = {{ admin_password }}
|
||||
{% endif -%}
|
||||
Reference in New Issue
Block a user