Background When told to run a task on some nodes, a PE master typically contacts the nodes over the PCP protocol. It sends a formatted request over PCP to the pxp-agent service running on the nodes, directing them to run the task locally. But if the nodes don't have a pxp-agent service running, the PE master must contact them via SSH or WinRM instead. For these cases, the PE master runs a "pe-bolt-server" service, which is a sinatra application that waits for post requests to /ssh/run_task or /winrm/run_task, then runs the task via an instance of the bolt executor, just like bolt does when you run a task via the CLI. Basically, it's a thin REST API wrapper around normal bolt "task run" operations that the PE master can use when there's no PXP agent to talk to over PCP. In PE Kearney, "task run" is the only supported action over PCP, so it follows that the only endpoints in the bolt-server REST API are for "task run". For other typical bolt actions ("command run", "file upload", "script run"), PCP operations are handled by wrapping any non-task action in an ephemeral task in order to use the "task run" endpoints. PCP-867 and ORCH-2304 describe process of enabling "command run" over PCP on the agent and server. This ticket describes the new endpoint on bolt-server that will support "command run" when there is no PCP transport available. Requirements Changes will be made to the bolt server app:
- The app follows the json schema specification. Add a description of the JSON schema for data passed to the new endpoints here. This schema should match the one defined for the command action in PCP-867, that is:
{ |
"type": "object", |
"properties": { |
"command": { |
"type": "string" |
} |
} |
}
|
- Add new POST endpoints in the transport sinatra app here to support running a command via SSH and WinRM, using the new JSON schema.
Testing
- Write RSpec tests for the changes to bolt here.
- Acceptance/integration tests are also maintained from the orchestrator side: add new integration test(s) for the interaction of the orchestrator and bolt-server while running a command here.
|