Bug 1490850

Summary: [RFE] Need a way to mark a build as failed
Product: Red Hat Satellite Reporter: Ian Tewksbury <itewksbu>
Component: ProvisioningAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.11CC: bkearney, dvoss, egolov, inecas, itewksbu, lzap, mhulan, pcreech
Target Milestone: 6.6.0Keywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-1.22.0-0 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-22 12:46:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ian Tewksbury 2017-09-12 11:33:30 UTC
Description of problem:
If there is an error during the kickstart process there is currently no way to notify Satellite that the build has failed. Currently the only option is to just not notify that the build completed.

Suggested Enhancement:

Add a state to the build process of "Failed" or "Errored" and have an API call that a kickstart can make back to Satellite to indicate that the build has failed/errored.

Comment 1 Ivan Necas 2017-09-15 15:34:09 UTC
Given we supported such an API, how the kickstart template would look like?

Comment 2 Marek Hulan 2017-09-15 18:11:35 UTC
How about using the same approach as for "built"? We can add another type to foreman_url macro. Otoh I can imagine proxy could use the same API to provide more info about the provisioning progress.

Comment 3 Ian Tewksbury 2017-09-19 12:06:52 UTC
@Ivan,

What @Marek said. Basically do some sort of error checking in the template, and then if in error state call new API to mark the build failed.

An example maybe, from real world client, kickstart is attempting to install puppet, but puppet package not available because there is an entitlement issue. So kickstart could first check to see if system is entitled correctly, and/or required package is available, and if not then call mark build in error API.

Right now what happens is if some issue happens during kickstart then the build just stays in building forever, or worse case, doesn't even notice an error occurred and still marks the build complete. In this case the client has had to develop a secondary script to run to make sure the kickstart actually did what it was supposed to.

Comment 4 Ivan Necas 2017-09-19 13:54:23 UTC
Created redmine issue http://projects.theforeman.org/issues/21007 from this bug

Comment 5 Ivan Necas 2017-09-19 13:55:25 UTC
Ok, so something like `foreman_url('built', 'fail', :message => "Failed installing puppet")` would do the trick, right?

Comment 6 Ian Tewksbury 2017-09-19 13:56:38 UTC
@Ivan,

That would be amazing.

Comment 7 Marek Hulan 2017-09-19 17:54:11 UTC
Yup, I'd just user different endpoint, not built.

Comment 8 Ivan Necas 2017-09-20 12:03:55 UTC
@Marek: what do you have it mind. Let's capture it before we all forget :)

Comment 9 Marek Hulan 2017-09-20 16:27:10 UTC
I'd prefer having generic status update API endpoint, so the template would look like this

> foreman_url('build_status_update', 'fail', :message => "Failed installing puppet")

so it could be used from other places too, e.g.

> foreman_url('build_status_update', 'post_tasks_started', :message => "Entered the %post section of a kickstart")

> foreman_url('built')

would still exist and would be used to flip the build flag, as part of which we'd also set the build status to success.

Comment 10 Ian Tewksbury 2017-09-24 22:02:07 UTC
Sounds awesome to me.

Comment 11 Satellite Program 2018-03-05 15:02:55 UTC
Upstream bug assigned to lzap

Comment 12 Satellite Program 2018-03-05 15:02:59 UTC
Upstream bug assigned to lzap

Comment 13 Satellite Program 2018-06-19 16:03:18 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21007 has been resolved.

Comment 15 Patrick Creech 2018-10-31 19:05:32 UTC
Lukas,

looks like the attached foreman issue still has an open pr?

Comment 18 jspringe 2019-08-07 00:56:36 UTC
Hiya all. Just checking in to see if there's been any progress on this? Got a couple of customers still anticipating this BZ to be released.

Comment 20 Roman Plevka 2019-08-07 15:25:58 UTC
Please, provide some verification steps. IS there any documentation whatsoever?
Is this also supposed to handle pxe-handoff failures? Which stages are being reported?

Comment 21 Roman Plevka 2019-08-08 08:40:03 UTC
VERIFIED
sat6.6.0 snap 14

- the verification steps were consulted with mhulan IRL (cancelling needinfo).

- I  updated the the last check to return non-zero return code in order to provoke marking the build as failed.
- the whole provisioning and package installation ran properly and the non-zero return code got reported to foreman, which correctly marked the build as failure with message "installation error"
- there's no notification generated for this event, but I raised a standalone RFE for this:
https://bugzilla.redhat.com/show_bug.cgi?id=1738815

Comment 23 errata-xmlrpc 2019-10-22 12:46:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:3172