Remote Execution Output

Hi all,
I am looking to capture the output of a foreman remote execution job to parse it for display purposes. Does anyone know what table or how to access the raw data via the command line? E.g. So I can automate the parsing rather than clicking through on the GUI?

Many thanks,

> From: "colm scanlon" <colm.scanlon@gmail.com>
> To: "foreman-dev" <foreman-dev@googlegroups.com>
> Sent: Friday, July 8, 2016 3:42:49 AM
> Subject: [foreman-dev] Remote Execution Output.
>
> Hi all,
> I am looking to capture the output of a foreman remote execution job to parse
> it for display purposes. Does anyone know what table or how to access the
> raw data via the command line? E.g. So I can automate the parsing rather
> than clicking through on the GUI?

It's accessible in the API per host (see /apidoc on your foreman for more details):

/api/job_invocations/:id/hosts/:host_id 

It's also available in hammer CLI:

hammer job-invocation output --id 155 --host rex01.example.com

There's a few issues we have open to improve this, like Feature #11664: provide rich output support for job execution - Foreman Remote Execution - Foreman
as Ivan mentioned to provide some parsing ability in Foreman itself, as well
as Feature #12818: Ability to download the results of a job invocation - Foreman Remote Execution - Foreman to download the output
for all hosts in a job invocation, maybe in a .zip archive.

  • Stephen
··· ----- Original Message -----

Many thanks,


You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Using the REST API to access the data for further processing is the
recomanded option here.

Can the feature you are looking for be related to
Feature #11664: provide rich output support for job execution - Foreman Remote Execution - Foreman?

Just to complete the answer, one can get to the outputs of the job
invocation like this
from the console

ji = JobInvocation.find(&#39;123&#39;)
ji.template_invocations.map { |ti| {ti.host.name =&gt;

ti.run_host_job_task.main_action.live_output} }

However, this is not a public API and we can't guarantee it will not
change in future.

– Ivan

··· On Fri, Jul 8, 2016 at 9:42 AM, wrote: > Hi all, > I am looking to capture the output of a foreman remote execution job to parse it for display purposes. Does anyone know what table or how to access the raw data via the command line? E.g. So I can automate the parsing rather than clicking through on the GUI? > > Many thanks, > > -- > You received this message because you are subscribed to the Google Groups "foreman-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.

Thanks all, I will try these. Especially the hammer command might be suitable. I also found the data in the SQLite db within the Dundon structure, however if the above have outputs easier to parse then that would be great. Am I right in saying hammer can issue the commands via cli by itself?

Thanks again for your help on this!

··· On Friday, July 8, 2016 at 4:03:26 PM UTC+1, stephen wrote: > ----- Original Message ----- > > From: "colm scanlon" > > To: "foreman-dev" > > Sent: Friday, July 8, 2016 3:42:49 AM > > Subject: [foreman-dev] Remote Execution Output. > > > > Hi all, > > I am looking to capture the output of a foreman remote execution job to parse > > it for display purposes. Does anyone know what table or how to access the > > raw data via the command line? E.g. So I can automate the parsing rather > > than clicking through on the GUI? > > It's accessible in the API per host (see /apidoc on your foreman for more details): > > /api/job_invocations/:id/hosts/:host_id > > It's also available in hammer CLI: > > hammer job-invocation output --id 155 --host rex01.example.com > > There's a few issues we have open to improve this, like http://projects.theforeman.org/issues/11664 > as Ivan mentioned to provide some parsing ability in Foreman itself, as well > as http://projects.theforeman.org/issues/12818 to download the output > for all hosts in a job invocation, maybe in a .zip archive. > > - Stephen > > > > Many thanks, > > > > -- > > You received this message because you are subscribed to the Google Groups > > "foreman-dev" group. > > To unsubscribe from this group and stop receiving emails from it, send an > > email to foreman-dev+unsubscribe@googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. > >

Yes it is, see Foreman :: Plugin Manuals
for more details

– Ivan

··· On Sat, Jul 9, 2016 at 1:54 AM, wrote: > Thanks all, I will try these. Especially the hammer command might be suitable. I also found the data in the SQLite db within the Dundon structure, however if the above have outputs easier to parse then that would be great. Am I right in saying hammer can issue the commands via cli by itself? > > Thanks again for your help on this! > > On Friday, July 8, 2016 at 4:03:26 PM UTC+1, stephen wrote: >> ----- Original Message ----- >> > From: "colm scanlon" >> > To: "foreman-dev" >> > Sent: Friday, July 8, 2016 3:42:49 AM >> > Subject: [foreman-dev] Remote Execution Output. >> > >> > Hi all, >> > I am looking to capture the output of a foreman remote execution job to parse >> > it for display purposes. Does anyone know what table or how to access the >> > raw data via the command line? E.g. So I can automate the parsing rather >> > than clicking through on the GUI? >> >> It's accessible in the API per host (see /apidoc on your foreman for more details): >> >> /api/job_invocations/:id/hosts/:host_id >> >> It's also available in hammer CLI: >> >> hammer job-invocation output --id 155 --host rex01.example.com >> >> There's a few issues we have open to improve this, like http://projects.theforeman.org/issues/11664 >> as Ivan mentioned to provide some parsing ability in Foreman itself, as well >> as http://projects.theforeman.org/issues/12818 to download the output >> for all hosts in a job invocation, maybe in a .zip archive. >> >> - Stephen >> >> >> > Many thanks, >> > >> > -- >> > You received this message because you are subscribed to the Google Groups >> > "foreman-dev" group. >> > To unsubscribe from this group and stop receiving emails from it, send an >> > email to foreman-dev+unsubscribe@googlegroups.com. >> > For more options, visit https://groups.google.com/d/optout. >> > > > -- > You received this message because you are subscribed to the Google Groups "foreman-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to foreman-dev+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.