Remove legacy openstack settings from nodepool.yaml

Before os-client-config and shade, we would include cloud credentials
in nodepool.yaml. But now comes the time where we can remove these
settings in favor of using a local clouds.yaml file.

Change-Id: Ie7af6dcd56dc48787f280816de939d07800e9d11
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2017-03-20 14:59:34 -04:00 committed by James E. Blair
parent a953afd751
commit f7289a5aca
36 changed files with 25 additions and 204 deletions

View File

@ -258,12 +258,6 @@ provider, the Nodepool image types are also defined (see
- name: devstack-trusty
min-ram: 30720
- name: provider2
username: 'username'
password: 'password'
auth-url: 'http://auth.provider2.example.com/'
project-name: 'project'
service-type: 'compute'
service-name: 'compute'
region-name: 'region1'
max-servers: 96
rate: 1.0
@ -295,17 +289,6 @@ provider, the Nodepool image types are also defined (see
portions of the cloud configuration directly in ``nodepool.yaml``. Not all
of the options settable via ``clouds.yaml`` are available.
``username``
``password``
``project-id`` OR ``project-name``
Some clouds may refer to the ``project-id`` as ``tenant-id``.
Some clouds may refer to the ``project-name`` as ``tenant-name``.
``auth-url``
Keystone URL.
``image-type``
Specifies the image type supported by this provider. The disk images built
by diskimage-builder will output an image for each ``image-type`` specified
@ -370,12 +353,6 @@ provider, the Nodepool image types are also defined (see
Timeout for the OpenStack API calls client in seconds. Prefer setting
this in `clouds.yaml`
``service-type`` (compatability)
Prefer setting this in `clouds.yaml`.
``service-name`` (compatability)
Prefer setting this in `clouds.yaml`.
``region-name``
``hostname-format``

View File

@ -52,16 +52,9 @@ class ConfigValidator:
providers = {
'name': str,
'region-name': str,
'service-type': str,
'service-name': str,
'availability-zones': [str],
'keypair': str,
'cloud': str,
'username': str,
'password': str,
'auth-url': str,
'project-id': str,
'project-name': str,
'max-servers': int,
'max-concurrency': int,
'pool': str, # Ignored, but kept for backwards compat

View File

@ -276,25 +276,11 @@ def _cloudKwargsFromProvider(provider):
if arg in provider:
cloud_kwargs[arg] = provider[arg]
# These are named from back when we only talked to Nova. They're
# actually compute service related
if 'service-type' in provider:
cloud_kwargs['compute-service-type'] = provider['service-type']
if 'service-name' in provider:
cloud_kwargs['compute-service-name'] = provider['service-name']
auth_kwargs = {}
for auth_key in (
'username', 'password', 'auth-url', 'project-id', 'project-name'):
if auth_key in provider:
auth_kwargs[auth_key] = provider[auth_key]
cloud_kwargs['auth'] = auth_kwargs
return cloud_kwargs
def _get_one_cloud(cloud_config, cloud_kwargs):
'''This is a function to allow for overriding it in tests.'''
if cloud_kwargs.get('auth', {}).get('auth-url', '') == 'fake':
if cloud_kwargs.get('cloud') == 'fake':
return fakeprovider.fake_get_one_cloud(cloud_config, cloud_kwargs)
return cloud_config.get_one_cloud(**cloud_kwargs)

View File

@ -45,7 +45,7 @@ class NotFound(Exception):
def get_provider_manager(provider, use_taskmanager):
if (provider.cloud_config.get_auth_args().get('auth_url') == 'fake'):
if (provider.cloud_config.name == 'fake'):
return FakeProviderManager(provider, use_taskmanager)
else:
return ProviderManager(provider, use_taskmanager)

View File

@ -153,6 +153,10 @@ class BaseTestCase(testtools.TestCase):
self.useFixture(fixtures.MonkeyPatch(
'nodepool.nodepool._get_one_cloud',
fakeprovider.fake_get_one_cloud))
clouds_path = os.path.join(os.path.dirname(__file__),
'fixtures', 'clouds.yaml')
self.useFixture(fixtures.MonkeyPatch(
'os_client_config.config.CONFIG_FILES', [clouds_path]))
def wait_for_threads(self):
# Wait until all transient threads (node launches, deletions,

7
nodepool/tests/fixtures/clouds.yaml vendored Normal file
View File

@ -0,0 +1,7 @@
clouds:
fake:
auth:
usernmae: 'fake'
password: 'fake'
project_id: 'fake'
auth_url: 'fake'

View File

@ -27,12 +27,6 @@ labels:
providers:
- name: cloud1
region-name: 'vanilla'
service-type: 'compute'
service-name: 'cloudServersOpenStack'
username: '<%= username %>'
password: '<%= password %>'
project-id: '<%= project %>'
auth-url: 'https://identity.example.com/v2.0/'
boot-timeout: 120
max-servers: 184
max-concurrency: 10
@ -43,12 +37,6 @@ providers:
min-ram: 8192
- name: cloud2
region-name: 'chocolate'
service-type: 'compute'
service-name: 'cloudServersOpenStack'
username: '<%= username %>'
password: '<%= password %>'
project-id: '<%= project %>'
auth-url: 'https://identity.example.com/v2.0/'
boot-timeout: 120
max-servers: 184
rate: 0.001

View File

@ -27,12 +27,6 @@ labels:
providers:
- name: cloud1
region-name: 'vanilla'
service-type: 'compute'
service-name: 'cloudServersOpenStack'
username: '<%= username %>'
password: '<%= password %>'
project-id: '<%= project %>'
auth-url: 'https://identity.example.com/v2.0/'
boot-timeout: 120
max-servers: 184
rate: 0.001
@ -41,12 +35,6 @@ providers:
min-ram: 8192
- name: cloud2
region-name: 'chocolate'
service-type: 'compute'
service-name: 'cloudServersOpenStack'
username: '<%= username %>'
password: '<%= password %>'
project-id: '<%= project %>'
auth-url: 'https://identity.example.com/v2.0/'
boot-timeout: 120
max-servers: 184
rate: 0.001

View File

@ -18,10 +18,6 @@ providers:
- name: real-provider
region-name: real-region
keypair: 'if-present-use-this-keypair'
username: 'real'
password: 'real'
auth-url: 'real'
project-id: 'real'
max-servers: 96
pool: 'real'
networks:

View File

@ -21,10 +21,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -19,14 +19,11 @@ labels:
providers:
- name: fake-provider
cloud: fake
region-name: fake-region
availability-zones:
- az1
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -21,10 +21,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -24,10 +24,6 @@ labels:
providers:
- name: fake-provider1
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:
@ -42,10 +38,6 @@ providers:
key2: value
- name: fake-provider2
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -21,10 +21,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -21,10 +21,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -26,10 +26,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -26,10 +26,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -33,10 +33,6 @@ providers:
- name: fake-provider1
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:
@ -54,10 +50,6 @@ providers:
- name: fake-provider2
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:
@ -74,10 +66,6 @@ providers:
- name: fake-provider3
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -21,10 +21,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:
@ -40,10 +36,6 @@ providers:
- name: fake-provider2
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -19,12 +19,9 @@ labels:
providers:
- name: fake-provider
cloud: 'fake'
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
launch-retries: 2

View File

@ -23,10 +23,6 @@ providers:
availability-zones:
- az1
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -21,10 +21,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -23,10 +23,6 @@ providers:
availability-zones:
- az1
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 2
pool: 'fake'
networks:

View File

@ -26,10 +26,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -21,10 +21,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -22,10 +22,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:
@ -41,10 +37,6 @@ providers:
- name: fake-provider2
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -21,10 +21,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:
@ -40,10 +36,6 @@ providers:
- name: fake-provider2
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
networks:

View File

@ -22,10 +22,6 @@ providers:
- name: fake-provider1
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 2
pool: 'fake'
networks:
@ -42,10 +38,6 @@ providers:
- name: fake-provider2
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 2
pool: 'fake'
networks:

View File

@ -21,10 +21,6 @@ providers:
- name: fake-provider
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
pool: 'fake'
image-type: vhd

View File

@ -22,10 +22,6 @@ providers:
- name: fake-provider1
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 2
pool: 'fake'
image-type: vhd
@ -42,10 +38,6 @@ providers:
- name: fake-provider2
region-name: fake-region
keypair: 'if-present-use-this-keypair'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 2
pool: 'fake'
image-type: qcow2

View File

@ -50,11 +50,6 @@ class TestShadeIntegration(tests.IntegrationTestCase):
pm = provider_manager.ProviderManager(
config.providers['real-provider'], use_taskmanager=False)
pm.start()
auth_data = {'username': 'real',
'project_id': 'real',
'password': 'real',
'auth_url': 'real'}
self.assertEqual(pm._client.auth, auth_data)
self.assertEqual(pm._client.region_name, 'real-region')
def test_nodepool_occ_config(self):

View File

@ -27,10 +27,6 @@ providers:
- name: fake-provider
keypair: 'if-present-use-this-keypair'
region-name: 'fake-region'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
images:
- name: fake-dib-image

View File

@ -35,10 +35,6 @@ providers:
- name: fake-provider
keypair: 'if-present-use-this-keypair'
region-name: 'fake-region'
username: 'fake'
password: 'fake'
auth-url: 'fake'
project-id: 'fake'
max-servers: 96
images:
- name: fake-nodepool

View File

@ -0,0 +1,7 @@
clouds:
fake:
auth:
usernmae: 'fake'
password: 'fake'
project_id: 'fake'
auth_url: 'fake'

View File

@ -24,8 +24,8 @@ labels:
providers:
- name: fake-provider
cloud: fake
max-servers: 96
auth-url: 'fake'
images:
- name: fake-nodepool
min-ram: 8192

View File

@ -5,5 +5,7 @@ cd "$(dirname "$0")"
mkdir -p /tmp/nodepool/images
mkdir -p /tmp/nodepool/log
export OS_CLIENT_CONFIG_FILE=`pwd`/clouds.yaml
nodepool-builder -c `pwd`/nodepool.yaml -l `pwd`/builder-logging.conf -p /tmp/nodepool/builder.pid --fake
nodepoold -c `pwd`/nodepool.yaml -s `pwd`/secure.conf -l `pwd`/launcher-logging.conf -p /tmp/nodepool/launcher.pid