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
|
for you with Devstack or Fuel. For this purposes different deployment
|
||||||
engines are developed.
|
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:
|
config by environment variables:
|
||||||
OS_USERNAME
|
OS_USERNAME
|
||||||
OS_PASSWORD
|
OS_PASSWORD
|
||||||
OS_AUTH_URL
|
OS_AUTH_URL
|
||||||
OS_TENANT_NAME
|
OS_TENANT_NAME
|
||||||
|
OS_ENDPOINT
|
||||||
|
OS_REGION_NAME
|
||||||
|
|
||||||
All other deployment engines need more complex configuration data, so
|
All other deployment engines need more complex configuration data, so
|
||||||
it should be stored in configuration file.
|
it should be stored in configuration file.
|
||||||
@ -72,7 +74,7 @@ class DeploymentCommands(object):
|
|||||||
You can use physical servers, lxc containers, KVM virtual machines
|
You can use physical servers, lxc containers, KVM virtual machines
|
||||||
or virtual machines in OpenStack for deploying the cloud in.
|
or virtual machines in OpenStack for deploying the cloud in.
|
||||||
Except physical servers, Rally can create cluster nodes for you.
|
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.
|
cloud or physical servers is provided by server providers.
|
||||||
|
|
||||||
:param fromenv: boolean, read environment instead of config file
|
:param fromenv: boolean, read environment instead of config file
|
||||||
@ -94,6 +96,7 @@ class DeploymentCommands(object):
|
|||||||
config = {
|
config = {
|
||||||
"type": "ExistingCloud",
|
"type": "ExistingCloud",
|
||||||
"auth_url": os.environ["OS_AUTH_URL"],
|
"auth_url": os.environ["OS_AUTH_URL"],
|
||||||
|
"endpoint": os.environ.get("OS_ENDPOINT"),
|
||||||
"admin": {
|
"admin": {
|
||||||
"username": os.environ["OS_USERNAME"],
|
"username": os.environ["OS_USERNAME"],
|
||||||
"password": os.environ["OS_PASSWORD"],
|
"password": os.environ["OS_PASSWORD"],
|
||||||
@ -266,6 +269,9 @@ class DeploymentCommands(object):
|
|||||||
if endpoint.get("region_name"):
|
if endpoint.get("region_name"):
|
||||||
env_file.write("export OS_REGION_NAME=%(region_name)s\n"
|
env_file.write("export OS_REGION_NAME=%(region_name)s\n"
|
||||||
% endpoint)
|
% endpoint)
|
||||||
|
if endpoint.get("endpoint"):
|
||||||
|
env_file.write("export OS_ENDPOINT=%(endpoint)s\n"
|
||||||
|
% endpoint)
|
||||||
expanded_path = os.path.expanduser("~/.rally/openrc")
|
expanded_path = os.path.expanduser("~/.rally/openrc")
|
||||||
if os.path.exists(expanded_path):
|
if os.path.exists(expanded_path):
|
||||||
os.remove(expanded_path)
|
os.remove(expanded_path)
|
||||||
|
@ -45,6 +45,7 @@ class DeploymentCommandsTestCase(test.TestCase):
|
|||||||
"OS_PASSWORD": "fake_password",
|
"OS_PASSWORD": "fake_password",
|
||||||
"OS_TENANT_NAME": "fake_tenant_name",
|
"OS_TENANT_NAME": "fake_tenant_name",
|
||||||
"OS_REGION_NAME": "fake_region_name",
|
"OS_REGION_NAME": "fake_region_name",
|
||||||
|
"OS_ENDPOINT": "fake_endpoint",
|
||||||
"RALLY_DEPLOYMENT": "fake_deployment_id"})
|
"RALLY_DEPLOYMENT": "fake_deployment_id"})
|
||||||
@mock.patch("rally.cmd.commands.deployment.api.Deployment.create")
|
@mock.patch("rally.cmd.commands.deployment.api.Deployment.create")
|
||||||
@mock.patch("rally.cmd.commands.deployment.DeploymentCommands.list")
|
@mock.patch("rally.cmd.commands.deployment.DeploymentCommands.list")
|
||||||
@ -55,6 +56,7 @@ class DeploymentCommandsTestCase(test.TestCase):
|
|||||||
"type": "ExistingCloud",
|
"type": "ExistingCloud",
|
||||||
"auth_url": "fake_auth_url",
|
"auth_url": "fake_auth_url",
|
||||||
"region_name": "fake_region_name",
|
"region_name": "fake_region_name",
|
||||||
|
"endpoint": "fake_endpoint",
|
||||||
"admin": {
|
"admin": {
|
||||||
"username": "fake_username",
|
"username": "fake_username",
|
||||||
"password": "fake_password",
|
"password": "fake_password",
|
||||||
@ -221,6 +223,7 @@ class DeploymentCommandsTestCase(test.TestCase):
|
|||||||
"username": "fake_username",
|
"username": "fake_username",
|
||||||
"password": "fake_password",
|
"password": "fake_password",
|
||||||
"tenant_name": "fake_tenant_name",
|
"tenant_name": "fake_tenant_name",
|
||||||
|
"endpoint": "fake_endpoint",
|
||||||
"region_name": None}
|
"region_name": None}
|
||||||
|
|
||||||
with mock.patch("rally.cmd.commands.deployment.open", mock.mock_open(),
|
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(
|
mock_env.assert_called_once_with(os.path.expanduser(
|
||||||
"~/.rally/globals"),
|
"~/.rally/globals"),
|
||||||
"RALLY_DEPLOYMENT", "%s\n" % deployment_id)
|
"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_AUTH_URL=fake_auth_url\n"
|
||||||
"export OS_USERNAME=fake_username\n"
|
"export OS_USERNAME=fake_username\n"
|
||||||
"export OS_PASSWORD=fake_password\n"
|
"export OS_PASSWORD=fake_password\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user