Diff fails if stack Ignore parameter set to True
goopilot opened this issue · 4 comments
Subject of the issue
When running "sceptre diff" on a stack with ignore
set to True
, getting an error message "ValueError: max() arg is an empty sequence"
Your environment
$ sceptre --version
Sceptre, version 4.4.2
$ python --version
Python 3.8.10
OS: Windows
Steps to reproduce
Set ignore to Trues for any sceptre project:
template:
type: file
path: XXXX.yaml
ignore: True
Expected behaviour
Stack should be ignored with corresponding message
Actual behaviour
$ sceptre --var-file vars.yaml --var runlocal=true diff XXXX/YYYYY
Traceback (most recent call last):
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\asalamatov\AppData\Local\Programs\Python\Python38\Scripts\sceptre.exe_main.py", line 7, in
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1157, in call
return self.main(*args, **kwargs)
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\site-packages\click\decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\site-packages\sceptre\cli\helpers.py", line 46, in decorated
return func(*args, **kwargs)
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\site-packages\sceptre\cli\diff.py", line 142 File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\site-packages\click\decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\site-packages\sceptre\cli\helpers.py", line 46, in decorated
return func(*args, **kwargs)
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\site-packages\sceptre\cli\diff.py", line 142, in diff_command
num_stacks_with_diff = output_diffs(
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\site-packages\sceptre\cli\diff.py", line 176, in output_diffs
output_buffer_with_normalized_bar_lengths(line_buffer, output_buffer)
File "c:\users\asalamatov\appdata\local\programs\python\python38\lib\site-packages\sceptre\cli\diff.py", line 190, in output_buffer_with_normalized_bar_lengths
max_length = len(max(buffer, key=len))
ValueError: max() arg is an empty sequence
The Sceptre docs says.. The ignore configuration only applies to the launch command. You can still run create, update, or delete commands on a stack marked with ignore: True; these commands will ignore the ignore setting and act upon the stack the same as any other.
.
@goopilot I think we can agree that Sceptre should not throw an exception in this case. Do you expect ignore to support the diff
command as well?
@zaro0508 Thanks for the quick response.
Yes I expect that any command run on a stack with any valid configuration should not throw an exception.
My use case is a pipeline which is running diff
as a first step on a folder with whole bunch of stacks and since some major stacks have ignore
the whole pipeline fails.
I did quick workaround for myself (#1463) but now as you mentioned that diff
doesn't support ignore
, I think more work need to be done to add ignore
implementation for diff
.
Any chance you are still planning on sending in a PR @goopilot ?