~ubuntu-branches/ubuntu/wily/simplestreams/wily-proposed

« back to all changes in this revision

Viewing changes to simplestreams/openstack.py

  • Committer: Package Import Robot
  • Author(s): Scott Moser
  • Date: 2015-05-13 13:03:50 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20150513130350-1lop1j1l02zzzsyc
Tags: 0.1.0~bzr378-0ubuntu1
* New upstream snapshot.
  - GlanceMirror: identify images as i686 not i386 (LP: #1454775)
  - sstream-mirror: debug statement about filtered items
  - GlanceMirror: do not strip version information from endpoints
    (LP: #1346935)
  - general fixes to tools/ that are upstream only, not packaged.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
from keystoneclient.v2_0 import client as ksclient
19
19
import os
20
 
import re
21
20
 
22
21
OS_ENV_VARS = (
23
22
    'OS_AUTH_TOKEN', 'OS_AUTH_URL', 'OS_CACERT', 'OS_IMAGE_API_VERSION',
119
118
        endpoint_kwargs['filter_value'] = kwargs.get('region_name')
120
119
 
121
120
    endpoint = client.service_catalog.url_for(**endpoint_kwargs)
122
 
    return _strip_version(endpoint)
123
 
 
124
 
 
125
 
def _strip_version(endpoint):
126
 
    """Strip a version from the last component of an endpoint if present"""
127
 
 
128
 
    # Get rid of trailing '/' if present
129
 
    if endpoint.endswith('/'):
130
 
        endpoint = endpoint[:-1]
131
 
    url_bits = endpoint.split('/')
132
 
    # regex to match 'v1' or 'v2.0' etc
133
 
    if re.match(r'v\d+\.?\d*', url_bits[-1]):
134
 
        endpoint = '/'.join(url_bits[:-1])
135
121
    return endpoint