mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge remote-tracking branch 'upstream/2014.7' into merge-forward-2015.5
Conflicts: doc/conf.py salt/modules/win_service.py tests/integration/cloud/providers/digital_ocean.py
This commit is contained in:
commit
40718af1d5
9 changed files with 173 additions and 129 deletions
|
@ -155,7 +155,7 @@ project = 'Salt'
|
|||
copyright = '2015 SaltStack, Inc.'
|
||||
|
||||
version = salt.version.__version__
|
||||
latest_release = '2015.5.5' # latest release
|
||||
latest_release = '2015.5.5' # latest release
|
||||
previous_release = '2014.7.6' # latest release from previous branch
|
||||
previous_release_dir = '2014.7' # path on web server for previous branch
|
||||
build_type = 'latest' # latest, previous, develop
|
||||
|
|
|
@ -8,6 +8,7 @@ from __future__ import absolute_import
|
|||
import salt.utils
|
||||
import time
|
||||
import logging
|
||||
import os
|
||||
from subprocess import list2cmdline
|
||||
from salt.ext.six.moves import zip
|
||||
from salt.ext.six.moves import range
|
||||
|
@ -45,9 +46,13 @@ def has_powershell():
|
|||
|
||||
salt '*' service.has_powershell
|
||||
'''
|
||||
return 'powershell' in __salt__['cmd.run'](
|
||||
['where', 'powershell'], python_shell=False
|
||||
)
|
||||
for path in os.environ["PATH"].split(os.pathsep):
|
||||
path = path.strip('"')
|
||||
fullpath = os.path.join(path, "powershell.exe")
|
||||
fullpath = os.path.normpath(fullpath)
|
||||
if os.path.isfile(fullpath) and os.access(fullpath, os.X_OK):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_enabled():
|
||||
|
|
|
@ -39,8 +39,8 @@ def show_top(minion=None, saltenv='base'):
|
|||
def show_pillar(minion='*', **kwargs):
|
||||
'''
|
||||
Returns the compiled pillar either of a specific minion
|
||||
or just the global available pillars. I assume that no minion
|
||||
is using the id ``*``.
|
||||
or just the global available pillars. This function assumes
|
||||
that no minion has the id ``*``.
|
||||
|
||||
CLI Example:
|
||||
|
||||
|
@ -71,7 +71,7 @@ def show_pillar(minion='*', **kwargs):
|
|||
opts = salt.config.master_config('/etc/salt/master')
|
||||
runner = salt.runner.RunnerClient(opts)
|
||||
pillar = runner.cmd('pillar.show_pillar', [])
|
||||
print pillar¬
|
||||
print(pillar)
|
||||
'''
|
||||
|
||||
saltenv = 'base'
|
||||
|
|
|
@ -10,6 +10,7 @@ import random
|
|||
import string
|
||||
|
||||
# Import Salt Testing Libs
|
||||
from salttesting import skipIf
|
||||
from salttesting.helpers import ensure_in_syspath, expensiveTest
|
||||
|
||||
ensure_in_syspath('../../../')
|
||||
|
@ -36,6 +37,8 @@ INSTANCE_NAME = __random_name()
|
|||
PROVIDER_NAME = 'digital_ocean'
|
||||
|
||||
|
||||
@skipIf(True, 'Valid provider configs are not available for the DigitalOcean v1 API '
|
||||
'in conjunction with the configs needed for v2 API.')
|
||||
class DigitalOceanTest(integration.ShellCase):
|
||||
'''
|
||||
Integration tests for the DigitalOcean cloud provider in Salt-Cloud
|
||||
|
@ -85,7 +88,6 @@ class DigitalOceanTest(integration.ShellCase):
|
|||
Tests the return of running the --list-images command for digital ocean
|
||||
'''
|
||||
image_list = self.run_cloud('--list-images {0}'.format(PROVIDER_NAME))
|
||||
|
||||
self.assertIn(
|
||||
'14.04 x64',
|
||||
[i.strip() for i in image_list]
|
||||
|
@ -96,7 +98,6 @@ class DigitalOceanTest(integration.ShellCase):
|
|||
Tests the return of running the --list-locations command for digital ocean
|
||||
'''
|
||||
_list_locations = self.run_cloud('--list-locations {0}'.format(PROVIDER_NAME))
|
||||
|
||||
self.assertIn(
|
||||
'San Francisco 1',
|
||||
[i.strip() for i in _list_locations]
|
||||
|
@ -106,11 +107,10 @@ class DigitalOceanTest(integration.ShellCase):
|
|||
'''
|
||||
Tests the return of running the --list-sizes command for digital ocean
|
||||
'''
|
||||
_list_size = self.run_cloud('--list-sizes {0}'.format(PROVIDER_NAME))
|
||||
|
||||
_list_sizes = self.run_cloud('--list-sizes {0}'.format(PROVIDER_NAME))
|
||||
self.assertIn(
|
||||
'16gb',
|
||||
[i.strip() for i in _list_size]
|
||||
[i.strip() for i in _list_sizes]
|
||||
)
|
||||
|
||||
def test_instance(self):
|
||||
|
|
|
@ -30,6 +30,7 @@ def __random_name(size=6):
|
|||
|
||||
# Create the cloud instance name to be used throughout the tests
|
||||
INSTANCE_NAME = __random_name()
|
||||
PROVIDER_NAME = 'ec2'
|
||||
|
||||
|
||||
@skipIf(True, 'Skipping until we can figure out why the testrunner bails.')
|
||||
|
@ -46,33 +47,35 @@ class EC2Test(integration.ShellCase):
|
|||
super(EC2Test, self).setUp()
|
||||
|
||||
# check if appropriate cloud provider and profile files are present
|
||||
profile_str = 'ec2-config:'
|
||||
provider = 'ec2'
|
||||
profile_str = 'ec2-config'
|
||||
providers = self.run_cloud('--list-providers')
|
||||
|
||||
if profile_str not in providers:
|
||||
if profile_str + ':' not in providers:
|
||||
self.skipTest(
|
||||
'Configuration file for {0} was not found. Check {0}.conf files '
|
||||
'in tests/integration/files/conf/cloud.*.d/ to run these tests.'
|
||||
.format(provider)
|
||||
.format(PROVIDER_NAME)
|
||||
)
|
||||
|
||||
# check if id, key, keyname, securitygroup, private_key, location,
|
||||
# and provider are present
|
||||
path = os.path.join(integration.FILES,
|
||||
'conf',
|
||||
'cloud.providers.d',
|
||||
provider + '.conf')
|
||||
config = cloud_providers_config(path)
|
||||
config = cloud_providers_config(
|
||||
os.path.join(
|
||||
integration.FILES,
|
||||
'conf',
|
||||
'cloud.providers.d',
|
||||
PROVIDER_NAME + '.conf'
|
||||
)
|
||||
)
|
||||
|
||||
id = config['ec2-config']['ec2']['id']
|
||||
key = config['ec2-config']['ec2']['key']
|
||||
keyname = config['ec2-config']['ec2']['keyname']
|
||||
sec_group = config['ec2-config']['ec2']['securitygroup']
|
||||
private_key = config['ec2-config']['ec2']['private_key']
|
||||
location = config['ec2-config']['ec2']['location']
|
||||
id_ = config[profile_str][PROVIDER_NAME]['id']
|
||||
key = config[profile_str][PROVIDER_NAME]['key']
|
||||
key_name = config[profile_str][PROVIDER_NAME]['keyname']
|
||||
sec_group = config[profile_str][PROVIDER_NAME]['securitygroup']
|
||||
private_key = config[profile_str][PROVIDER_NAME]['private_key']
|
||||
location = config[profile_str][PROVIDER_NAME]['location']
|
||||
|
||||
conf_items = [id, key, keyname, sec_group, private_key, location]
|
||||
conf_items = [id_, key, key_name, sec_group, private_key, location]
|
||||
missing_conf_item = []
|
||||
|
||||
for item in conf_items:
|
||||
|
@ -84,14 +87,13 @@ class EC2Test(integration.ShellCase):
|
|||
'An id, key, keyname, security group, private key, and location must '
|
||||
'be provided to run these tests. One or more of these elements is '
|
||||
'missing. Check tests/integration/files/conf/cloud.providers.d/{0}.conf'
|
||||
.format(provider)
|
||||
.format(PROVIDER_NAME)
|
||||
)
|
||||
|
||||
def test_instance(self):
|
||||
'''
|
||||
Tests creating and deleting an instance on EC2 (classic)
|
||||
'''
|
||||
|
||||
# create the instance
|
||||
instance = self.run_cloud('-p ec2-test {0}'.format(INSTANCE_NAME))
|
||||
ret_str = '{0}:'.format(INSTANCE_NAME)
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
# Import Python Libs
|
||||
import os
|
||||
import random
|
||||
import string
|
||||
|
||||
# Import Salt Testing Libs
|
||||
from salttesting import skipIf
|
||||
|
@ -17,6 +19,20 @@ import integration
|
|||
from salt.config import cloud_providers_config
|
||||
|
||||
|
||||
def __random_name(size=6):
|
||||
'''
|
||||
Generates a random cloud instance name
|
||||
'''
|
||||
return 'CLOUD-TEST-' + ''.join(
|
||||
random.choice(string.ascii_uppercase + string.digits)
|
||||
for x in range(size)
|
||||
)
|
||||
|
||||
# Create the cloud instance name to be used throughout the tests
|
||||
INSTANCE_NAME = __random_name()
|
||||
PROVIDER_NAME = 'gogrid'
|
||||
|
||||
|
||||
@skipIf(True, 'waiting on bug report fixes from #13365')
|
||||
class GoGridTest(integration.ShellCase):
|
||||
'''
|
||||
|
@ -31,53 +47,53 @@ class GoGridTest(integration.ShellCase):
|
|||
super(GoGridTest, self).setUp()
|
||||
|
||||
# check if appropriate cloud provider and profile files are present
|
||||
profile_str = 'gogrid-config:'
|
||||
provider = 'gogrid'
|
||||
profile_str = 'gogrid-config'
|
||||
providers = self.run_cloud('--list-providers')
|
||||
if profile_str not in providers:
|
||||
if profile_str + ':' not in providers:
|
||||
self.skipTest(
|
||||
'Configuration file for {0} was not found. Check {0}.conf files '
|
||||
'in tests/integration/files/conf/cloud.*.d/ to run these tests.'
|
||||
.format(provider)
|
||||
.format(PROVIDER_NAME)
|
||||
)
|
||||
|
||||
# check if client_key and api_key are present
|
||||
path = os.path.join(integration.FILES,
|
||||
'conf',
|
||||
'cloud.providers.d',
|
||||
provider + '.conf')
|
||||
config = cloud_providers_config(path)
|
||||
api = config['gogrid-config']['gogrid']['apikey']
|
||||
shared_secret = config['gogrid-config']['gogrid']['sharedsecret']
|
||||
config = cloud_providers_config(
|
||||
os.path.join(
|
||||
integration.FILES,
|
||||
'conf',
|
||||
'cloud.providers.d',
|
||||
PROVIDER_NAME + '.conf'
|
||||
)
|
||||
)
|
||||
api = config[profile_str][PROVIDER_NAME]['apikey']
|
||||
shared_secret = config[profile_str][PROVIDER_NAME]['sharedsecret']
|
||||
if api == '' or shared_secret == '':
|
||||
self.skipTest(
|
||||
'An api key and shared secret must be provided to run these tests. '
|
||||
'Check tests/integration/files/conf/cloud.providers.d/{0}.conf'
|
||||
.format(provider)
|
||||
.format(PROVIDER_NAME)
|
||||
)
|
||||
|
||||
def test_instance(self):
|
||||
'''
|
||||
Test creating an instance on GoGrid
|
||||
'''
|
||||
name = 'gogrid-testing'
|
||||
|
||||
# create the instance
|
||||
instance = self.run_cloud('-p gogrid-test {0}'.format(name))
|
||||
ret_str = ' {0}'.format(name)
|
||||
|
||||
# check if instance with salt installed returned
|
||||
try:
|
||||
self.assertIn(ret_str, instance)
|
||||
self.assertIn(
|
||||
INSTANCE_NAME,
|
||||
[i.strip() for i in self.run_cloud('-p gogrid-test {0}'.format(INSTANCE_NAME))]
|
||||
)
|
||||
except AssertionError:
|
||||
self.run_cloud('-d {0} --assume-yes'.format(name))
|
||||
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME))
|
||||
raise
|
||||
|
||||
# delete the instance
|
||||
delete = self.run_cloud('-d {0} --assume-yes'.format(name))
|
||||
ret_str = ' True'
|
||||
try:
|
||||
self.assertIn(ret_str, delete)
|
||||
self.assertIn(
|
||||
INSTANCE_NAME + ':',
|
||||
[i.strip() for i in self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME))]
|
||||
)
|
||||
except AssertionError:
|
||||
raise
|
||||
|
||||
|
@ -85,13 +101,12 @@ class GoGridTest(integration.ShellCase):
|
|||
'''
|
||||
Clean up after tests
|
||||
'''
|
||||
name = 'gogrid-testing'
|
||||
query = self.run_cloud('--query')
|
||||
ret_str = ' {0}:'.format(name)
|
||||
ret_str = ' {0}:'.format(INSTANCE_NAME)
|
||||
|
||||
# if test instance is still present, delete it
|
||||
if ret_str in query:
|
||||
self.run_cloud('-d {0} --assume-yes'.format(name))
|
||||
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -37,6 +37,7 @@ def __random_name(size=6):
|
|||
|
||||
# Create the cloud instance name to be used throughout the tests
|
||||
INSTANCE_NAME = __random_name()
|
||||
PROVIDER_NAME = 'linode'
|
||||
|
||||
|
||||
@skipIf(HAS_LIBCLOUD is False, 'salt-cloud requires >= libcloud 0.13.2')
|
||||
|
@ -53,29 +54,31 @@ class LinodeTest(integration.ShellCase):
|
|||
super(LinodeTest, self).setUp()
|
||||
|
||||
# check if appropriate cloud provider and profile files are present
|
||||
profile_str = 'linode-config:'
|
||||
provider = 'linode'
|
||||
profile_str = 'linode-config'
|
||||
providers = self.run_cloud('--list-providers')
|
||||
if profile_str not in providers:
|
||||
if profile_str + ':' not in providers:
|
||||
self.skipTest(
|
||||
'Configuration file for {0} was not found. Check {0}.conf files '
|
||||
'in tests/integration/files/conf/cloud.*.d/ to run these tests.'
|
||||
.format(provider)
|
||||
.format(PROVIDER_NAME)
|
||||
)
|
||||
|
||||
# check if apikey and password are present
|
||||
path = os.path.join(integration.FILES,
|
||||
'conf',
|
||||
'cloud.providers.d',
|
||||
provider + '.conf')
|
||||
config = cloud_providers_config(path)
|
||||
api = config['linode-config']['linode']['apikey']
|
||||
password = config['linode-config']['linode']['password']
|
||||
config = cloud_providers_config(
|
||||
os.path.join(
|
||||
integration.FILES,
|
||||
'conf',
|
||||
'cloud.providers.d',
|
||||
PROVIDER_NAME + '.conf'
|
||||
)
|
||||
)
|
||||
api = config[profile_str][PROVIDER_NAME]['apikey']
|
||||
password = config[profile_str][PROVIDER_NAME]['password']
|
||||
if api == '' or password == '':
|
||||
self.skipTest(
|
||||
'An api key and password must be provided to run these tests. Check '
|
||||
'tests/integration/files/conf/cloud.providers.d/{0}.conf'.format(
|
||||
provider
|
||||
PROVIDER_NAME
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -83,22 +86,22 @@ class LinodeTest(integration.ShellCase):
|
|||
'''
|
||||
Test creating an instance on Linode
|
||||
'''
|
||||
# create the instance
|
||||
instance = self.run_cloud('-p linode-test {0}'.format(INSTANCE_NAME))
|
||||
ret_str = ' {0}'.format(INSTANCE_NAME)
|
||||
|
||||
# check if instance with salt installed returned
|
||||
try:
|
||||
self.assertIn(ret_str, instance)
|
||||
self.assertIn(
|
||||
INSTANCE_NAME,
|
||||
[i.strip() for i in self.run_cloud('-p linode-test {0}'.format(INSTANCE_NAME))]
|
||||
)
|
||||
except AssertionError:
|
||||
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME))
|
||||
raise
|
||||
|
||||
# delete the instance
|
||||
delete = self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME))
|
||||
ret_str = ' True'
|
||||
try:
|
||||
self.assertIn(ret_str, delete)
|
||||
self.assertIn(
|
||||
INSTANCE_NAME + ':',
|
||||
[i.strip() for i in self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME))]
|
||||
)
|
||||
except AssertionError:
|
||||
raise
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ def __random_name(size=6):
|
|||
|
||||
# Create the cloud instance name to be used throughout the tests
|
||||
INSTANCE_NAME = __random_name()
|
||||
PROVIDER_NAME = 'azure'
|
||||
PROFILE_NAME = 'azure-test'
|
||||
|
||||
|
||||
@skipIf(HAS_AZURE is False, 'These tests require azure to be installed.')
|
||||
|
@ -53,50 +55,55 @@ class AzureTest(integration.ShellCase):
|
|||
super(AzureTest, self).setUp()
|
||||
|
||||
# check if appropriate cloud provider and profile files are present
|
||||
profile_str = 'azure-config:'
|
||||
provider = 'azure'
|
||||
provider_str = 'azure-config'
|
||||
providers = self.run_cloud('--list-providers')
|
||||
if profile_str not in providers:
|
||||
if provider_str + ':' not in providers:
|
||||
self.skipTest(
|
||||
'Configuration file for {0} was not found. Check {0}.conf files '
|
||||
'in tests/integration/files/conf/cloud.*.d/ to run these tests.'
|
||||
.format(provider)
|
||||
.format(PROVIDER_NAME)
|
||||
)
|
||||
|
||||
# check if subscription_id and certificate_path are present in provider file
|
||||
provider_path = os.path.join(integration.FILES,
|
||||
'conf',
|
||||
'cloud.providers.d',
|
||||
provider + '.conf')
|
||||
provider_config = cloud_providers_config(provider_path)
|
||||
sub_id = provider_config['azure-config']['azure']['subscription_id']
|
||||
cert_path = provider_config['azure-config']['azure']['certificate_path']
|
||||
provider_config = cloud_providers_config(
|
||||
os.path.join(
|
||||
integration.FILES,
|
||||
'conf',
|
||||
'cloud.providers.d',
|
||||
PROVIDER_NAME + '.conf'
|
||||
)
|
||||
)
|
||||
sub_id = provider_config[provider_str][PROVIDER_NAME]['subscription_id']
|
||||
cert_path = provider_config[provider_str][PROVIDER_NAME]['certificate_path']
|
||||
if sub_id == '' or cert_path == '':
|
||||
self.skipTest(
|
||||
'A subscription_id and certificate_path must be provided to run '
|
||||
'these tests. Check '
|
||||
'tests/integration/files/conf/cloud.providers.d/{0}.conf'.format(
|
||||
provider
|
||||
PROVIDER_NAME
|
||||
)
|
||||
)
|
||||
|
||||
# check if ssh_username, ssh_password, and media_link are present
|
||||
# in the azure configuration file
|
||||
profile_path = os.path.join(integration.FILES,
|
||||
'conf',
|
||||
'cloud.profiles.d',
|
||||
provider + '.conf')
|
||||
profile_config = cloud_providers_config(profile_path)
|
||||
ssh_user = profile_config['azure-test']['azure-config']['ssh_username']
|
||||
ssh_pass = profile_config['azure-test']['azure-config']['ssh_password']
|
||||
media_link = profile_config['azure-test']['azure-config']['media_link']
|
||||
profile_config = cloud_providers_config(
|
||||
os.path.join(
|
||||
integration.FILES,
|
||||
'conf',
|
||||
'cloud.profiles.d',
|
||||
PROVIDER_NAME + '.conf'
|
||||
)
|
||||
)
|
||||
ssh_user = profile_config[PROFILE_NAME][provider_str]['ssh_username']
|
||||
ssh_pass = profile_config[PROFILE_NAME][provider_str]['ssh_password']
|
||||
media_link = profile_config[PROFILE_NAME][provider_str]['media_link']
|
||||
|
||||
if ssh_user == '' or ssh_pass == '' or media_link == '':
|
||||
self.skipTest(
|
||||
'An ssh_username, ssh_password, and media_link must be provided to run '
|
||||
'these tests. One or more of these elements is missing. Check '
|
||||
'tests/integration/files/conf/cloud.profiles.d/{0}.conf'.format(
|
||||
provider
|
||||
PROVIDER_NAME
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -104,22 +111,31 @@ class AzureTest(integration.ShellCase):
|
|||
'''
|
||||
Test creating an instance on Azure
|
||||
'''
|
||||
# create the instance
|
||||
instance = self.run_cloud('-p azure-test {0}'.format(INSTANCE_NAME))
|
||||
ret_str = ' {0}'.format(INSTANCE_NAME)
|
||||
|
||||
# check if instance installed salt and returned correctly
|
||||
# check if instance with salt installed returned
|
||||
try:
|
||||
self.assertIn(ret_str, instance)
|
||||
self.assertIn(
|
||||
INSTANCE_NAME,
|
||||
[i.strip() for i in self.run_cloud(
|
||||
'-p {0} {1}'.format(
|
||||
PROFILE_NAME,
|
||||
INSTANCE_NAME
|
||||
)
|
||||
)]
|
||||
)
|
||||
except AssertionError:
|
||||
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME))
|
||||
raise
|
||||
|
||||
# delete the instance
|
||||
delete = self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME))
|
||||
not_deleted = 'No machines were found to be destroyed'
|
||||
try:
|
||||
self.assertNotEqual(not_deleted, delete)
|
||||
self.assertIn(
|
||||
INSTANCE_NAME + ':',
|
||||
[i.strip() for i in self.run_cloud(
|
||||
'-d {0} --assume-yes'.format(
|
||||
INSTANCE_NAME
|
||||
)
|
||||
)]
|
||||
)
|
||||
except AssertionError:
|
||||
raise
|
||||
|
||||
|
|
|
@ -37,6 +37,8 @@ def __random_name(size=6):
|
|||
|
||||
# Create the cloud instance name to be used throughout the tests
|
||||
INSTANCE_NAME = __random_name()
|
||||
PROVIDER_NAME = 'rackspace'
|
||||
DRIVER = 'openstack'
|
||||
|
||||
|
||||
@skipIf(HAS_LIBCLOUD is False, 'salt-cloud requires >= libcloud 0.13.2')
|
||||
|
@ -53,53 +55,54 @@ class RackspaceTest(integration.ShellCase):
|
|||
super(RackspaceTest, self).setUp()
|
||||
|
||||
# check if appropriate cloud provider and profile files are present
|
||||
profile_str = 'rackspace-config:'
|
||||
provider = 'rackspace'
|
||||
profile_str = 'rackspace-config'
|
||||
providers = self.run_cloud('--list-providers')
|
||||
if profile_str not in providers:
|
||||
if profile_str + ':' not in providers:
|
||||
self.skipTest(
|
||||
'Configuration file for {0} was not found. Check {0}.conf files '
|
||||
'in tests/integration/files/conf/cloud.*.d/ to run these tests.'
|
||||
.format(provider)
|
||||
.format(PROVIDER_NAME)
|
||||
)
|
||||
|
||||
# check if api key, user, and tenant are present
|
||||
path = os.path.join(integration.FILES,
|
||||
'conf',
|
||||
'cloud.providers.d',
|
||||
provider + '.conf')
|
||||
config = cloud_providers_config(path)
|
||||
user = config['rackspace-config']['openstack']['user']
|
||||
tenant = config['rackspace-config']['openstack']['tenant']
|
||||
api = config['rackspace-config']['openstack']['apikey']
|
||||
config = cloud_providers_config(
|
||||
os.path.join(
|
||||
integration.FILES,
|
||||
'conf',
|
||||
'cloud.providers.d',
|
||||
PROVIDER_NAME + '.conf'
|
||||
)
|
||||
)
|
||||
user = config[profile_str][DRIVER]['user']
|
||||
tenant = config[profile_str][DRIVER]['tenant']
|
||||
api = config[profile_str][DRIVER]['apikey']
|
||||
if api == '' or tenant == '' or user == '':
|
||||
self.skipTest(
|
||||
'A user, tenant, and an api key must be provided to run these '
|
||||
'tests. Check tests/integration/files/conf/cloud.providers.d/{0}.conf'
|
||||
.format(provider)
|
||||
.format(PROVIDER_NAME)
|
||||
)
|
||||
|
||||
def test_instance(self):
|
||||
'''
|
||||
Test creating an instance on rackspace with the openstack driver
|
||||
'''
|
||||
|
||||
# create the instance
|
||||
instance = self.run_cloud('-p rackspace-test {0}'.format(INSTANCE_NAME))
|
||||
ret = ' {0}'.format(INSTANCE_NAME)
|
||||
|
||||
# check if instance with salt installed returned successfully
|
||||
# check if instance with salt installed returned
|
||||
try:
|
||||
self.assertIn(ret, instance)
|
||||
self.assertIn(
|
||||
INSTANCE_NAME,
|
||||
[i.strip() for i in self.run_cloud('-p rackspace-test {0}'.format(INSTANCE_NAME))]
|
||||
)
|
||||
except AssertionError:
|
||||
self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME))
|
||||
raise
|
||||
|
||||
# delete the instance
|
||||
delete = self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME))
|
||||
ret = ' True'
|
||||
try:
|
||||
self.assertIn(ret, delete)
|
||||
self.assertIn(
|
||||
INSTANCE_NAME + ':',
|
||||
[i.strip() for i in self.run_cloud('-d {0} --assume-yes'.format(INSTANCE_NAME))]
|
||||
)
|
||||
except AssertionError:
|
||||
raise
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue