-
Notifications
You must be signed in to change notification settings - Fork 1
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
PF-3004: Fix stairctl so it runs again, other updates #154
Conversation
…d to set a property to enable it.
|
||
spring: | ||
shell: | ||
interactive: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spring shell 3.3 disables the interactive shell by default, so we need to set this property to enable it.
https://github.com/spring-projects/spring-shell/wiki/Spring-Shell-3.3-Release-Notes
stairctl/build.gradle
Outdated
exclude module: 'spring-boot-starter-logging' | ||
} | ||
|
||
implementation 'org.slf4j:slf4j-simple:1.7.36' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't necessary but it cleans up the log configuration errors you get on startup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, would you mind adding a comment to that effect on the exclusion?
- use `Terminal` not System.out for output - remove apache utils where possible
@@ -31,47 +33,41 @@ public void connect( | |||
defaultValue = ShellOption.NULL) | |||
String dbname, | |||
@ShellOption( | |||
value = {"-h", "--host"}, | |||
value = {"-H", "--host"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was required as -h
conflicts with help
, which is a global option. Spring shell didn't report an error but it did cause some odd problems when trying to use other options for this command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for noodling on this! Would you mind also looking at the stairctl readme to see if any updates are needed in light of these changes?
I think that the ticket number also needs to be associated with this PR - https://broadworkbench.atlassian.net/browse/PF-3004
stairctl/build.gradle
Outdated
exclude module: 'spring-boot-starter-logging' | ||
} | ||
|
||
implementation 'org.slf4j:slf4j-simple:1.7.36' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, would you mind adding a comment to that effect on the exclusion?
this.dbname = dbname; | ||
return this; | ||
} | ||
public record ConnectParams( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, love a config-to-record refactor.
dbname = Optional.ofNullable(dbname).orElse(defaults.getDbname()); | ||
public ConnectParams withDefaults(ConnectParams defaults) { | ||
return new ConnectParams( | ||
Objects.requireNonNullElseGet(username, defaults::username), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL about this Objects helper method.
- update to latest slf4j. This required converting logback.groovy to logback.xml - change stairctl to not log at all
@@ -14,7 +13,7 @@ repositories { | |||
|
|||
dependencies { | |||
// For logging | |||
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.36' | |||
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.13' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to remove the stairctl subproject dependency exclusion by updating the slf4j version to the current release. This required changing the logback config files to xml, as groovy was deprecated a while ago due to security issues.
script: | ||
enabled: true | ||
|
||
# Disable logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While looking the logging dependencies, I thought that, as a command line program, stairctl shouldn't log at all, so I added a config to properties
to disable logging.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR updates the configuration of
stairctl
so it works again.While updating it, I noticed that it makes heavy use of
System.out
, which isn't the recommended approach for Spring Shell apps. I updated it to useTerminal
instead.While testing, I've used this to look at TDR flight logs in dev and locally, and it seems like it might be useful. It may be useful for other Terra apps that use stairway, for developers, or a tool for support, so they can look at flight failures in more detail without needing to search production logs.
Here's an example session using
stairctl
: