Bug 1565093
Summary: | Do not prevent host discovery for existing MAC/IP addresses | |||
---|---|---|---|---|
Product: | Red Hat Satellite | Reporter: | Lukas Zapletal <lzap> | |
Component: | Discovery Plugin | Assignee: | Lukas Zapletal <lzap> | |
Status: | CLOSED ERRATA | QA Contact: | Lukáš Hellebrandt <lhellebr> | |
Severity: | high | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 6.3.1 | CC: | gkonda, gsigrisi, janarula, lhellebr, lzap, mlele, mmccune, rabajaj, rajgupta | |
Target Milestone: | 6.4.0 | Keywords: | Regression, Triaged | |
Target Release: | Unused | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
URL: | http://projects.theforeman.org/issues/23174 | |||
Whiteboard: | ||||
Fixed In Version: | Doc Type: | If docs needed, set a value | ||
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1624034 (view as bug list) | Environment: | ||
Last Closed: | 2018-10-16 19:16:40 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
Lukas Zapletal
2018-04-09 11:22:18 UTC
WORKAROUND for Satellite 6.3: Locate file /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_discovery-*/app/models/host/discovered.rb and delete this line: raise ::Foreman::Exception.new("Host already exists as managed: %s", "#{host.name}/#{bootif_mac}") if host.type != "Host::Discovered" Then restart httpd service to revert back to old behavior. There is a GNU diff: diff --git a/app/models/host/discovered.rb b/app/models/host/discovered.rb index 4201876..c495b3b 100644 --- a/app/models/host/discovered.rb +++ b/app/models/host/discovered.rb @@ -65,7 +65,6 @@ class Host::Discovered < ::Host::Base Rails.logger.warn "Multiple discovered hosts found with MAC address #{name_fact}, choosing one" if hosts.size > 1 host = hosts.first.host end - raise ::Foreman::Exception.new("Host already exists as managed: %s", "#{host.name}/#{bootif_mac}") if host.type != "Host::Discovered" # and save (interfaces are created via puppet parser extension) host.save(:validate => false) if host.new_record? Please revert the patch, it won't work. Sorry, I had to investigate this and test on both 6.2 and 6.3 to finally come up with a working patch. I am just creating upstream PR open for review and will ask folks to take a look shortly. It's up here: https://github.com/theforeman/foreman_discovery/pull/422 Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/23174 has been resolved. Not clean cherry pick, resolved conflicts: https://gitlab.sat.lab.tlv.redhat.com/satellite6/foreman_discovery/merge_requests/31 *** Bug 1564674 has been marked as a duplicate of this bug. *** HOTFIX AVAILABLE for Satellite 6.3.0-6.3.2: http://file.rdu.redhat.com/~cduryee/tfm-rubygem-foreman_discovery-9.1.5.3-2.HOTFIXRHBZ1565093.fm1_15.el7sat.noarch.rpm Upgrade the RPM and restart httpd service. This hotfix reverts to old behavior and also adds new option "discovery_error_on_existing" to Administer - Settings for users who want to opt-in the new behavior (early error during discovery). Verified with Sat 6.4 snap 18 with RHEV VMs. 1) Setup Capsule for provisioning, discovery, setup a (RHEV) CR, setup network... 2) In RHEV, create a machine with MAC=X, do PXEless Foreman discovery 3) In Hosts -> Discovered Hosts, Provision the discovered machine 4) In Administer -> Settings, set discovery_error_on_existing to True 5) In RHEV, delete the original machine and create another machine with MAC=X, do PXEless Foreman discovery -> get error 422 saying the machine is managed already 6) Set discovery_error_on_existing to False 7) Do PXEless Foreman discovery again, now successfully -> the machine gets added to Hosts -> Discovered Hosts 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:2927 |