diff options
-rw-r--r-- | doc/source/vendor-support.rst | 22 | ||||
-rw-r--r-- | os_client_config/config.py | 82 | ||||
-rw-r--r-- | os_client_config/defaults.json | 2 | ||||
-rw-r--r-- | os_client_config/vendor-schema.json | 11 | ||||
-rw-r--r-- | os_client_config/vendors/citycloud.json | 3 | ||||
-rw-r--r-- | os_client_config/vendors/dreamcompute.json | 11 | ||||
-rw-r--r-- | os_client_config/vendors/dreamhost.json | 2 | ||||
-rw-r--r-- | releasenotes/notes/cloud-profile-status-e0d29b5e2f10e95c.yaml | 6 | ||||
-rw-r--r-- | releasenotes/notes/magic-fixes-dca4ae4dac2441a8.yaml | 6 | ||||
-rw-r--r-- | releasenotes/notes/option-precedence-1fecab21fdfb2c33.yaml | 7 | ||||
-rw-r--r-- | releasenotes/notes/vendor-updates-f11184ba56bb27cf.yaml | 4 |
11 files changed, 121 insertions, 35 deletions
diff --git a/doc/source/vendor-support.rst b/doc/source/vendor-support.rst index f97c9f6..668ddcc 100644 --- a/doc/source/vendor-support.rst +++ b/doc/source/vendor-support.rst @@ -62,9 +62,12 @@ https://identity1.citycloud.com:5000/v3/ ============== ================ Region Name Human Name ============== ================ +Buf1 Buffalo, NY +Fra1 Frankfurt, DE +Kna1 Karlskrona, SE +La1 Los Angeles, CA Lon1 London, UK Sto2 Stockholm, SE -Kna1 Karlskrona, SE ============== ================ * Identity API Version is 3 @@ -99,9 +102,26 @@ sal01 Manchester, UK * Image API Version is 1 +dreamcompute +------------ + +https://iad2.dream.io:5000 + +============== ================ +Region Name Human Name +============== ================ +RegionOne Region One +============== ================ + +* Identity API Version is 3 +* Images must be in `raw` format +* IPv6 is provided to every server + dreamhost --------- +Deprecated, please use dreamcompute + https://keystone.dream.io/v2.0 ============== ================ diff --git a/os_client_config/config.py b/os_client_config/config.py index 2aa0530..37a31f8 100644 --- a/os_client_config/config.py +++ b/os_client_config/config.py @@ -468,6 +468,17 @@ class OpenStackConfig(object): else: profile_data = vendors.get_profile(profile_name) if profile_data: + status = profile_data.pop('status', 'active') + message = profile_data.pop('message', '') + if status == 'deprecated': + warnings.warn( + "{profile_name} is deprecated: {message}".format( + profile_name=profile_name, message=message)) + elif status == 'shutdown': + raise exceptions.OpenStackConfigException( + "{profile_name} references a cloud that no longer" + " exists: {message}".format( + profile_name=profile_name, message=message)) _auth_update(cloud, profile_data) else: # Can't find the requested vendor config, go about business @@ -475,14 +486,6 @@ class OpenStackConfig(object): " the cloud '{1}'".format(profile_name, name)) - def _fix_backwards_madness(self, cloud): - cloud = self._fix_backwards_auth_plugin(cloud) - cloud = self._fix_backwards_project(cloud) - cloud = self._fix_backwards_interface(cloud) - cloud = self._fix_backwards_networks(cloud) - cloud = self._handle_domain_id(cloud) - return cloud - def _project_scoped(self, cloud): return ('project_id' in cloud or 'project_name' in cloud or 'project_id' in cloud['auth'] @@ -814,7 +817,7 @@ class OpenStackConfig(object): def auth_config_hook(self, config): """Allow examination of config values before loading auth plugin - OpenStackClient will override this to perform additional chacks + OpenStackClient will override this to perform additional checks on auth_type. """ return config @@ -939,6 +942,41 @@ class OpenStackConfig(object): return config + def magic_fixes(self, config): + """Perform the set of magic argument fixups""" + + # Infer token plugin if a token was given + if (('auth' in config and 'token' in config['auth']) or + ('auth_token' in config and config['auth_token']) or + ('token' in config and config['token'])): + config.setdefault('token', config.pop('auth_token', None)) + + # These backwards compat values are only set via argparse. If it's + # there, it's because it was passed in explicitly, and should win + config = self._fix_backwards_api_timeout(config) + if 'endpoint_type' in config: + config['interface'] = config.pop('endpoint_type') + + config = self._fix_backwards_auth_plugin(config) + config = self._fix_backwards_project(config) + config = self._fix_backwards_interface(config) + config = self._fix_backwards_networks(config) + config = self._handle_domain_id(config) + + for key in BOOL_KEYS: + if key in config: + if type(config[key]) is not bool: + config[key] = get_boolean(config[key]) + + # TODO(mordred): Special casing auth_url here. We should + # come back to this betterer later so that it's + # more generalized + if 'auth' in config and 'auth_url' in config['auth']: + config['auth']['auth_url'] = config['auth']['auth_url'].format( + **config) + + return config + def get_one_cloud(self, cloud=None, validate=True, argparse=None, **kwargs): """Retrieve a single cloud configuration and merge additional options @@ -994,31 +1032,7 @@ class OpenStackConfig(object): else: config[key] = val - # Infer token plugin if a token was given - if (('auth' in config and 'token' in config['auth']) or - ('auth_token' in config and config['auth_token']) or - ('token' in config and config['token'])): - config.setdefault('token', config.pop('auth_token', None)) - - # These backwards compat values are only set via argparse. If it's - # there, it's because it was passed in explicitly, and should win - config = self._fix_backwards_api_timeout(config) - if 'endpoint_type' in config: - config['interface'] = config.pop('endpoint_type') - - config = self._fix_backwards_madness(config) - - for key in BOOL_KEYS: - if key in config: - if type(config[key]) is not bool: - config[key] = get_boolean(config[key]) - - # TODO(mordred): Special casing auth_url here. We should - # come back to this betterer later so that it's - # more generalized - if 'auth' in config and 'auth_url' in config['auth']: - config['auth']['auth_url'] = config['auth']['auth_url'].format( - **config) + config = self.magic_fixes(config) # NOTE(dtroyer): OSC needs a hook into the auth args before the # plugin is loaded in order to maintain backward- diff --git a/os_client_config/defaults.json b/os_client_config/defaults.json index f501862..ba8bf39 100644 --- a/os_client_config/defaults.json +++ b/os_client_config/defaults.json @@ -13,10 +13,12 @@ "image_api_version": "2", "image_format": "qcow2", "key_manager_api_version": "v1", + "message": "", "metering_api_version": "2", "network_api_version": "2", "object_store_api_version": "1", "orchestration_api_version": "1", "secgroup_source": "neutron", + "status": "active", "volume_api_version": "2" } diff --git a/os_client_config/vendor-schema.json b/os_client_config/vendor-schema.json index 6c57ba4..6a6f456 100644 --- a/os_client_config/vendor-schema.json +++ b/os_client_config/vendor-schema.json @@ -55,12 +55,23 @@ "default": "public", "enum": [ "public", "internal", "admin" ] }, + "message": { + "name": "Status message", + "description": "Optional message with information related to status", + "type": "string" + }, "secgroup_source": { "name": "Security Group Source", "description": "Which service provides security groups", "enum": [ "neutron", "nova", "None" ], "default": "neutron" }, + "status": { + "name": "Vendor status", + "description": "Status of the vendor's cloud", + "enum": [ "active", "deprecated", "shutdown"], + "default": "active" + }, "compute_service_name": { "name": "Compute API Service Name", "description": "Compute API Service Name", diff --git a/os_client_config/vendors/citycloud.json b/os_client_config/vendors/citycloud.json index 64cadce..097ddfd 100644 --- a/os_client_config/vendors/citycloud.json +++ b/os_client_config/vendors/citycloud.json @@ -5,6 +5,9 @@ "auth_url": "https://identity1.citycloud.com:5000/v3/" }, "regions": [ + "Buf1", + "La1", + "Fra1", "Lon1", "Sto2", "Kna1" diff --git a/os_client_config/vendors/dreamcompute.json b/os_client_config/vendors/dreamcompute.json new file mode 100644 index 0000000..8244cf7 --- /dev/null +++ b/os_client_config/vendors/dreamcompute.json @@ -0,0 +1,11 @@ +{ + "name": "dreamcompute", + "profile": { + "auth": { + "auth_url": "https://iad2.dream.io:5000" + }, + "identity_api_version": "3", + "region_name": "RegionOne", + "image_format": "raw" + } +} diff --git a/os_client_config/vendors/dreamhost.json b/os_client_config/vendors/dreamhost.json index 6fc2ccf..ea2ebac 100644 --- a/os_client_config/vendors/dreamhost.json +++ b/os_client_config/vendors/dreamhost.json @@ -1,6 +1,8 @@ { "name": "dreamhost", "profile": { + "status": "deprecated", + "message": "The dreamhost profile is deprecated. Please use the dreamcompute profile instead", "auth": { "auth_url": "https://keystone.dream.io" }, diff --git a/releasenotes/notes/cloud-profile-status-e0d29b5e2f10e95c.yaml b/releasenotes/notes/cloud-profile-status-e0d29b5e2f10e95c.yaml new file mode 100644 index 0000000..b447ed0 --- /dev/null +++ b/releasenotes/notes/cloud-profile-status-e0d29b5e2f10e95c.yaml @@ -0,0 +1,6 @@ +--- +features: + - Add a field to vendor cloud profiles to indicate + active, deprecated and shutdown status. A message to + the user is triggered when attempting to use cloud + with either deprecated or shutdown status. diff --git a/releasenotes/notes/magic-fixes-dca4ae4dac2441a8.yaml b/releasenotes/notes/magic-fixes-dca4ae4dac2441a8.yaml new file mode 100644 index 0000000..570e4dc --- /dev/null +++ b/releasenotes/notes/magic-fixes-dca4ae4dac2441a8.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - Refactor ``OpenStackConfig._fix_backward_madness()`` into + ``OpenStackConfig.magic_fixes()`` that allows subclasses + to inject more fixup magic into the flow during + ``get_one_cloud()`` processing. diff --git a/releasenotes/notes/option-precedence-1fecab21fdfb2c33.yaml b/releasenotes/notes/option-precedence-1fecab21fdfb2c33.yaml new file mode 100644 index 0000000..06e6bd2 --- /dev/null +++ b/releasenotes/notes/option-precedence-1fecab21fdfb2c33.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - Reverse the order of option selction in + ``OpenStackConfig._validate_auth()`` to prefer auth options + passed in (from argparse) over those found in clouds.yaml. + This allows the application to override config profile + auth settings. diff --git a/releasenotes/notes/vendor-updates-f11184ba56bb27cf.yaml b/releasenotes/notes/vendor-updates-f11184ba56bb27cf.yaml new file mode 100644 index 0000000..e1d6d41 --- /dev/null +++ b/releasenotes/notes/vendor-updates-f11184ba56bb27cf.yaml @@ -0,0 +1,4 @@ +--- +other: + - Add citycloud regions for Buffalo, Frankfurt, Karlskrona and Los Angles + - Add new DreamCompute cloud and deprecate DreamHost cloud |