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 1399352

Summary: idm_register snippet automount fails when providing idm_server variable.
Product: Red Hat Satellite Reporter: evan.hisey
Component: Provisioning TemplatesAssignee: Marek Hulan <mhulan>
Status: CLOSED ERRATA QA Contact: Shimon Shtein <sshtein>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.2.4CC: ahumbe, bbuckingham, ehelms, evan.hisey, jcallaha, kbidarka, mhulan, mtaru, oshtaier, phess, sshtein, tim.daley, zhunting
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-21 16:54:37 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 evan.hisey 2016-11-28 20:08:15 UTC
Description of problem:
When you set the idm_server parameter on a host it will break the ipa-client-automount with the error "no such option: --domain" This is caused by a reassignment of the host parameter in the snippet to include the --domain option (see additional information)

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


How reproducible:
Every time.
 

Steps to Reproduce:
1.In the web gui for satellite edit a host, under parameters add a host parameter called idm_server and set the value to an IDM server.

2.Next add the parameter idm_automount with value of true. 

3. Stage the host build

4. Build the Host
Actual results:
Usage: ipa-client-automount [options]

ipa-client-automount: error: no such option: --domain

Expected results:
successful run of ipa-client-automount

Additional info:
From the Snippet:

<% if @host.params['idm_server'] -%>
<% domain = @host.params['idm_domain'] || @host.realm.name.downcase -%>

idm_server="--server <%= @host.params['idm_server'] %> --domain <%=domain %>"
<% end -%>

This code fragment triggers on the parameter being present, and parses the domain name from the parameter value and the --domain switch to idm_server. This needed for this fragment:

usr/sbin/ipa-client-install -w '<%= @host.otp || "$HOST[OTP]" %>' --realm=<%= @host.realm %> -U $idm_mkhomedir $idm_opts $idm_server $idm_ssh

but breaks the ipa-client-automount fragment by using the same modified idm_server parameters:

<% if @host.param_true? 'idm_automount' -%>
if [ -f /usr/sbin/ipa-client-automount ]
then
  /usr/sbin/ipa-client-automount $idm_server $automount_location --unattended
fi
<% end -%>

Since ipa-client-automount does not accept the --domain switch the code breaks. Ipa-client-automount need a unique server parameter or idm_server parameter needs to be handle differently.

Comment 1 evan.hisey 2016-11-28 22:08:27 UTC
By modifying the automount fragment to this:

<% if @host.param_true? 'idm_automount' -%>
if [ -f /usr/sbin/ipa-client-automount ]
then
  <%if @host.params['idm_server_automount'] -%>
   idm_server_automount="--server <%= @host.params['idm_server_automount'] %>"
  <% end -%>
  /usr/sbin/ipa-client-automount $idm_server_automount $automount_location --unattended
fi
<% end -%>

And using the new idm_server_automount parament,I now get the following correct output:

IPA server: example.idm.com
Location: default
Configured /etc/nsswitch.conf
Configured /etc/sysconfig/nfs
Configured /etc/idmapd.conf
Started rpcgssd
Restarting sssd, waiting for it to become available.
Started autofs

Comment 4 Marek Hulan 2016-11-30 16:27:16 UTC
Thanks for the proposed fix. Would it make sense to rather reuse the idm_server parameter value? This way user would have to duplicate the information in two parameters.

The suggested version would be


> <% if @host.param_true? 'idm_automount' -%>
> if [ -f /usr/sbin/ipa-client-automount ]
> then
>   <%if @host.params['idm_server'] -%>
>    idm_server_automount="--server <%= @host.params['idm_server'] %>"
>   <% end -%>
>   /usr/sbin/ipa-client-automount $idm_server_automount $automount_location -- unattended
> fi
> <% end -%>

the only difference is  <%= @host.params['idm_server'] %>" instead of <%if @host.params['idm_server_automount'] -%>

If that make sense I could send a patch to upstream repo.

Comment 5 evan.hisey 2016-11-30 17:48:44 UTC
Marek-
 The only issue I see that could arise is the case where idm_server and idm_automount_server were different machines. I do not know how often this edge case would occur, but I can see it being something I might have needed.

Comment 7 Marek Hulan 2016-12-01 08:06:34 UTC
Ok, I'll try to check idm_server_automount and if it's not present we'd fallback to idm_server. That way it would still work without copying the value if automount server is the same but keeping the way to override the value through idm_server_automount parameter.

Changing back the component, it is probably better fit.

Comment 8 Marek Hulan 2016-12-01 08:11:46 UTC
Created redmine issue http://projects.theforeman.org/issues/17543 from this bug

Comment 9 Bryan Kearney 2016-12-01 11:06:00 UTC
Upstream bug assigned to mhulan

Comment 10 Bryan Kearney 2016-12-01 11:06:03 UTC
Upstream bug assigned to mhulan

Comment 11 Bryan Kearney 2016-12-10 03:05:54 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/17543 has been resolved.

Comment 20 Marek Hulan 2017-05-22 18:30:03 UTC
*** Bug 1387888 has been marked as a duplicate of this bug. ***

Comment 23 Kedar Bidarkar 2018-01-29 14:00:16 UTC
idm_register snippet is now updated appropriately.

VERIFIED with sat6.3.0-snap-32

Comment 24 Satellite Program 2018-02-21 16:54:37 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