diff --git a/etc/rally.bash_completion b/etc/rally.bash_completion index 40b57ec3..5e630852 100644 --- a/etc/rally.bash_completion +++ b/etc/rally.bash_completion @@ -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" diff --git a/tests/functional/test_cli_deployment.py b/tests/functional/test_cli_deployment.py index 748ea8dd..8f9d6fa3 100644 --- a/tests/functional/test_cli_deployment.py +++ b/tests/functional/test_cli_deployment.py @@ -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( diff --git a/tests/functional/utils.py b/tests/functional/utils.py index 12f3cf25..a2385cc6 100644 --- a/tests/functional/utils.py +++ b/tests/functional/utils.py @@ -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.