summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--os_client_config/config.py18
-rw-r--r--os_client_config/defaults.py23
-rw-r--r--os_client_config/vendors.py1
3 files changed, 34 insertions, 8 deletions
diff --git a/os_client_config/config.py b/os_client_config/config.py
index 3565fa6..48b99f5 100644
--- a/os_client_config/config.py
+++ b/os_client_config/config.py
@@ -23,6 +23,7 @@ except ImportError:
ksc_auth = None
from os_client_config import cloud_config
+from os_client_config import defaults
from os_client_config import exceptions
from os_client_config import vendors
@@ -41,18 +42,23 @@ VENDOR_FILES = [
os.path.join(d, 'clouds-public.yaml') for d in VENDOR_SEARCH_PATH]
+def set_default(key, value):
+ defaults._defaults[key] = value
+
+
def get_boolean(value):
if value.lower() == 'true':
return True
return False
-def _get_os_environ(defaults):
+def _get_os_environ():
+ ret = dict(defaults._defaults)
for (k, v) in os.environ.items():
if k.startswith('OS_'):
newkey = k[3:].lower()
- defaults[newkey] = v
- return defaults
+ ret[newkey] = v
+ return ret
def _auth_update(old_dict, new_dict):
@@ -74,11 +80,7 @@ class OpenStackConfig(object):
self._config_files = config_files or CONFIG_FILES
self._vendor_files = vendor_files or VENDOR_FILES
- defaults = dict(
- auth_type='password',
- compute_api_version='1.1',
- )
- self.defaults = _get_os_environ(defaults)
+ self.defaults = _get_os_environ()
# use a config file if it exists where expected
self.cloud_config = self._load_config_file()
diff --git a/os_client_config/defaults.py b/os_client_config/defaults.py
new file mode 100644
index 0000000..5f70d6e
--- /dev/null
+++ b/os_client_config/defaults.py
@@ -0,0 +1,23 @@
+# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+_defaults = dict(
+ auth_type='password',
+ compute_api_version='2',
+ identity_api_version='2',
+ image_api_version='1',
+ network_api_version='2',
+ object_api_version='1',
+ volume_api_version='1',
+)
diff --git a/os_client_config/vendors.py b/os_client_config/vendors.py
index cab3676..eb08bbd 100644
--- a/os_client_config/vendors.py
+++ b/os_client_config/vendors.py
@@ -20,6 +20,7 @@ CLOUD_DEFAULTS = dict(
),
region_name='region-b.geo-1',
dns_service_type='hpext:dns',
+ image_api_version='1',
),
rackspace=dict(
auth=dict(