Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff fails if stack Ignore parameter set to True #1462

Open
goopilot opened this issue Apr 29, 2024 · 4 comments
Open

Diff fails if stack Ignore parameter set to True #1462

goopilot opened this issue Apr 29, 2024 · 4 comments

Comments

@goopilot
Copy link

goopilot commented Apr 29, 2024

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

@zaro0508
Copy link
Contributor

zaro0508 commented May 2, 2024

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?

@goopilot
Copy link
Author

goopilot commented May 2, 2024

@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.

@alex-harvey-z3q
Copy link
Contributor

Any chance you are still planning on sending in a PR @goopilot ?

@goopilot
Copy link
Author

goopilot commented Sep 4, 2024

Any chance you are still planning on sending in a PR @goopilot ?

The chance is around 0% I'm more of a user of the sceptre than a developer. But I'd appreciate if somebody can take this over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants