diff --git a/heatclient/tests/unit/test_shell.py b/heatclient/tests/unit/test_shell.py index 508602e1..ad0a0b6b 100644 --- a/heatclient/tests/unit/test_shell.py +++ b/heatclient/tests/unit/test_shell.py @@ -1834,6 +1834,37 @@ class ShellTestUserPass(ShellBase): for r in required: self.assertRegexpMatches(adopt_text, r) + def test_stack_adopt_with_environment(self): + self.register_keystone_auth_fixture() + resp = fakes.FakeHTTPResponse( + 201, + 'Created', + {'location': 'http://no.where/v1/tenant_id/stacks/teststack/1'}, + None) + if self.client is http.HTTPClient: + headers = {'X-Auth-Key': 'password', 'X-Auth-User': 'username'} + else: + headers = {} + if self.client == http.SessionClient: + self.client.request( + '/stacks', 'POST', data=mox.IgnoreArg(), + headers=headers).AndReturn(resp) + else: + self.client.json_request( + 'POST', '/stacks', data=mox.IgnoreArg(), + headers=headers + ).AndReturn((resp, None)) + + fakes.script_heat_list(client=self.client) + self.m.ReplayAll() + + adopt_data_file = os.path.join(TEST_VAR_DIR, 'adopt_stack_data.json') + environment_file = os.path.join(TEST_VAR_DIR, 'environment.json') + self.shell( + 'stack-adopt teststack ' + '--adopt-file=%s ' + '--environment-file=%s' % (adopt_data_file, environment_file)) + def test_stack_adopt_without_data(self): self.register_keystone_auth_fixture() failed_msg = 'Need to specify --adopt-file' diff --git a/heatclient/tests/unit/var/environment.json b/heatclient/tests/unit/var/environment.json new file mode 100644 index 00000000..c56e3b85 --- /dev/null +++ b/heatclient/tests/unit/var/environment.json @@ -0,0 +1,3 @@ +{ + "parameters": {} +} \ No newline at end of file diff --git a/heatclient/v1/shell.py b/heatclient/v1/shell.py index 0c6e87b5..9c76f89e 100644 --- a/heatclient/v1/shell.py +++ b/heatclient/v1/shell.py @@ -193,8 +193,8 @@ def hooks_to_env(env, arg_hooks, hook): help=_('Name of the stack to adopt.')) def do_stack_adopt(hc, args): '''Adopt a stack.''' - env_files, env = template_utils.process_environment_and_files( - env_path=args.environment_file) + env_files, env = template_utils.process_multiple_environments_and_files( + env_paths=args.environment_file) if not args.adopt_file: raise exc.CommandError(_('Need to specify %(arg)s') %