Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
We prevented discovering a host with existing MAC managed address in #16890 because Foreman was supposed to prevent creation of NICs with same MAC addresses. It turns out this validation does not work (#23173) and the discovery prevention patch created an unnecessary regression to existing users.
In this patch, we will revert back the old behavior, the new preventing will be only available as discovery opt-in setting.
Links:
http://projects.theforeman.org/issues/23173http://projects.theforeman.org/issues/16890
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
Comment 7Satellite Program
2018-04-13 10:28:21 UTC
Comment 14Lukáš Hellebrandt
2018-08-27 14:33:50 UTC
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