Not enough values to unpack given a badly formatted stack ref
alex-harvey-z3q opened this issue · comments
Subject of the issue
If a stack output is incorrectly formatted, and missing ::
, a confusing and unhandled exception is seen:
[2023-11-24 01:53:39] - REDACTED - Successfully initiated creation of Change Set 'sceptre-foundations-3551-834819d8978ad61146f7c9d9d30cae792d4fe192'
Traceback (most recent call last):
File "/usr/local/bin/sceptre", line 8, in <module>
sys.exit(cli())
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/sceptre/cli/helpers.py", line 46, in decorated
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/sceptre/cli/create.py", line 49, in create_command
plan.create_change_set(change_set_name)
File "/usr/local/lib/python3.10/site-packages/sceptre/plan/plan.py", line 286, in create_change_set
return self._execute(*args)
File "/usr/local/lib/python3.10/site-packages/sceptre/plan/plan.py", line 30, in wrapped
return func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/sceptre/plan/plan.py", line 56, in _execute
return executor.execute(*args)
File "/usr/local/lib/python3.10/site-packages/sceptre/plan/executor.py", line 52, in execute
stack, status = future.result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.__get_result()
File "/usr/local/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result
raise self._exception
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.10/site-packages/sceptre/plan/executor.py", line 59, in _execute
result = getattr(actions, self.command)(*args)
File "/usr/local/lib/python3.10/site-packages/sceptre/hooks/__init__.py", line 95, in decorated
response = func(self, *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/sceptre/plan/actions.py", line 445, in create_change_set
"Parameters": self._format_parameters(self.stack.parameters),
File "/usr/local/lib/python3.10/site-packages/sceptre/resolvers/__init__.py", line 321, in __get__
container = super().__get__(stack, stack_class)
File "/usr/local/lib/python3.10/site-packages/sceptre/resolvers/__init__.py", line 230, in __get__
return self.get_resolved_value(stack, stack_class)
File "/usr/local/lib/python3.10/site-packages/sceptre/resolvers/__init__.py", line 371, in get_resolved_value
_call_func_on_values(resolve, container, Resolver)
File "/usr/local/lib/python3.10/site-packages/sceptre/helpers.py", line 91, in _call_func_on_values
func_on_instance(key)
File "/usr/local/lib/python3.10/site-packages/sceptre/helpers.py", line 85, in func_on_instance
func(attr, key, value)
File "/usr/local/lib/python3.10/site-packages/sceptre/resolvers/__init__.py", line 345, in resolve
result = self.resolve_resolver_value(value)
File "/usr/local/lib/python3.10/site-packages/sceptre/resolvers/__init__.py", line 2[84](https://github.com/REDACTED/actions/runs/6975938755/job/18983741778?pr=3551#step:9:86), in resolve_resolver_value
return resolver.resolve()
File "/usr/local/lib/python3.10/site-packages/sceptre/resolvers/stack_output.py", line 176, in resolve
dependency_stack_name, output_key = stack_argument.split("::")
ValueError: not enough values to unpack (expected 2, got 1)
Your environment
- version of sceptre (sceptre --version) 4.3.0
- version of python (python --version) 3.10
- which OS/distro
Steps to reproduce
Create a stack reference like
!stack_output_external myStackName
Noting that this is incomplete and missing the ::
.
Expected behaviour
It should error out with a more helpful error message informing the expected format of the reference compared to the actual format.
Actual behaviour
ValueError: not enough values to unpack (expected 2, got 1)