With Flint's Local-command Connector, we can send command requests and read command responses efficiently. By enabling this connector you can run commands through request parameters on local machine.

This section will guide you on how to use and work with the Local-command Connector.

Features

  • Execution of a command specified in simplified comma
  • Direct access to the command execution results on local machine
  • Ability to set Connector execution timeout
  • Synchronous / Asynchronous execution of the Connector

Connector Configuration

No additional configuration is required for Local-command connector

add_local-command_connector

Configuration parameters- config(JSON)

ParameterDescriptionRequired
commandcommand name. Name of the command on which actions have to be performedtrue

Example 

{
  "command": "pwd",
  "timeout": 30000 
} 

Actions

exec

Command will be executed in a separate session as if the command is executed in new command shell

Request parameters

ParameterDescriptionRequired
commandCommand to be executed on the local machine with expected prompttrue
timeoutTimeout in milliseconds, taken by the connector to serve the command request. Default timeout is 60,000 msfalse

Response parameters

ParameterDescriptionRequired
resultResults as per the command executedtrue

Example

response=@call.connector("my-local-command-connector")
              .set("command","pwd")
              .set("timeout",30000)
              .sync

#Local command Connector Response Parameters
result=response.get("result")                    #Result

shell

Command will be executed in the same session as if the command is executed in the same command shell

Request parameters

ParameterDescriptionRequired
commandCommand to be executed on the local machinetrue
timeoutTimeout in milliseconds, taken by the connector to serve the command request. Default timeout is 60,000 msfalse

Response parameters

ParameterDescriptionRequired
resultResults as per the command executedtrue

Example

response=@call.connector("my-local-command-connector")
              .set("command","pwd")
              .set("timeout",30000)
              .sync

#Local command Connector Response Parameters
result=response.get("result")                    #Result
 

Connector request error handling

This is how success or failures can be handled for the connector requests within your Flintbit. This would help to take appropriate action if something failed.

  
if response.exitcode == 0               # 0 is success.
  @log.info "success"
  # take action in case of success
else                                    # non zero means fail
  @log.info "fail"
  @log.info "Reason:" + response.message     # get the reason of failure
  ## Take action in case of failure
end

On this page: