"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "barbican/common/utils.py" between
barbican-11.0.0.tar.gz and barbican-12.0.0.tar.gz

About: OpenStack Barbican is the OpenStack Key Manager service. It provides secure storage, provisioning and management of secret data.
The "Wallaby" series (latest release).

utils.py  (barbican-11.0.0):utils.py  (barbican-12.0.0)
skipping to change at line 85 skipping to change at line 85
p_url = parse.urlsplit(pecan.request.application_url) p_url = parse.urlsplit(pecan.request.application_url)
# Pecan does not handle X_FORWARDED_PROTO yet, so we need to # Pecan does not handle X_FORWARDED_PROTO yet, so we need to
# handle it ourselves. see lp#1445290 # handle it ourselves. see lp#1445290
scheme = pecan.request.environ.get('HTTP_X_FORWARDED_PROTO', 'http') scheme = pecan.request.environ.get('HTTP_X_FORWARDED_PROTO', 'http')
# Pecan does not handle url reconstruction according to # Pecan does not handle url reconstruction according to
# https://www.python.org/dev/peps/pep-0333/#url-reconstruction # https://www.python.org/dev/peps/pep-0333/#url-reconstruction
netloc = pecan.request.environ.get('HTTP_HOST', p_url.netloc) netloc = pecan.request.environ.get('HTTP_HOST', p_url.netloc)
# FIXME: implement SERVER_NAME lookup if HTTP_HOST is not set # FIXME: implement SERVER_NAME lookup if HTTP_HOST is not set
if p_url.path: if p_url.path:
# Remove the version from the path to extract the base path # Remove the version from the path to extract the base path
base_path = re.sub('/v[0-9\.]+$', '', p_url.path) base_path = re.sub(r'/v[0-9\.]+$', '', p_url.path)
base_url = '%s://%s%s' % (scheme, netloc, base_path) base_url = '%s://%s%s' % (scheme, netloc, base_path)
else: else:
base_url = '%s://%s' % (scheme, netloc) base_url = '%s://%s' % (scheme, netloc)
return base_url return base_url
else: # when host_href is set or flow is not within wsgi request context else: # when host_href is set or flow is not within wsgi request context
return CONF.host_href return CONF.host_href
def hostname_for_refs(resource=None): def hostname_for_refs(resource=None):
"""Return the HATEOAS-style return URI reference for this service.""" """Return the HATEOAS-style return URI reference for this service."""
base_url = get_base_url_from_request() base_url = get_base_url_from_request()
skipping to change at line 193 skipping to change at line 193
return getattr(python_module, class_name) return getattr(python_module, class_name)
def generate_uuid(): def generate_uuid():
return uuidutils.generate_uuid() return uuidutils.generate_uuid()
def is_multiple_backends_enabled(): def is_multiple_backends_enabled():
try: try:
secretstore_conf = config.get_module_config('secretstore') secretstore_conf = config.get_module_config('secretstore')
except KeyError: except KeyError:
# Ensure module is initialized # Ensure module is initialized
from barbican.plugin.interface import secret_store # nopep8 from barbican.plugin.interface import secret_store # noqa: F401
secretstore_conf = config.get_module_config('secretstore') secretstore_conf = config.get_module_config('secretstore')
return secretstore_conf.secretstore.enable_multiple_secret_stores return secretstore_conf.secretstore.enable_multiple_secret_stores
def validate_id_is_uuid(input_id, version=4): def validate_id_is_uuid(input_id, version=4):
"""Validates provided id is uuid4 format value. """Validates provided id is uuid4 format value.
Returns true when provided id is a valid version 4 uuid otherwise Returns true when provided id is a valid version 4 uuid otherwise
returns False. returns False.
This validation is to be used only for ids which are generated by barbican This validation is to be used only for ids which are generated by barbican
(e.g. not for keystone project_id) (e.g. not for keystone project_id)
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)