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

Default ConsoleUIService.allowPrompt to false #1689

Closed
nvoxland opened this issue Feb 12, 2021 · 5 comments
Closed

Default ConsoleUIService.allowPrompt to false #1689

nvoxland opened this issue Feb 12, 2021 · 5 comments
Assignees

Comments

@nvoxland
Copy link
Contributor

nvoxland commented Feb 12, 2021

Description

The allowPrompt property controls whether systems using the ConsoleUIService will allow user prompts. The ConsoleUIService is activated any time a console/keyboard is available, but there are times (such as when starting a spring boot server from the command line) that a console IS available, even though we're not in a spot where we actually want keyboard input.

Changes

Change the default value to "false" and specifically set it to true only in the CLI interface

Expected Behavior

Running liquibase update CLI operations will prompt when needed (such as "would you like to join hub")

  • Servlet; Spring Boot already had code to prevent prompting.

Running java -jar my-spring-app.jar will NOT prompt for anything

Actual Behavior

Running java -jar my-spring-app.jar prompts for joining hub

Liquibase Internal QA Requirements

  • Validate NPE reproduces when a console is available but inappropriate to call.
    • There is an attached project that runs an update against an in-memory database that repros the issue.
    • Liquibase already implemented the allowPrompt=false for CLI, MVN, Servlet and Ant integrations.
  • Manually verify fix addresses the NPE using the example project attached to the ticket.
  • Manually verify the SpringBoot integration is unaffected (fix already exists in 4.3.0)
  • Manually verify the Servlet integration is unaffected (fix already exists in 4.3.0)
  • Manually verify the Ant integration is unaffected (fix already exists in 4.3.0)
  • Verify all automated functional tests pass on Jenkins.
These tests are run on an internal Jenkins and results are not available to the wider community.

No automated tests are required for this ticket.

@sync-by-unito
Copy link

sync-by-unito bot commented Feb 26, 2021

➤ Wesley Willard commented:

Code reviewed by Wesley Willard

@sync-by-unito
Copy link

sync-by-unito bot commented Mar 2, 2021

➤ Erzsebet Carmean commented:

I'm having trouble getting this issue to replicate. Passing the ticket back to Nathan Voxland for some help.

@nvoxland
Copy link
Contributor Author

nvoxland commented Mar 3, 2021

repo.zip

I attached a repo project.

Run mvn package then `java -jar target/demo-0.0.1-SNAPSHOT.jar

@sync-by-unito
Copy link

sync-by-unito bot commented Mar 3, 2021

➤ Erzsebet Carmean commented:

Liquibase 4.3.2-LB-1220-SNAPSHOT, #1Validate NPE reproduces when a console is available but inappropriate to call. PASS

Error Message{CODE}
INFO: Successfully released change log lock
Do you want to see this operation's report in Liquibase Hub, which improves team collaboration?
If so, enter your email. If not, enter [N] to no longer be prompted, or [S] to skip for now, but ask again next time (default "S"):
N
Mar 03, 2021 1:36:42 PM liquibase.lockservice
INFO: Successfully acquired change log lock
No operations will be reported. Simply add a liquibase.hub.apiKey setting to generate free deployment reports. Learn more at https://hub.liquibase.com
Mar 03, 2021 1:36:42 PM liquibase.hub
INFO: No operations will be reported. Simply add a liquibase.hub.apiKey setting to generate free deployment reports. Learn more at https://hub.liquibase.com
Mar 03, 2021 1:36:42 PM liquibase.lockservice
INFO: Successfully released change log lock
Exception in thread "main" liquibase.exception.LiquibaseException: java.lang.NullPointerException
at liquibase.Liquibase.runInScope(Liquibase.java:2327)
at liquibase.Liquibase.update(Liquibase.java:216)
at liquibase.Liquibase.update(Liquibase.java:202)
at liquibase.Liquibase.update(Liquibase.java:198)
at liquibase.Liquibase.update(Liquibase.java:190)
at com.example.demo.DemoApplication.main(DemoApplication.java:14)
Caused by: java.lang.NullPointerException
at java.base/java.io.RandomAccessFile.(RandomAccessFile.java:253)
at java.base/java.io.RandomAccessFile.(RandomAccessFile.java:216)
at liquibase.hub.HubUpdater.writeToPropertiesFile(HubUpdater.java:456)
at liquibase.hub.HubUpdater.register(HubUpdater.java:361)
at liquibase.Liquibase.lambda$update$1(Liquibase.java:242)
at liquibase.Scope.lambda$child$0(Scope.java:160)
at liquibase.Scope.child(Scope.java:169)
at liquibase.Scope.child(Scope.java:159)
at liquibase.Scope.child(Scope.java:138)
at liquibase.Liquibase.runInScope(Liquibase.java:2322)
... 5 more
{CODE}

Manually verify fix addresses the NPE using the example project attached to the ticket. PASS
{CODE}
java jar target/demo0.0.1-SNAPSHOT.jar
Mar 03, 2021 3:02:56 PM liquibase.servicelocator
//SNIP
Skipping auto-registration
Mar 03, 2021 3:02:56 PM liquibase.hub
WARNING: Skipping auto-registration
Mar 03, 2021 3:02:56 PM liquibase.changelog
INFO: Table test_table created
// SNIP
{CODE}

Manually verify the Maven integration is unaffected by changes. PASS
Manually verify the SpringBoot integration is unaffected by changes. PASS
Manually verify the Servlet integration is unaffected by changes. PASS
Manually verify the Ant integration is unaffected (fix already exists in 4.3.0). PASS
Verify all automated functional tests pass on Jenkins. PASS
These tests are run on an internal Jenkins and results are not available to the wider community.

Notes on Testing

  • If you get a compilation error that "Source option 5 is no longer supported. Use 7 or later." add the following to the global properties section of the pom.xml:
    {CODE}
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    {CODE}

  • To successfully run mvn package with the fix build, install the liquibase jar with the fix to the local .m2:
    {CODE}
    mvn install:install-file Dfile=liquibase4.3.2-LB-1220-SNAPSHOT.jar DgroupId=erzlb1220 DartifactId=liquibase1220 Dversion=4.3.2--LB-1220SNAPSHOT -Dpackaging=jar
    {CODE}

  • Add the local dependency to the pom:
    {CODE}

erzlb1220 liquibase1220 4.3.2-LB-1220-SNAPSHOT {CODE}

@sync-by-unito
Copy link

sync-by-unito bot commented Mar 3, 2021

➤ Erzsebet Carmean commented:

Everything looks good. Thanks for building the sample application for me, Nathan Voxland. Moving this to ready to merge.

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