Adds endpoint to --fromenv deployment creation
Will read os-endpoint from environment variables. Fixes some typos in related docstring as well. Change-Id: I853a181130b7da885392211515784bdf93249774
This commit is contained in:
parent
c6484daca1
commit
8207d9dd43
@ -59,12 +59,14 @@ class DeploymentCommands(object):
|
||||
for you with Devstack or Fuel. For this purposes different deployment
|
||||
engines are developed.
|
||||
|
||||
If you use ExistionCloud deployment engine you can pass deployment
|
||||
If you use ExistingCloud deployment engine you can pass deployment
|
||||
config by environment variables:
|
||||
OS_USERNAME
|
||||
OS_PASSWORD
|
||||
OS_AUTH_URL
|
||||
OS_TENANT_NAME
|
||||
OS_ENDPOINT
|
||||
OS_REGION_NAME
|
||||
|
||||
All other deployment engines need more complex configuration data, so
|
||||
it should be stored in configuration file.
|
||||
@ -72,7 +74,7 @@ class DeploymentCommands(object):
|
||||
You can use physical servers, lxc containers, KVM virtual machines
|
||||
or virtual machines in OpenStack for deploying the cloud in.
|
||||
Except physical servers, Rally can create cluster nodes for you.
|
||||
Interaction with virtualisation software, OpenStack
|
||||
Interaction with virtualization software, OpenStack
|
||||
cloud or physical servers is provided by server providers.
|
||||
|
||||
:param fromenv: boolean, read environment instead of config file
|
||||
@ -94,6 +96,7 @@ class DeploymentCommands(object):
|
||||
config = {
|
||||
"type": "ExistingCloud",
|
||||
"auth_url": os.environ["OS_AUTH_URL"],
|
||||
"endpoint": os.environ.get("OS_ENDPOINT"),
|
||||
"admin": {
|
||||
"username": os.environ["OS_USERNAME"],
|
||||
"password": os.environ["OS_PASSWORD"],
|
||||
@ -266,6 +269,9 @@ class DeploymentCommands(object):
|
||||
if endpoint.get("region_name"):
|
||||
env_file.write("export OS_REGION_NAME=%(region_name)s\n"
|
||||
% endpoint)
|
||||
if endpoint.get("endpoint"):
|
||||
env_file.write("export OS_ENDPOINT=%(endpoint)s\n"
|
||||
% endpoint)
|
||||
expanded_path = os.path.expanduser("~/.rally/openrc")
|
||||
if os.path.exists(expanded_path):
|
||||
os.remove(expanded_path)
|
||||
|
@ -45,6 +45,7 @@ class DeploymentCommandsTestCase(test.TestCase):
|
||||
"OS_PASSWORD": "fake_password",
|
||||
"OS_TENANT_NAME": "fake_tenant_name",
|
||||
"OS_REGION_NAME": "fake_region_name",
|
||||
"OS_ENDPOINT": "fake_endpoint",
|
||||
"RALLY_DEPLOYMENT": "fake_deployment_id"})
|
||||
@mock.patch("rally.cmd.commands.deployment.api.Deployment.create")
|
||||
@mock.patch("rally.cmd.commands.deployment.DeploymentCommands.list")
|
||||
@ -55,6 +56,7 @@ class DeploymentCommandsTestCase(test.TestCase):
|
||||
"type": "ExistingCloud",
|
||||
"auth_url": "fake_auth_url",
|
||||
"region_name": "fake_region_name",
|
||||
"endpoint": "fake_endpoint",
|
||||
"admin": {
|
||||
"username": "fake_username",
|
||||
"password": "fake_password",
|
||||
@ -221,6 +223,7 @@ class DeploymentCommandsTestCase(test.TestCase):
|
||||
"username": "fake_username",
|
||||
"password": "fake_password",
|
||||
"tenant_name": "fake_tenant_name",
|
||||
"endpoint": "fake_endpoint",
|
||||
"region_name": None}
|
||||
|
||||
with mock.patch("rally.cmd.commands.deployment.open", mock.mock_open(),
|
||||
@ -230,7 +233,9 @@ class DeploymentCommandsTestCase(test.TestCase):
|
||||
mock_env.assert_called_once_with(os.path.expanduser(
|
||||
"~/.rally/globals"),
|
||||
"RALLY_DEPLOYMENT", "%s\n" % deployment_id)
|
||||
mock_file.return_value.write.assert_called_once_with(
|
||||
mock_file.return_value.write.assert_any_call(
|
||||
"export OS_ENDPOINT=fake_endpoint\n")
|
||||
mock_file.return_value.write.assert_any_call(
|
||||
"export OS_AUTH_URL=fake_auth_url\n"
|
||||
"export OS_USERNAME=fake_username\n"
|
||||
"export OS_PASSWORD=fake_password\n"
|
||||
|
Loading…
Reference in New Issue
Block a user