From 481be16b8b385e1fcccd34607da8a8a3f5bde69f Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sat, 9 Jul 2016 17:34:11 +0900 Subject: [PATCH] Add support for deprecating cloud profiles We've had HP shut down their public cloud, and DreamHost has recent spun up a new cloud with a different operational profile and auth_url that is essentially a replacement cloud. That means people using the old information need to do things, so we need to be able to communicate that to them. Add support for adding a deprecated status to a vendor profile, as well as a verbose message explaining what the user may do to remediate. Change-Id: I19b67d7cd71fba2d9da0e3a6adb2d229ead65396 --- os_client_config/config.py | 6 ++++++ os_client_config/defaults.json | 2 ++ os_client_config/vendor-schema.json | 11 +++++++++++ 3 files changed, 19 insertions(+) diff --git a/os_client_config/config.py b/os_client_config/config.py index f1df797..84476b2 100644 --- a/os_client_config/config.py +++ b/os_client_config/config.py @@ -468,6 +468,12 @@ 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)) _auth_update(cloud, profile_data) else: # Can't find the requested vendor config, go about business 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..a5bee27 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"], + "default": "active" + }, "compute_service_name": { "name": "Compute API Service Name", "description": "Compute API Service Name",