107
109
"clustered=%s)" % (net_type, clustered))
109
111
return resolved_address
114
def endpoint_url(configs, url_template, port, endpoint_type=PUBLIC,
116
"""Returns the correct endpoint URL to advertise to Keystone.
118
This method provides the correct endpoint URL which should be advertised to
119
the keystone charm for endpoint creation. This method allows for the url to
120
be overridden to force a keystone endpoint to have specific URL for any of
121
the defined scopes (admin, internal, public).
123
:param configs: OSTemplateRenderer config templating object to inspect
124
for a complete https context.
125
:param url_template: str format string for creating the url template. Only
126
two values will be passed - the scheme+hostname
127
returned by the canonical_url and the port.
128
:param endpoint_type: str endpoint type to resolve.
129
:param override: str the name of the config option which overrides the
130
endpoint URL defined by the charm itself. None will
131
disable any overrides (default).
134
# Return any user-defined overrides for the keystone endpoint URL.
135
user_value = config(override)
137
return user_value.strip()
139
return url_template % (canonical_url(configs, endpoint_type), port)
142
public_endpoint = partial(endpoint_url, endpoint_type=PUBLIC)
144
internal_endpoint = partial(endpoint_url, endpoint_type=INTERNAL)
146
admin_endpoint = partial(endpoint_url, endpoint_type=ADMIN)