Bug 1470242

Summary: Discovery kexec does not work due to incorrect JSON format
Product: Red Hat Satellite Reporter: Roman Plevka <rplevka>
Component: Discovery PluginAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact: Roman Plevka <rplevka>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: ehelms, lzap, wdh
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman_discovery-9.1.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 17:11:23 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 Roman Plevka 2017-07-12 14:57:25 UTC
Description of problem:
The error is HTTP 500:

#<JSON::ParserError: 757: unexpected token at '{"comment"=>"WARNING: Both kernel and initram are not set in preview mode due to http://projects.theforeman.org/issues/19737", "kernel"=>"http://xxxx.redhat.com/pulp/repos/Default_Organization/Library/content/dist/rhel/server/7/7.3/x86_64/kickstart//images/pxeboot/vmlinuz", "initram"=>"http://xxxx.redhat.com/pulp/repos/Default_Organization/Library/content/dist/rhel/server/7/7.3/x86_64/kickstart//images/pxeboot/initrd.img", "append"=>"ks=http://xxxx.redhat.com/unattended/provision?token=6d999547-cxxx2&static=yes inst.ks.sendmac ip=192.168.100.13::192.168.100.1:255.255.255.0:::none nameserver=192.168.100.1 ksdevice=bootif BOOTIF=00-52-54-00-eb-8a-cd nomodeset ", "extra"=>["--args-linux"]}'>

Introduced by #19412 or #19732 where
old.becomes(Host::Discovered).kexec json.to_s

this creates string represantion of Ruby hash instead of valid JSON. This must be:
old.becomes(Host::Discovered).kexec json.to_json

Version-Release number of selected component (if applicable):
tfm-rubygem-foreman_discovery-9.1.1-1.fm1_15.el7sat.noarch
rubygem-smart_proxy_discovery-1.0.4-3.el7sat.noarch

Steps to Reproduce:
1. perform  pxless discovery (to force kexec instead of reboot):
- have a host (VM is fine) and load foreman discovery image
- make sure the facts are being sent to satellite successfully and the message: waiting for kexec appeared
[- alternatively, remaster the FDI to automatically send out the custom info]
* start monitoring production.log at this point
- after the host appears in Discovered hosts on satellite, try to provision it.
- there should be an err 500 on trying to kexec the host (the error is not visible in UI)
- UI creates the host host entity in the build mode, but the host is not being kexec-ed and thus never going to be provisioned.


Expected results:
kexec works jsut fine

Comment 2 Lukas Zapletal 2017-07-13 09:24:18 UTC
Blocker, upstream PR pending.

Comment 3 Satellite Program 2017-08-24 12:15:39 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20290 has been resolved.

Comment 4 Roman Plevka 2017-10-26 14:51:59 UTC
VERIFIED
on sat6.3.0-snap#20

kexec now works as expected, unblocking the whole pxless discovery-based provisioning.

Comment 5 Bryan Kearney 2018-02-21 17:11:23 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-2018:0336