metadew / iesi

Intelligent, Enhanced & Seamless Industrialization
http://www.metadew.io
Other
13 stars 10 forks source link

Cannot run program "cd" #21

Open Sroose opened 5 years ago

Sroose commented 5 years ago

When using the actiontype cli.executeCommand Conditions:

the tool tries to change directory but it fails with the following stacktrace:

DEBUG [iesi] - action.type=cli.executeCommand
DEBUG [iesi] - action.param=path:/
DEBUG [iesi] - action.param=command:echo 123
DEBUG [iesi] - action.param=connection:local_sftp
DEBUG [iesi] - action.output=exception:Cannot run program "cd": error=2, No such file or directory
DEBUG [iesi] - action.output=stacktrace:java.lang.RuntimeException: Cannot run program "cd": error=2, No such file or directory
DEBUG [iesi] -  at io.metadew.iesi.connection.HostConnection.executeLocalCommand(HostConnection.java:131)
DEBUG [iesi] -  at io.metadew.iesi.script.action.CliExecuteCommand.execute(CliExecuteCommand.java:120)
DEBUG [iesi] -  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
DEBUG [iesi] -  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
DEBUG [iesi] -  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
DEBUG [iesi] -  at java.lang.reflect.Method.invoke(Method.java:498)
DEBUG [iesi] -  at io.metadew.iesi.script.execution.ActionExecution.execute(ActionExecution.java:104)
DEBUG [iesi] -  at io.metadew.iesi.script.execution.ScriptExecution.execute(ScriptExecution.java:248)
DEBUG [iesi] -  at io.metadew.iesi.launch.ScriptLauncher.main(ScriptLauncher.java:280)
DEBUG [iesi] - Caused by: java.io.IOException: Cannot run program "cd": error=2, No such file or directory
DEBUG [iesi] -  at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
DEBUG [iesi] -  at java.lang.Runtime.exec(Runtime.java:620)
DEBUG [iesi] -  at java.lang.Runtime.exec(Runtime.java:450)
DEBUG [iesi] -  at java.lang.Runtime.exec(Runtime.java:347)
DEBUG [iesi] -  at io.metadew.iesi.connection.HostConnection.executeLocalCommand(HostConnection.java:110)
DEBUG [iesi] -  ... 8 more
DEBUG [iesi] - Caused by: java.io.IOException: error=2, No such file or directory
DEBUG [iesi] -  at java.lang.UNIXProcess.forkAndExec(Native Method)
DEBUG [iesi] -  at java.lang.UNIXProcess.<init>(UNIXProcess.java:247)
DEBUG [iesi] -  at java.lang.ProcessImpl.start(ProcessImpl.java:134)
DEBUG [iesi] -  at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
DEBUG [iesi] -  ... 12 more
Sroose commented 5 years ago

Additional data for reproducing:

CONNECTION FILE

[{
    "type": "connection",
    "data": {
        "name": "local_sftp",
        "description": "Connection to our local system server",
        "type": "host.linux",
        "environment": "dev",
        "parameters": [
            {"name": "host","value": "7e6cddc8346c"},
            {"name": "port","value": "22"},
            {"name": "user","value": "dummy_user_and_pass"},
            {"name": "password","value": "ENC(XKq6zFCFqyeKIHPjoWya9aHdHVbTvLpP9A==)"},
            {"name": "tempPath","value": "/tmp/"},
            {"name": "simulateTerminal","value": "N"},
            {"name": "jumphostConnections","value": "N"}
        ]
    }
}]

SCRIPT FILE

[{
    "type": "Script",
    "data": {
        "name": "testScript",
        "description": "whatever",
        "version": {
            "number": "1",
            "description": "initial version"
        },
        "actions": [{
            "number": "1",
            "type": "cli.executeCommand",
            "name": "testAction",
            "description": "whatever",
            "component": "",
            "errorExpected": "N",
            "errorStop": "Y",
            "parameters": [
                {"name": "path", "value": "/tmp/"},
                {"name": "command", "value": "echo 123"},
                {"name": "connection", "value": "local_sftp"}

            ]
        }
        ]
    }
}]