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

View File

@@ -202,15 +202,16 @@ class OpenStackConfig(object):
# Get the defaults # Get the defaults
cloud.update(self.defaults) cloud.update(self.defaults)
# yes, I know the next line looks silly # Expand a profile if it exists. 'cloud' is an old confusing name
if 'cloud' in our_cloud: # for this.
cloud_name = our_cloud['cloud'] profile_name = our_cloud.get('profile', our_cloud.get('cloud', None))
if profile_name:
vendor_file = self._load_vendor_file() vendor_file = self._load_vendor_file()
if vendor_file and cloud_name in vendor_file['public-clouds']: if vendor_file and profile_name in vendor_file['public-clouds']:
_auth_update(cloud, vendor_file['public-clouds'][cloud_name]) _auth_update(cloud, vendor_file['public-clouds'][profile_name])
else: else:
try: try:
_auth_update(cloud, vendors.CLOUD_DEFAULTS[cloud_name]) _auth_update(cloud, vendors.CLOUD_DEFAULTS[profile_name])
except KeyError: except KeyError:
# Can't find the requested vendor config, go about business # Can't find the requested vendor config, go about business
pass pass

View File

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