Rename cloud to profile

The cloud parameter was confusing people, especially since it was
inside of a dict that was named "clouds". profile was suggested as less
confusing, which seems fine.

Continue processing cloud as a parameter so that we don't break
anyway, but change the docs to only mention profile.

Change-Id: Idf3d089703985ecc60f23a3c780ddcab914aa678
This commit is contained in:
Monty Taylor 2015-05-27 08:01:40 -04:00
parent 434d51aac2
commit b51f9f8416
3 changed files with 17 additions and 16 deletions

View File

@ -82,7 +82,7 @@ An example config file is probably helpful:
clouds:
mordred:
cloud: hp
profile: hp
auth:
username: mordred@inaugust.com
password: XXXXXXXXX
@ -99,7 +99,7 @@ An example config file is probably helpful:
region_name: region-b.geo-1
dns_service_type: hpext:dns
infra:
cloud: rackspace
profile: rackspace
auth:
username: openstackci
password: XXXXXXXX
@ -107,11 +107,11 @@ An example config file is probably helpful:
region_name: DFW,ORD,IAD
You may note a few things. First, since auth_url settings are silly
and embarrasingly ugly, known cloud vendors are included and may be referrenced
by name. One of the benefits of that is that auth_url isn't the only thing
the vendor defaults contain. For instance, since Rackspace lists
`rax:database` as the service type for trove, os-client-config knows that
so that you don't have to.
and embarrasingly ugly, known cloud vendor profile information is included and
may be referrenced by name. One of the benefits of that is that auth_url
isn't the only thing the vendor defaults contain. For instance, since
Rackspace lists `rax:database` as the service type for trove, os-client-config
knows that so that you don't have to.
Also, region_name can be a list of regions. When you call get_all_clouds,
you'll get a cloud config object for each cloud/region combo.
@ -159,7 +159,7 @@ are connecting to OpenStack can share a cache should you desire.
- 127.0.0.1
clouds:
mordred:
cloud: hp
profile: hp
auth:
username: mordred@inaugust.com
password: XXXXXXXXX

View File

@ -202,15 +202,16 @@ class OpenStackConfig(object):
# Get the defaults
cloud.update(self.defaults)
# yes, I know the next line looks silly
if 'cloud' in our_cloud:
cloud_name = our_cloud['cloud']
# 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:
vendor_file = self._load_vendor_file()
if vendor_file and cloud_name in vendor_file['public-clouds']:
_auth_update(cloud, vendor_file['public-clouds'][cloud_name])
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[cloud_name])
_auth_update(cloud, vendors.CLOUD_DEFAULTS[profile_name])
except KeyError:
# Can't find the requested vendor config, go about business
pass

View File

@ -40,7 +40,7 @@ VENDOR_CONF = {
USER_CONF = {
'clouds': {
'_test_cloud_': {
'cloud': '_test_cloud_in_our_cloud',
'profile': '_test_cloud_in_our_cloud',
'auth': {
'username': 'testuser',
'password': 'testpass',
@ -48,7 +48,7 @@ USER_CONF = {
'region_name': 'test-region',
},
'_test_cloud_no_vendor': {
'cloud': '_test_non_existant_cloud',
'profile': '_test_non_existant_cloud',
'auth': {
'username': 'testuser',
'password': 'testpass',