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

List outputs is eating ExpiredToken messages and possibly others #1451

Open
alexharv074 opened this issue Mar 23, 2024 · 0 comments
Open

List outputs is eating ExpiredToken messages and possibly others #1451

alexharv074 opened this issue Mar 23, 2024 · 0 comments

Comments

@alexharv074
Copy link
Contributor

Subject of the issue

I have noticed that when my auth token expires, e.g.

# aws s3 ls 
An error occurred (ExpiredToken) when calling the AssumeRole operation: The security token included in the request is expired

Some Sceptre commands such as list outputs eat this and fail silently. Others don't. For example:

# sceptre --merge-vars --dir=network --var-file=/app/platform-sceptre/stacks/../data/test/common-env.yaml --var-file=/app/platform-sceptre/stacks/../data/test/network-e2e.yaml launch network.yaml -y 
[2024-03-23 10:08:08] - vpc - Launching Stack
"An error occurred (ExpiredToken) when calling the AssumeRole operation: The security token included in the request is expired"

Compared to

# sceptre --merge-vars --dir=network --var-file=/app/platform-sceptre/data/test/common-env.yaml --var-file=/app/platform-sceptre/data/test/network.yaml list outputs network.yaml --export=envvar 
# echo $? 
0

Your environment

  • version of sceptre (sceptre --version) latest
  • version of python (python --version) 3.10
  • which OS/distro Ubuntu

Steps to reproduce

See above.

Expected behaviour

Should see that the token expired.

Actual behaviour

No output.

alexharv074 added a commit to alexharv074/sceptre that referenced this issue Mar 23, 2024
This resolves a bug in `sceptre outputs` where all `ClientError`
exceptions (e.g. `ExpiredToken`) are suppressed, for no apparent reason.

In 682a306, (October 2018, commit
summary "Move Stack operations from Stack to StackActions"), a big
refactor had occurred. That refactor had introduced a public method
`describe` in the `StackActions` class.

A month later, in 182f0b6 (November 2018,
commit summary "Implement algorithm to execute Stacks from StackGraph"),
another big refactor occurred. A part of that refactor was to introduce an
essentially duplicate method `_describe` and then in the
`describe_output` method, catch all `ClientError` exceptions and always
return an empty list.

So far as I can tell, there was no good reason to introduce either the
new method, or catch all `ClientError` exceptions. The suppression of
exceptions may have been accidental, or a hack to get the unit tests to
pass.

This patch attempts to fix all of this up:

- Duplicate method removed in favour of the public `describe` method. I
  have opted to keep the public method as the differ class is calling,
  making it public.

- The change to `describe_outputs` is reverted.

- The unit tests are rewritten.
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

No branches or pull requests

1 participant