Bug 1477490

Summary: Unfriendly error message when installing dhcp on interface without IP address: installer fails with pick(): must receive at least one non empty" in the logs
Product: Red Hat Satellite Reporter: Ivan Necas <inecas>
Component: InstallationAssignee: Chris Roberts <chrobert>
Status: CLOSED ERRATA QA Contact: Sachin Ghai <sghai>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: bbuckingham, chrobert, ehelms, jcallaha, sghai
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/21114
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 Ivan Necas 2017-08-02 09:03:23 UTC
Version-Release number of selected component (if applicable):
Sat-6.3 snap 9

How reproducible:
always

Steps to Reproduce:

1. configure network on the host, don't set ip address on the interface eth1
2. try to install dns and dhcp against this interface:

satellite-installer --scenario                   "satellite"\
                  --foreman-proxy-dns            "true"\
                  --foreman-proxy-dns-forwarders "8.8.8.8"\
                  --foreman-proxy-dns-forwarders "8.8.4.4"\
                  --foreman-proxy-dns-interface  "eth1"\
                  --foreman-proxy-dns-zone       "sat63.example.com"\
                  --foreman-proxy-dhcp           "true"\
                  --foreman-proxy-dhcp-interface "eth1"\
                  --foreman-proxy-tftp           "true"\
                  --foreman-proxy-content-puppet "true"\
                  --foreman-proxy-puppetca       "true"\
                  --disable-system-checks

Installer fails with a backtrace, the installer log contains:


[ERROR 2017-08-02 07:21:02 main]  pick(): must receive at least one non empty value at /usr/share/foreman-installer/modules/foreman_proxy/manifests/proxydhcp.pp:6 on node sat63-qa-rhel7.example.com
[ERROR 2017-08-02 07:21:02 main] /usr/share/ruby/vendor_ruby/puppet/util/errors.rb:106:in `fail'
[ERROR 2017-08-02 07:21:02 main] /usr/share/foreman-installer/modules/stdlib/lib/puppet/parser/functions/pick.rb:24:in `block in <module:Functions>'
[ERROR 2017-08-02 07:21:02 main] /usr/share/ruby/vendor_ruby/puppet/parser/functions.rb:164:in `block (2 levels) in newfunction'
[ERROR 2017-08-02 07:21:02 main] /usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
[ERROR 2017-08-02 07:21:02 main] /usr/share/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
[ERROR 2017-08-02 07:21:02 main] /usr/share/ruby/vendor_ruby/puppet/parser/functions.rb:157:in `block in newfunction'
[ERROR 2017-08-02 07:21:02 main] /usr/share/ruby/vendor_ruby/puppet/parser/ast/function.rb:42:in `evaluate



Expected results:
The logs contain info "Could not get the ip address from fact ipaddress_eth1"

Additional info:
This is a regression of http://projects.theforeman.org/issues/16942

The fix should be

   $ip   = pick_default($::foreman_proxy::dhcp_pxeserver, inline_template("<%= scope.lookupvar('::ipaddress_${interface_fact_name}', '') %>"), '')

The friendly error messages are tracked in http://projects.theforeman.org/issues/12662, but thi BZ is just about the more accurate error in the logs

Comment 2 Sachin Ghai 2018-01-03 09:29:50 UTC
Verified with sat6.3 snap30. 

Error message is correctly appearing in case user pass the interface when no IP assigned to it:


 ~]# satellite-installer --scenario                   "satellite"\
>                   --foreman-proxy-dns            "true"\
>                   --foreman-proxy-dns-forwarders "8.8.8.8"\
>                   --foreman-proxy-dns-forwarders "8.8.4.4"\
>                   --foreman-proxy-dns-interface  "enp0s29u1u1u5"\
>                   --foreman-proxy-dns-zone       "SAT.example.com"\
>                   --foreman-proxy-dhcp           "true"\
>                   --foreman-proxy-dhcp-interface "enp0s29u1u1u5"\
>                   --foreman-proxy-tftp           "true"\
>                   --foreman-proxy-content-puppet "true"\
>                   --foreman-proxy-puppetca       "true"\
>                   --disable-system-checks


 Could not get the ip address from fact ipaddress_enp0s29u1u1u5 at /usr/share/foreman-installer/modules/foreman_proxy/manifests/proxydhcp.pp:8 on node cloud-qe-03.idmqe.lab.eng.bos.redhat.com
/usr/share/ruby/vendor_ruby/puppet/parser/functions/fail.rb:3:in `block in <top (required)>'
/usr/share/ruby/vendor_ruby/puppet/parser/functions.rb:164:in `block (2 levels) in newfunction'
/usr/share/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'

Comment 3 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