15

[PUP-7554] Puppet runs fail when hiera.yaml version 3 detected in a module - Pup...

 3 years ago
source link: https://tickets.puppetlabs.com/browse/PUP-7554
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Uploaded image for project: 'Puppet'

Puppet runs fail when hiera.yaml version 3 detected in a module

Details

  • Type: viewavatar?size=xsmall&avatarId=11503&avatarType=issuetype Bug
  • Status: Closed
  • Priority: blocker.svg Blocker
  • Resolution: Fixed
  • Affects Version/s: PUP 4.10.1
  • Component/s: None
  • Environment:

    PE 2016.4.5 with Hiera.yaml 3 files in modules

  • Template:
  • Epic Link:
  • Sub-team:
  • Team:

    Agent

  • Story Points:
  • Sprint:
    Agent 2017-05-31, Agent 2017-06-14

Description

This is a regression when upgrading from the 2016.4.x LTS to 2016.4.5. Puppet version 4.10.1 runs fail when an hiera.yaml version 3 file is found in the module. For a number of reasons, customers may have hiera.yaml files in modules and the environment. There should be a warning about the version and it should be ignores instead of causing a failure.

Impact
Customers that upgrade to the latest LTS which have hiera.yaml 3 files in their modules will have failures. The upgrade should allow for customers to migrate into a hiera 5 type environment without failures.

Activity

added a comment - 2017/05/31 12:05 PM

Henrik Lindberg please provide release notes for this issue, if applicable.

added a comment - 2017/05/31 3:32 PM

Thomas Hallgren, Ethan Brown would the spec tests benefit from the addition of something like:

index a69f96c..5578471 100644
--- a/spec/unit/functions/lookup_spec.rb
+++ b/spec/unit/functions/lookup_spec.rb
@@ -2084,6 +2084,9 @@ describe "The lookup function" do
             expect(lookup('mod_a::a')).to eql('value mod_a::a (from environment)')
             expect(warnings).to include(/hiera.yaml version 3 found at module root was ignored/)
           end
+          it 'does not raise an error' do
+            expect { lookup('mod_a::a') }.to_not raise_error(Puppet::Error)
+          end
         end
         context "but a metadata.json with 'module_data_provider=hiera'" do

that passes for me and ensures we don't error in addition to the warning.

added a comment - 2017/05/31 4:16 PM - edited

validated against puppet-agent build: e334e8d1e02858d51509997a4d354e93e7d94981

[root@n8mphtq05lcfzkx production]# cat /opt/puppetlabs/puppet/VERSION
1.10.1.37.ge334e8d

containing puppet sha: puppet 4.10.1-90-g33b929c
with:

[root@n8mphtq05lcfzkx somemodule]# puppet agent -t --server $(hostname -f)
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Function lookup() did not find a value for the name 'somemodule::somekey' on node n8mphtq05lcfzkx.delivery.puppetlabs.net
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
# [expected]
[root@n8mphtq05lcfzkx somemodule]# puppet lookup somemodule::somekey
Warning: /etc/puppetlabs/puppet/hiera.yaml: Use of 'hiera.yaml' version 3 is deprecated. It should be converted to version 5
   (in /etc/puppetlabs/puppet/hiera.yaml)
Warning: hiera.yaml version 3 found at the environment root was ignored
   (in /etc/puppetlabs/code/environments/production/hiera.yaml)
Warning: hiera.yaml version 3 found at module root was ignored
   (in /etc/puppetlabs/code/environments/production/modules/somemodule/hiera.yaml)
# [expected]
[root@n8mphtq05lcfzkx production]# cat modules/somemodule/hiera.yaml modules/somemodule/manifests/init.pp manifests/site.pp
---
:backends:
  - yaml
:hierarchy:
  - "nodes/%{::trusted.certname}"
  - common
:yaml:
# datadir is empty here, so hiera uses its defaults:
# - /etc/puppetlabs/code/environments/%{environment}/hieradata on *nix
# - %CommonAppData%\PuppetLabs\code\environments\%{environment}\hieradata on Windows
# When specifying a datadir, make sure the directory exists.
  :datadir:
class somemodule {
  notify{"somemodule_${lookup('somemodule::somekey')}":}
}
include somemodule
[root@n8mphtq05lcfzkx production]# cat modules/somemodule/hieradata/common.yaml
---
somemodule::somekey: somevalue

added a comment - 2017/05/31 4:20 PM - edited

i could not get the warning to show up in the agent log no matter what i did. --strict, --debug, --verbose did not affect this.

is the warning supposed to be master/server only?

[root@n8mphtq05lcfzkx production]# grep ignored /var/log/puppetlabs/puppetserver/puppetserver.log
2017-05-31 15:52:55,912 WARN  [qtp1533593850-56] [puppetserver] Puppet hiera.yaml version 3 found at the environment root was ignored
2017-05-31 15:55:18,137 WARN  [qtp1533593850-59] [puppetserver] Puppet hiera.yaml version 3 found at module root was ignored

added a comment - 2017/05/31 4:30 PM

John Duarte FYI there is a test suite for hiera5 in the PDE testrail group.
we really need to re-org tests by their project, IMO.

i'd love to move the hiera5 and language test-cases back out of PDE into wherever the rest of the puppet tests should go.
i have a feeling the case linked to this ticket is a dupe

added a comment - 2017/05/31 9:55 PM

Eric Thompson, afaik, all unit tests implicitly tests for no error so adding a test like that doesn't validate anything.

added a comment - 2017/05/31 10:33 PM

Eric Thompson, regarding the warning. It will only show up in the log on the master, and it will only show up once so what you see is to be expected.

added a comment - 2017/06/01 3:27 AM

Moving this back to "Ready for Test" as it behaves as expected.

People

Assignee:

useravatar?size=small&avatarId=10123 Unassigned

Reporter:

jarret.lavallee Jarret Lavallee

Votes: 0 Vote for this issue Watchers: 10 Start watching this issue

Dates

Created: 2017/05/16 3:21 PM Updated: 2017/06/14 6:18 AM Resolved: 2017/06/01 5:26 AM

Zendesk Support


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK