liquibase-mongodb icon indicating copy to clipboard operation
liquibase-mongodb copied to clipboard

executeCommand change type fails to run on an update

Open szandany opened this issue 3 years ago • 0 comments

After testing the executeCommand change type, it appears that the change set containing the executeCommand change type fails.

Steps to reproduce: Create a changeset with the executeCommand change type. Example:

        <changeSet author="Tsvi" id="4321">
           <executeCommand executable="/Users/support.liquibase.net/CLI-Projects/MongoDB_CLI/run_with_mongodb_shell.sh" os="Mac OS X" timeout="10s">  
                <arg  value="test.js"/> 
            </executeCommand>
        </changeSet> 

Running the changeset with the liquibase update command generates the following error:

$ liquibase update --log-level=INFO
Starting Liquibase at 11:10:32 (version 4.7.1 #1239 built at 2022-01-20 20:31+0000)
Liquibase Version: 4.7.1
Liquibase Pro 4.7.1 by Liquibase licensed to customersuccess until Sun Jun 26 23:59:59 CDT 2022
[2022-02-03 11:10:32] INFO [liquibase.license] Successfully installed license from Base64 string starting with 'ABwwGgQUjx' (property liquibaseProLicenseKey).

[2022-02-03 11:10:32] INFO [com.mongodb.diagnostics.logging.JULLogger log] Cluster created with settings {hosts=[tsvi.datical.net:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
[2022-02-03 11:10:32] INFO [com.mongodb.diagnostics.logging.JULLogger log] Cluster description not yet available. Waiting for 30000 ms before timing out
[2022-02-03 11:10:32] INFO [com.mongodb.diagnostics.logging.JULLogger log] Opened connection [connectionId{localValue:1, serverValue:80}] to tsvi.datical.net:27017
[2022-02-03 11:10:32] INFO [com.mongodb.diagnostics.logging.JULLogger log] Monitor thread successfully connected to server with description ServerDescription{address=tsvi.datical.net:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 4, 5]}, minWireVersion=0, maxWireVersion=9, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=45103969}
[2022-02-03 11:10:33] INFO [com.mongodb.diagnostics.logging.JULLogger log] Opened connection [connectionId{localValue:2, serverValue:81}] to tsvi.datical.net:27017
[2022-02-03 11:10:33] INFO [liquibase.ext] Adjusting database Lock Collection with name: MYDB.DATABASECHANGELOGLOCK
[2022-02-03 11:10:33] INFO [liquibase.ext] Adjusted database Lock Collection with name: MYDB.DATABASECHANGELOGLOCK
[2022-02-03 11:10:33] INFO [liquibase.ext] Lock Database
[2022-02-03 11:10:33] INFO [liquibase.ext] Successfully Acquired Change Log Lock
[2022-02-03 11:10:33] INFO [liquibase.servicelocator] Cannot load service: liquibase.parser.ChangeLogParser: liquibase.nosql.parser.json.JsonNoSqlChangeLogParser Unable to get public no-arg constructor
[2022-02-03 11:10:34] INFO [liquibase.ext] Adjusting database history Collection with name: MYDB.DATABASECHANGELOG
[2022-02-03 11:10:34] INFO [liquibase.ext] Adjusted database history Collection with name: MYDB.DATABASECHANGELOG
Running Changeset: executeCommand.xml::4321::Tsvi
[2022-02-03 11:10:34] INFO [liquibase.nosql] Changeset executeCommand.xml::4321::Tsvi
[2022-02-03 11:10:34] INFO [liquibase.nosql] WARNING The following SQL may change each run and therefore is possibly incorrect and/or invalid:
[2022-02-03 11:10:34] INFO [liquibase.ext] Release Database Lock
[2022-02-03 11:10:34] INFO [liquibase.ext] Successfully released change log lock
[2022-02-03 11:10:34] INFO [com.mongodb.diagnostics.logging.JULLogger log] Closed connection [connectionId{localValue:2, serverValue:81}] to tsvi.datical.net:27017 because the pool has been closed.
[2022-02-03 11:10:34] SEVERE [liquibase.integration] Migration failed for change set executeCommand.xml::4321::Tsvi:
     Reason: java.lang.IllegalArgumentException
liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: Migration failed for change set executeCommand.xml::4321::Tsvi:
     Reason: java.lang.IllegalArgumentException
        at liquibase.command.CommandScope.execute(CommandScope.java:163)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:51)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:21)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$1(LiquibaseCommandLine.java:325)
        at liquibase.Scope.child(Scope.java:189)
        at liquibase.Scope.child(Scope.java:165)
        at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:291)
        at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:80)
Caused by: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: Migration failed for change set executeCommand.xml::4321::Tsvi:
     Reason: java.lang.IllegalArgumentException
        at liquibase.integration.commandline.Main$1.run(Main.java:443)
        at liquibase.integration.commandline.Main$1.run(Main.java:221)
        at liquibase.Scope.child(Scope.java:189)
        at liquibase.Scope.child(Scope.java:165)
        at liquibase.integration.commandline.Main.run(Main.java:221)
        at liquibase.command.AbstractCliWrapperCommandStep.run(AbstractCliWrapperCommandStep.java:32)
        at liquibase.command.CommandScope.execute(CommandScope.java:157)
        ... 14 more
Caused by: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set executeCommand.xml::4321::Tsvi:
     Reason: java.lang.IllegalArgumentException
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:124)
        at liquibase.Liquibase.lambda$null$0(Liquibase.java:265)
        at liquibase.Scope.lambda$child$0(Scope.java:180)
        at liquibase.Scope.child(Scope.java:189)
        at liquibase.Scope.child(Scope.java:179)
        at liquibase.Scope.child(Scope.java:158)
        at liquibase.Scope.child(Scope.java:243)
        at liquibase.Liquibase.lambda$update$1(Liquibase.java:264)
        at liquibase.Scope.lambda$child$0(Scope.java:180)
        at liquibase.Scope.child(Scope.java:189)
        at liquibase.Scope.child(Scope.java:179)
        at liquibase.Scope.child(Scope.java:158)
        at liquibase.Liquibase.runInScope(Liquibase.java:2405)
        at liquibase.Liquibase.update(Liquibase.java:211)
        at liquibase.Liquibase.update(Liquibase.java:197)
        at liquibase.integration.commandline.Main.doMigration(Main.java:1871)
        at liquibase.integration.commandline.Main$1.lambda$run$0(Main.java:398)
        at liquibase.Scope.lambda$child$0(Scope.java:180)
        at liquibase.Scope.child(Scope.java:189)
        at liquibase.Scope.child(Scope.java:179)
        at liquibase.Scope.child(Scope.java:158)
        at liquibase.integration.commandline.Main$1.run(Main.java:397)
        ... 20 more
Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set executeCommand.xml::4321::Tsvi:
     Reason: java.lang.IllegalArgumentException
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:695)
        at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:56)
        at liquibase.changelog.ChangeLogIterator$2.lambda$null$0(ChangeLogIterator.java:111)
        at liquibase.Scope.lambda$child$0(Scope.java:180)
        at liquibase.Scope.child(Scope.java:189)
        at liquibase.Scope.child(Scope.java:179)
        at liquibase.Scope.child(Scope.java:158)
        at liquibase.changelog.ChangeLogIterator$2.lambda$run$1(ChangeLogIterator.java:110)
        at liquibase.Scope.lambda$child$0(Scope.java:180)
        at liquibase.Scope.child(Scope.java:189)
        at liquibase.Scope.child(Scope.java:179)
        at liquibase.Scope.child(Scope.java:158)
        at liquibase.Scope.child(Scope.java:243)
        at liquibase.changelog.ChangeLogIterator$2.run(ChangeLogIterator.java:94)
        at liquibase.Scope.lambda$child$0(Scope.java:180)
        at liquibase.Scope.child(Scope.java:189)
        at liquibase.Scope.child(Scope.java:179)
        at liquibase.Scope.child(Scope.java:158)
        at liquibase.Scope.child(Scope.java:243)
        at liquibase.Scope.child(Scope.java:247)
        at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:66)
        ... 41 more
Caused by: java.lang.IllegalArgumentException
        at liquibase.nosql.executor.NoSqlExecutor.execute(NoSqlExecutor.java:194)
        at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1279)
        at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1261)
        at liquibase.changelog.ChangeSet.execute(ChangeSet.java:660)
        ... 61 more


Unexpected error running Liquibase: Migration failed for change set executeCommand.xml::4321::Tsvi:
     Reason: java.lang.IllegalArgumentException

liquibase.exception.CommandExecutionException: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: Migration failed for change set executeCommand.xml::4321::Tsvi:
     Reason: java.lang.IllegalArgumentException
        at liquibase.command.CommandScope.execute(CommandScope.java:163)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:51)
        at liquibase.integration.commandline.CommandRunner.call(CommandRunner.java:21)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at liquibase.integration.commandline.LiquibaseCommandLine.lambda$execute$1(LiquibaseCommandLine.java:325)
        at liquibase.Scope.child(Scope.java:189)
        at liquibase.Scope.child(Scope.java:165)
        at liquibase.integration.commandline.LiquibaseCommandLine.execute(LiquibaseCommandLine.java:291)
        at liquibase.integration.commandline.LiquibaseCommandLine.main(LiquibaseCommandLine.java:80)
Caused by: liquibase.exception.LiquibaseException: Unexpected error running Liquibase: Migration failed for change set executeCommand.xml::4321::Tsvi:
     Reason: java.lang.IllegalArgumentException
        at liquibase.integration.commandline.Main$1.run(Main.java:443)
        at liquibase.integration.commandline.Main$1.run(Main.java:221)
        at liquibase.Scope.child(Scope.java:189)
        at liquibase.Scope.child(Scope.java:165)
        at liquibase.integration.commandline.Main.run(Main.java:221)
        at liquibase.command.AbstractCliWrapperCommandStep.run(AbstractCliWrapperCommandStep.java:32)
        at liquibase.command.CommandScope.execute(CommandScope.java:157)
        ... 14 more

Environment: This change type was tested on MacOS and Linux Centos 7 with Liquibase 4.7.1

szandany avatar Feb 03 '22 18:02 szandany