[PCP-830] Add POST for running PCP modules to PCP/PXP to Puppet Server Orchestration API Created: 2018/01/28  Updated: 2018/02/07

Status: Open
Project: Puppet Communications Protocol
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Normal
Reporter: Martin Alfke Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Any PE Installation


Template:
Acceptance Criteria:

Have a POST API to run individual PCP module using RBAC auth token and JSON payload.

QA Risk Assessment: Needs Assessment

 Description   

At the moment PCP/PXP is a black box. I would like to see a POST API (maybe on Orchestration API) to execute PCP modules.
Yes, this feature can be achieved by running tasks. The benefit of using PCP/PXP is that we get direct feedback from module output..



 Comments   
Comment by Michael Smith [ 2018/02/05 ]

When you say modules, do you mean as documented at https://github.com/puppetlabs/pxp-agent/tree/master/modules? Can you expand on what you mean by "direct feedback"?

Comment by Michael Smith [ 2018/02/05 ]

Or do you mean that https://puppet.com/docs/pe/2017.3/orchestrator/orchestrator_api_commands_endpoint.html#post-command-task wasn't documented, or doesn't return the raw results?

Comment by Martin Alfke [ 2018/02/07 ]

I am referring to the pxp module (https://github.com/puppetlabs/pxp-agent/tree/master/modules).

From what I have learned from Application Orchestration it is possible to directly receive feedback on puppet agent runs.

I am asking for the same direct output to be available for a pcp/pxp module execution.

You can also check our blog posting (scroll almost to the end where it reads "ATTENTION"): https://www.example42.com/2018/01/29/remote_puppet_control/

 

Comment by Michael Smith [ 2018/02/07 ]

Looking at your blog post, I'm not sure what you're looking for. A Task can be used to trigger a puppet run and view the results, as you've shown. We kept Deploy (Run Puppet in the Console) so as not to break something that already works, but considered rewriting it on top of tasks.

The primary differentiator of a Task versus a PXP module is that tasks handle distribution by retrieving them from a Puppet Master.

A possible behavior I could envision is if you want to use asynchronous communication to immediately get a message when execution finishes. That isn't something we plan to add to Orchestrator right now, but if you want to interact with pcp-broker directly you can use ruby-pcp-client or clj-pcp-client to send the appropriate PXP messages to run a PXP module as described in pcp-specifications/pxp.

Comment by Michael Smith [ 2018/02/07 ]

Ah, at the very end of the blog you mention viewing runs in real-time. Supporting that from a module unfortunately requires some work in pxp-agent; I've previously prototyped that at https://github.com/MikaelSmith/pxp-agent/tree/streaming-actions, but never finished it. With that version of pxp-agent I think you were able to write a module that writes messages to stderr that would be streamed back as a new type of PXP message, that a client (as noted in my previous message) would be able to process.

Generated at Mon Sep 23 06:48:53 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.