Search code examples
tinkerpop3gremlin-server

TinkerPop3 > Gremlin Server > Check whether Graph lib is installed


In the Gremlin Server I install the NEO4J lib like this

bin/gremlin-server.sh -i org.apache.tinkerpop neo4j-gremlin x.y.z

Is there a way to figure out if this lib is already installed?


Long story:

I am simulating the condition that there is some network issue, so before I run this, I disable the network conection.

Script:

#!/bin/bash
echo "PING PING PING PING PING"
bin/gremlin-server.sh -i org.apache.tinkerpop neo4j-gremlin x.y.z

if [ $? -eq 0 ]
then
  echo "Successfully Successfully Successfully Successfully"
else
  echo "FAILED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
fi

Result when network is down

PING PING PING PING PING
Redirecting to 'install org.apache.tinkerpop neo4j-gremlin 3.3.1' (-i will be removed in a future release)
Installing dependency org.apache.tinkerpop neo4j-gremlin 3.3.1
Could not install the dependency: Error grabbing Grapes -- [unresolved dependency: org.apache.tinkerpop#neo4j-gremlin;3.3.1: not found]
java.lang.RuntimeException: Error grabbing Grapes -- [unresolved dependency: org.apache.tinkerpop#neo4j-gremlin;3.3.1: not found]
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
    at groovy.grape.GrapeIvy.getDependencies(GrapeIvy.groovy:424)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
    at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:571)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
    at groovy.grape.GrapeIvy.resolve(GrapeIvy.groovy:534)
    at groovy.grape.Grape.resolve(Grape.java:202)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
    at org.apache.tinkerpop.gremlin.groovy.util.DependencyGrabber.copyDependenciesToPath(DependencyGrabber.groovy:110)
    at org.apache.tinkerpop.gremlin.server.util.GremlinServerInstall.main(GremlinServerInstall.java:38)
Successfully Successfully Successfully Successfully

To check whether the bash exit codes are running fine, I did this

cd wrongfolder
if [ $? -eq 0 ]
then
  echo "Successfully Successfully Successfully Successfully"
else
  echo "FAILED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
fi

output

PING PING PING PING PING
/install.sh: line 5: cd: wrongfolder: No such file or directory
FAILED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

So exit codes work fine, but somehow for Gremlin its not working


Solution

  • I just took a look at the code. The utility that loads the plugins doesn't appear to be producing an error code and is instead just printing the error and exiting normally. So, what you are seeing is expected.

    I've added a fix which will be available for 3.2.10, 3.3.4 and 3.4.0:

    https://github.com/apache/tinkerpop/commit/2d315e828149a132ecabf406af91acc3caec064c

    I don't think that there is a workaround for determining success or failure beyond parsing the output that is currently produced.