summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--os_client_config/config.py9
-rw-r--r--os_client_config/defaults.py44
-rw-r--r--os_client_config/defaults.yaml16
-rw-r--r--os_client_config/vendors/__init__.py17
-rw-r--r--os_client_config/vendors/auro.yaml7
-rw-r--r--os_client_config/vendors/dreamhost.yaml6
-rw-r--r--os_client_config/vendors/hp.yaml8
-rw-r--r--os_client_config/vendors/ovh.yaml8
-rw-r--r--os_client_config/vendors/rackspace.yaml15
-rw-r--r--os_client_config/vendors/runabove.yaml9
-rw-r--r--os_client_config/vendors/unitedstack.yaml9
-rw-r--r--os_client_config/vendors/vexxhost.yaml7
12 files changed, 86 insertions, 69 deletions
diff --git a/os_client_config/config.py b/os_client_config/config.py
index 7961e72..55328cc 100644
--- a/os_client_config/config.py
+++ b/os_client_config/config.py
@@ -228,7 +228,7 @@ class OpenStackConfig(object):
# Expand a profile if it exists. 'cloud' is an old confusing name
# for this.
profile_name = our_cloud.get('profile', our_cloud.get('cloud', None))
- if profile_name:
+ if profile_name and profile_name != self.envvar_key:
if 'cloud' in our_cloud:
warnings.warn(
"{0} use the keyword 'cloud' to reference a known "
@@ -238,9 +238,10 @@ class OpenStackConfig(object):
if vendor_file and profile_name in vendor_file['public-clouds']:
_auth_update(cloud, vendor_file['public-clouds'][profile_name])
else:
- try:
- _auth_update(cloud, vendors.CLOUD_DEFAULTS[profile_name])
- except KeyError:
+ profile_data = vendors.get_profile(profile_name)
+ if profile_data:
+ _auth_update(cloud, profile_data)
+ else:
# Can't find the requested vendor config, go about business
warnings.warn("Couldn't find the vendor profile '{0}', for"
" the cloud '{1}'".format(profile_name,
diff --git a/os_client_config/defaults.py b/os_client_config/defaults.py
index 8bf693d..a274767 100644
--- a/os_client_config/defaults.py
+++ b/os_client_config/defaults.py
@@ -12,29 +12,29 @@
# License for the specific language governing permissions and limitations
# under the License.
-_defaults = dict(
- api_timeout=None,
- auth_type='password',
- baremetal_api_version='1',
- compute_api_version='2',
- database_api_version='1.0',
- endpoint_type='public',
- floating_ip_source='neutron',
- identity_api_version='2',
- image_api_use_tasks=False,
- image_api_version='1',
- network_api_version='2',
- object_api_version='1',
- secgroup_source='neutron',
- volume_api_version='1',
- disable_vendor_agent={},
- # SSL Related args
- verify=True,
- cacert=None,
- cert=None,
- key=None,
-)
+import os
+
+import yaml
+
+_yaml_path = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)), 'defaults.yaml')
+_defaults = None
def get_defaults():
+ global _defaults
+ if not _defaults:
+ # Python language specific defaults
+ # These are defaults related to use of python libraries, they are
+ # not qualities of a cloud.
+ _defaults = dict(
+ api_timeout=None,
+ verify=True,
+ cacert=None,
+ cert=None,
+ key=None,
+ )
+ with open(_yaml_path, 'r') as yaml_file:
+ _defaults.update(yaml.load(yaml_file.read()))
+
return _defaults.copy()
diff --git a/os_client_config/defaults.yaml b/os_client_config/defaults.yaml
new file mode 100644
index 0000000..e4c9000
--- /dev/null
+++ b/os_client_config/defaults.yaml
@@ -0,0 +1,16 @@
+auth_type: password
+baremetal_api_version: '1'
+compute_api_version: '2'
+database_api_version: '1.0'
+disable_vendor_agent: {}
+dns_api_version: '2'
+endpoint_type: public
+floating_ip_source: neutron
+identity_api_version: '2'
+image_api_use_tasks: false
+image_api_version: '1'
+image_format: qcow2
+network_api_version: '2'
+object_api_version: '1'
+secgroup_source: neutron
+volume_api_version: '1'
diff --git a/os_client_config/vendors/__init__.py b/os_client_config/vendors/__init__.py
index 0ccb04c..367e318 100644
--- a/os_client_config/vendors/__init__.py
+++ b/os_client_config/vendors/__init__.py
@@ -17,9 +17,16 @@ import os
import yaml
-vendors_path = os.path.dirname(os.path.realpath(__file__))
+_vendors_path = os.path.dirname(os.path.realpath(__file__))
+_vendor_defaults = None
-CLOUD_DEFAULTS = {}
-for vendor in glob.glob(os.path.join(vendors_path, '*.yaml')):
- with open(vendor, 'r') as f:
- CLOUD_DEFAULTS.update(yaml.safe_load(f))
+
+def get_profile(profile_name):
+ global _vendor_defaults
+ if _vendor_defaults is None:
+ _vendor_defaults = {}
+ for vendor in glob.glob(os.path.join(_vendors_path, '*.yaml')):
+ with open(vendor, 'r') as f:
+ vendor_data = yaml.load(f)
+ _vendor_defaults[vendor_data['name']] = vendor_data['profile']
+ return _vendor_defaults.get(profile_name)
diff --git a/os_client_config/vendors/auro.yaml b/os_client_config/vendors/auro.yaml
index da1491d..987838b 100644
--- a/os_client_config/vendors/auro.yaml
+++ b/os_client_config/vendors/auro.yaml
@@ -1,10 +1,7 @@
----
-auro:
+name: auro
+profile:
auth:
auth_url: https://api.auro.io:5000/v2.0
region_name: RegionOne
- identity_api_version: 2
- image_api_version: 1
- image_format: qcow2
secgroup_source: nova
floating_ip_source: nova
diff --git a/os_client_config/vendors/dreamhost.yaml b/os_client_config/vendors/dreamhost.yaml
index 63f15c3..5e10d14 100644
--- a/os_client_config/vendors/dreamhost.yaml
+++ b/os_client_config/vendors/dreamhost.yaml
@@ -1,7 +1,7 @@
----
-dreamhost:
+name: dreamhost
+profile:
auth:
auth_url: https://keystone.dream.io/v2.0
region_name: RegionOne
- image_api_version: 2
+ image_api_version: '2'
image_format: raw
diff --git a/os_client_config/vendors/hp.yaml b/os_client_config/vendors/hp.yaml
index 2ac5517..2773433 100644
--- a/os_client_config/vendors/hp.yaml
+++ b/os_client_config/vendors/hp.yaml
@@ -1,8 +1,6 @@
----
-hp:
+name: hp
+profile:
auth:
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0
- region_name: region-b.geo-1
+ region_name: region-a.geo-1,region-b.geo-1
dns_service_type: hpext:dns
- image_api_version: 1
- image_format: qcow2
diff --git a/os_client_config/vendors/ovh.yaml b/os_client_config/vendors/ovh.yaml
index 5b4426f..f834372 100644
--- a/os_client_config/vendors/ovh.yaml
+++ b/os_client_config/vendors/ovh.yaml
@@ -1,10 +1,6 @@
----
-ovh:
+name: ovh
+profile:
auth:
auth_url: https://auth.cloud.ovh.net/v2.0
region_name: SBG1
- identity_api_version: 2
- image_api_version: 1
image_format: raw
- secgroup_source: neutron
- floating_ip_source: neutron
diff --git a/os_client_config/vendors/rackspace.yaml b/os_client_config/vendors/rackspace.yaml
index 7af3cab..a350584 100644
--- a/os_client_config/vendors/rackspace.yaml
+++ b/os_client_config/vendors/rackspace.yaml
@@ -1,14 +1,15 @@
----
-rackspace:
+name: rackspace
+profile:
auth:
- auth_url: https://identity.api.rackspacecloud.com/v2.0
- database_service_type: 'rax:database'
+ auth_url: https://identity.api.rackspacecloud.com/v2.0/
+ region_name: DFW,ORD,IAD,SYD,HKG
+ database_service_type: rax:database
compute_service_name: cloudServersOpenStack
- image_api_version: 2
- image_api_use_tasks: True
+ image_api_version: '2'
+ image_api_use_tasks: true
image_format: vhd
floating_ip_source: None
secgroup_source: None
disable_vendor_agent:
vm_mode: hvm
- xenapi_use_agent: False
+ xenapi_use_agent: false
diff --git a/os_client_config/vendors/runabove.yaml b/os_client_config/vendors/runabove.yaml
index c9641dd..381020a 100644
--- a/os_client_config/vendors/runabove.yaml
+++ b/os_client_config/vendors/runabove.yaml
@@ -1,7 +1,8 @@
----
-runabove:
+name: runabove
+profile:
auth:
auth_url: https://auth.runabove.io/v2.0
- image_api_version: 2
+ region_name: SBG-1,BHS-1
+ image_api_version: '2'
image_format: qcow2
- floating_ip_sourc: None
+ floating_ip_source: None
diff --git a/os_client_config/vendors/unitedstack.yaml b/os_client_config/vendors/unitedstack.yaml
index 43c600a..db9b612 100644
--- a/os_client_config/vendors/unitedstack.yaml
+++ b/os_client_config/vendors/unitedstack.yaml
@@ -1,8 +1,9 @@
----
-unitedstack:
+name: unitedstack
+profile:
auth:
auth_url: https://identity.api.ustack.com/v3
- identity_api_version: 3
- image_api_version: 2
+ region_name: bj1,gd1
+ identity_api_version: '3'
+ image_api_version: '2'
image_format: raw
floating_ip_source: None
diff --git a/os_client_config/vendors/vexxhost.yaml b/os_client_config/vendors/vexxhost.yaml
index 5247ef4..f67c644 100644
--- a/os_client_config/vendors/vexxhost.yaml
+++ b/os_client_config/vendors/vexxhost.yaml
@@ -1,8 +1,7 @@
----
-vexxhost:
+name: vexxhost
+profile:
auth:
auth_url: http://auth.api.thenebulacloud.com:5000/v2.0/
region_name: ca-ymq-1
- image_api_version: 2
- image_format: qcow2
+ image_api_version: '2'
floating_ip_source: None