Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1108039

Summary: Symbolic link to /etc/hiera.yaml needed for puppet-hiera and dependent modules
Product: Red Hat OpenStack Reporter: Gilles Dubreuil <gdubreui>
Component: puppetAssignee: Mike Burns <mburns>
Status: CLOSED WONTFIX QA Contact: Jaroslav Henner <jhenner>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.0 (RHEL 7)CC: apevec, lhh, mburns, morazi, rhos-maint, srevivo
Target Milestone: ---Keywords: ZStream
Target Release: 5.0 (RHEL 7)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-12 20:54:11 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:
Bug Depends On:    
Bug Blocks: 1105597    

Description Gilles Dubreuil 2014-06-11 11:01:56 UTC
Hiera installation provides /etc/hiera.yaml configuration file by default.

Meanwhile to be able to use hiera from puppet, a similar configuration file is needed in /etc/puppet/hiera.yaml since this is the default for puppet/hiera.
The best practice is to create a symbolic link to /etc/hiera.yaml. 
This has the advantage to avoid redundancy.

The symbolic link to be created as part of the RPM

This is needed for puppet-gluster (see blockers).

That would also avoid warning messages such as:
--------------------
 ./foreman_server.sh
#################### RED HAT OPENSTACK #####################
Thank you for using the Red Hat OpenStack Foreman Installer!
############################################################
Press [Enter] to continue
net.ipv4.ip_forward = 1
Saved 1 file(s)
... snip ...
Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
--------------------

Comment 2 Gilles Dubreuil 2014-06-27 01:56:15 UTC
I think neither puppet or hiera RMPs to provide the symbolic link because there are no deps between them even though they are often installed together.

On the other hand, openstack-installer and rhel-osp-installer depends on above, guaranteeing they're install, so the link can be created safely
Can both installers have the following added? 

ln -s /etc/hiera.yaml /etc/puppet/yaml

Comment 3 Mike Burns 2014-06-27 11:44:16 UTC
puppet has explicit requires on hiera:

$ rpm -qp --requires puppet-3.6.2-1.el6.noarch.rpm |grep hiera
hiera >= 1.0.0

Comment 4 Mike Burns 2014-06-27 13:29:47 UTC
I think this should be done in puppet given that it does have an explicit dependency on hiera.  My only reluctance is that current functionality defaults to a certain hiera.yaml which is different than /etc/hiera.yaml.  This means that some things might change for people who are relying on the built-in hiera conf.

Comment 5 Gilles Dubreuil 2014-06-28 01:23:40 UTC
(In reply to Mike Burns from comment #4)
> My only reluctance is that current functionality
> defaults to a certain hiera.yaml which is different than /etc/hiera.yaml.

Could you please develop?
 
> This means that some things might change for people who are relying on the
> built-in hiera conf.

Looking at previous puppet versions RPM we've provided, there isn't any hiera.yaml default.

That said (maybe that's what you meant above), if a specific path/file has been configured manually, it has to be explicitly set in puppet.conf and that should be preserved as part of the RPM config %files.

Although there if the latter turns out to using /etc/puppet/hiera.yaml then we'll have to make sure the symbolic link is not created in order to not override user's settings.

Besides, all of that we might have conflicts of interest from a OSP deployment viewpoint because we have to make sure the hiera default (/etc/hiera.yaml) is in place to have it working the way expected. That means if they are existing hiera defaults, they must be merged manually by the user anyway, since there are no global/local/inheritance mechanism for hiera.yaml files.

Comment 7 Mike Burns 2014-09-15 11:40:43 UTC
Mike,  any opinions on this bz?

Comment 8 Mike Burns 2014-11-20 13:59:58 UTC
Proposed patch

diff --git a/puppet.spec b/puppet.spec
index a811444..78048b3 100644
--- a/puppet.spec
+++ b/puppet.spec
@@ -290,6 +290,9 @@ fi
 exit 0

 %post
+if [ ! -e /etc/puppet/hiera.yaml ]; then
+    ln -s /etc/hiera.yaml /etc/puppet/hiera.yaml
+fi
 %if 0%{?_with_systemd}
 /bin/systemctl daemon-reload >/dev/null 2>&1
 %else
@@ -342,6 +345,9 @@ fi
 exit 0

 %preun server
+if [ -h /etc/puppet/hiera.yaml ]; then
+    rm -f /etc/puppet/hiera.yaml ]
+fi
 %if 0%{?_with_systemd}
 if [ "$1" -eq 0 ] ; then
   /bin/systemctl --no-reload disable puppetmaster.service > /dev/null 2>&1

Comment 9 Mike Burns 2016-10-12 20:54:11 UTC
very old bug that seems unlikely to be valuable anymore.  If you disagree, then please reopen and target to a more recent version.