[CLI] Allow changing deployment config on recreate
* Added --filename option to deployment recreate that will update configuration from provided file. Change-Id: Icefca03fd86ab8977d0910bf192187c713cb355f
This commit is contained in:
parent
fc19ac052a
commit
a80b16a01b
@ -23,7 +23,7 @@ _rally()
|
||||
OPTS["deployment_create"]="--name --fromenv --filename --no-use"
|
||||
OPTS["deployment_destroy"]="--deployment"
|
||||
OPTS["deployment_list"]=""
|
||||
OPTS["deployment_recreate"]="--deployment"
|
||||
OPTS["deployment_recreate"]="--filename --deployment"
|
||||
OPTS["deployment_show"]="--deployment"
|
||||
OPTS["deployment_use"]="--deployment"
|
||||
OPTS["plugin_list"]="--name --namespace --plugin-base"
|
||||
|
@ -83,6 +83,18 @@ class DeploymentTestCase(unittest.TestCase):
|
||||
self.rally("deployment recreate --deployment t_create_env")
|
||||
self.assertIn("t_create_env", self.rally("deployment list"))
|
||||
|
||||
def test_recreate_from_file(self):
|
||||
self.rally.env.update(utils.TEST_ENV)
|
||||
self.rally("deployment create --name t_create_env --fromenv")
|
||||
config = json.loads(self.rally("deployment config"))
|
||||
config["auth_url"] = "http://foo/"
|
||||
file = utils.JsonTempFile(config)
|
||||
self.rally("deployment recreate --deployment t_create_env "
|
||||
"--filename %s" % file.filename)
|
||||
self.assertIn("t_create_env", self.rally("deployment list"))
|
||||
self.assertEqual(config,
|
||||
json.loads(self.rally("deployment config")))
|
||||
|
||||
def test_use(self):
|
||||
self.rally.env.update(utils.TEST_ENV)
|
||||
output = self.rally(
|
||||
|
@ -53,7 +53,7 @@ class RallyCliError(Exception):
|
||||
return self.msg
|
||||
|
||||
|
||||
class TaskConfig(object):
|
||||
class JsonTempFile(object):
|
||||
|
||||
def __init__(self, config):
|
||||
config_file = tempfile.NamedTemporaryFile(delete=False)
|
||||
@ -65,6 +65,10 @@ class TaskConfig(object):
|
||||
os.unlink(self.filename)
|
||||
|
||||
|
||||
class TaskConfig(JsonTempFile):
|
||||
pass
|
||||
|
||||
|
||||
class Rally(object):
|
||||
"""Create and represent separate rally installation.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user