diff --git a/openstack/profile.py b/openstack/profile.py index d70c05afa..4e3f8b1e1 100644 --- a/openstack/profile.py +++ b/openstack/profile.py @@ -11,44 +11,8 @@ # under the License. """ -:class:`~openstack.profile.Profile` is the class that is used to -define the various preferences for different services. The preferences that -are currently supported are service name, region, version and interface. -The :class:`~openstack.profile.Profile` and the -:class:`~openstack.connection.Connection` classes are the most important -user facing classes. - -Examples --------- - -The :class:`~openstack.profile.Profile` class is constructed -with no arguments. - -Set Methods -~~~~~~~~~~~ - -A user's preferences are set based on the service type. Service type would -normally be something like 'compute', 'identity', 'object-store', etc.:: - - from openstack import profile - prof = profile.Profile() - prof.set_name('compute', 'matrix') - prof.set_region(prof.ALL, 'zion') - prof.set_version('identity', 'v3') - prof.set_interface('object-store', 'internal') - for service in prof.get_services(): - print(prof.get_filter(service.service_type) - -The resulting preference print out would look something like:: - - service_type=compute,region=zion,service_name=matrix - service_type=network,region=zion - service_type=database,region=zion - service_type=image,region=zion - service_type=metering,region=zion - service_type=orchestration,region=zion - service_type=object-store,interface=internal,region=zion - service_type=identity,region=zion,version=v3 +:class:`~openstack.profile.Profile` is deprecated. Code should use +:class:`~openstack.config.cloud_region.CloudRegion` instead. """ import copy @@ -70,6 +34,7 @@ from openstack.meter import meter_service from openstack.network import network_service from openstack.object_store import object_store_service from openstack.orchestration import orchestration_service +from openstack import utils from openstack.workflow import workflow_service _logger = logging.getLogger(__name__) @@ -80,6 +45,8 @@ class Profile(object): ALL = "*" """Wildcard service identifier representing all services.""" + @utils.deprecated(deprecated_in="0.10.0", removed_in="1.0", + details="Use openstack.config instead") def __init__(self, plugins=None): """User preference for each service. @@ -121,6 +88,8 @@ class Profile(object): serv.interface = None self._services[serv.service_type] = serv + @utils.deprecated(deprecated_in="0.10.0", removed_in="1.0", + details="Use openstack.config instead") def get_filter(self, service): """Get a service preference. @@ -147,6 +116,8 @@ class Profile(object): for service in self._get_services(service): setattr(self._get_filter(service), attr, value) + @utils.deprecated(deprecated_in="0.10.0", removed_in="1.0", + details="Use openstack.config instead") def get_services(self): """Get a list of all the known services.""" services = [] @@ -154,6 +125,8 @@ class Profile(object): services.append(service) return services + @utils.deprecated(deprecated_in="0.10.0", removed_in="1.0", + details="Use openstack.config instead") def set_name(self, service, name): """Set the desired name for the specified service. @@ -162,6 +135,8 @@ class Profile(object): """ self._setter(service, "service_name", name) + @utils.deprecated(deprecated_in="0.10.0", removed_in="1.0", + details="Use openstack.config instead") def set_region(self, service, region): """Set the desired region for the specified service. @@ -170,6 +145,8 @@ class Profile(object): """ self._setter(service, "region", region) + @utils.deprecated(deprecated_in="0.10.0", removed_in="1.0", + details="Use openstack.config instead") def set_version(self, service, version): """Set the desired version for the specified service. @@ -178,6 +155,8 @@ class Profile(object): """ self._get_filter(service).version = version + @utils.deprecated(deprecated_in="0.10.0", removed_in="1.0", + details="Use openstack.config instead") def set_api_version(self, service, api_version): """Set the desired API micro-version for the specified service. @@ -186,6 +165,8 @@ class Profile(object): """ self._setter(service, "api_version", api_version) + @utils.deprecated(deprecated_in="0.10.0", removed_in="1.0", + details="Use openstack.config instead") def set_interface(self, service, interface): """Set the desired interface for the specified service. diff --git a/releasenotes/notes/deprecated-profile-762afdef0e8fc9e8.yaml b/releasenotes/notes/deprecated-profile-762afdef0e8fc9e8.yaml new file mode 100644 index 000000000..e09d17c34 --- /dev/null +++ b/releasenotes/notes/deprecated-profile-762afdef0e8fc9e8.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - | + ``openstack.profile.Profile`` has been deprecated and will be removed + in the ``1.0`` release. Users should use the functions in + ``openstack.config`` instead.