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.

Bug 1639988

Summary: Adding Host parameters is failing with Name has already been taken
Product: Red Hat Satellite Reporter: Simon Reber <sreber>
Component: Tasks PluginAssignee: Ivan Necas <inecas>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.3.4CC: aruzicka, inecas, jalviso, matthew.lesieur, molasaga, orabin
Target Milestone: UnspecifiedKeywords: Regression
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman-tasks-0.9.6.10-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-30 15:23:03 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:
Attachments:
Description Flags
hotfix against Satellite 6.3.4 none

Description Simon Reber 2018-10-17 05:57:30 UTC
Description of problem:

Starting with Red Hat Satellite 6.3.4 adding Host Parameters to an existing host is failing. Somehow the application logic seems to duplicate the Host Parameter added and then complains that the name is already taken.

Foreman production log looks as following.

2018-10-17 01:35:47 5d37ca92 [app] [I] Started PATCH "/hosts/1" for 10.36.116.118 at 2018-10-17 01:35:47 -0400
2018-10-17 01:35:47 5d37ca92 [app] [I] Processing by HostsController#update as */*
2018-10-17 01:35:47 5d37ca92 [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"<removed>", "host"=>{"name"=>"test001", "hostgroup_id"=>"1", "content_facet_attributes"=>{"lifecycle_environment_id"=>"1", "content_view_id"=>"1", "content_source_id"=>"1"}, "environment_id"=>"1", "puppet_proxy_id"=>"1", "puppet_ca_proxy_id"=>"1", "openscap_proxy_id"=>"", "puppetclass_ids"=>[""], "managed"=>"true", "progress_report_id"=>"[FILTERED]", "interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "mac"=>"00:00:00:00:00:00", "identifier"=>"", "name"=>"test001", "domain_id"=>"1", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "execution"=>"1", "tag"=>"", "attached_to"=>"", "id"=>"1"}}, "architecture_id"=>"1", "operatingsystem_id"=>"1", "ptable_id"=>"92", "pxe_loader"=>"PXELinux BIOS", "disk"=>"", "host_parameters_attributes"=>{"1539754531336"=>{"name"=>"FIREWALL", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false"}}, "is_owned_by"=>"3-Users", "enabled"=>"1", "model_id"=>"", "comment"=>"", "overwrite"=>"false"}, "bare_metal_capabilities"=>"build", "id"=>"1"}
2018-10-17 01:35:47 5d37ca92 [app] [I] Current user: admin (administrator)
2018-10-17 01:35:47 5d37ca92 [app] [D] Setting current user thread-local variable to admin
2018-10-17 01:35:47 5d37ca92 [app] [I] Expire fragment views/tabs_and_title_records-3 (0.1ms)
2018-10-17 01:35:47 5d37ca92 [app] [D] Setting current location thread-local variable to none
2018-10-17 01:35:47 5d37ca92 [app] [D] Setting current organization thread-local variable to none
2018-10-17 01:35:47 5d37ca92 [app] [D] Setting current organization thread-local variable to none
2018-10-17 01:35:47 5d37ca92 [app] [D] Setting current location thread-local variable to none
2018-10-17 01:35:47 5d37ca92 [app] [D] Unpermitted parameters: utf8, _method, authenticity_token, bare_metal_capabilities, id, locale
2018-10-17 01:35:47 5d37ca92 [app] [I] Failed to save: Host parameters Please ensure the following parameters name are unique
2018-10-17 01:35:47 5d37ca92 [app] [D] Deface: 1 overrides found for 'hosts/_form'
2018-10-17 01:35:47 5d37ca92 [app] [D] Deface: 'add_execution_interface_js' matched 1 times with 'div#primary'
2018-10-17 01:35:47 5d37ca92 [app] [I] Deface: [WARNING] No :original defined for 'add_execution_interface_js', you should change its definition to include:
 |  :original => '6771be87072b3f2a046d4a6ab34d5432aa443ec6' 

Using `hammer` instead is not possible because of https://bugzilla.redhat.com/show_bug.cgi?id=1554774.

It also seems that this issue was found in Red Hat Satellite 6.4 BETA and was fixed in there https://bugzilla.redhat.com/show_bug.cgi?id=1609764

But since Red Hat Satellite 6.4 was just released we can not expect the customer to update right away and thus require a fix for the issue in Red Hat Satellite 6.3.4

Version-Release number of selected component (if applicable):

 - satellite-6.3.4-2.el7sat.noarch

How reproducible:

 - Always

Steps to Reproduce:
1. Navigate to Hosts > All Hosts > *select* > Edit > Parameters
2. Button Add Parameter
3. Fill any values to Name and Value
4. Submit

Actual results:
All entered Host Parameters are shown twice and there is an error message saying "Name has already been taken" 

Expected results:
Host Parameter is added

Additional info:
This was working on Red Hat Satellite 6.3.3 and is therefore considered a regression

Comment 2 Ivan Necas 2018-10-17 07:53:26 UTC
This issue has been introduced as a regression of https://bugzilla.redhat.com/show_bug.cgi?id=1624020, we're going to backport fix from https://bugzilla.redhat.com/show_bug.cgi?id=1609764 on top of 6.3.4 and propose it for 6.3.5 + build a hotfix for people that would be blocked by this issue in the meantime.

Comment 5 Ivan Necas 2018-10-17 08:51:49 UTC
Created attachment 1494769 [details]
hotfix against Satellite 6.3.4

To apply:

yum install -y tfm-rubygem-foreman-tasks-0.9.6.8-2.HOTFIXRHBZ1639988.fm1_15.el7sat.noarch.rpm 
katello-service restart

Comment 6 Ivan Necas 2018-10-17 08:52:45 UTC
A workaround is to use hammer:

hammer host set-parameter --host host-name.example.com --name param-name --value param-value

Comment 8 jcallaha 2018-10-23 17:35:23 UTC
Verified in Satellite 6.3.5 Snap 1.

Followed the steps outlined in the report and had no issues.
The additional parameter was added successfully.

See attached video for verification.

Comment 11 errata-xmlrpc 2018-10-30 15:23:03 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/RHBA-2018:3411

Comment 12 jalviso 2018-12-19 06:38:12 UTC
*** Bug 1645727 has been marked as a duplicate of this bug. ***