The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #17053

Broken handling of facts that look like dates

Added by Ken Johnson over 3 years ago. Updated over 3 years ago.

Status:Needs DecisionStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Affected Puppet version:2.7.19 Branch:https://github.com/puppetlabs/puppet/pull/1281
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com


Description

Received the following report from a user about unusual behavior with custom facts whose value looks like a date. I was able to replicate this with PE 2.5.3 under Ubuntu 12.04 and PE 2.6.0 under Ubuntu 10.04 (it’s what I had handy!) by following the steps detailed.

—START—

Last night a few of our clients (not all) started reporting as failed in our dashboard. When checking a bit closer the client spits out the following error message when executing a puppet run:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not intern from b64_zlib_yaml: invalid date
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

There was no changes to our puppet manifests at this time. There has been changes to a couple of facts, but this the clients was running just fine with these facts earlier on.

When running with debug and verbose enabled i get the following:

debug: Using cached certificate_revocation_list for ca
debug: file_metadata supports formats: b64_zlib_yaml pson raw yaml; using pson
debug: Finishing transaction 70037384342420
info: Loading facts in LastUpgrade
......
info: Loading facts in Location
info: Loading facts in facter_dot_d
debug: catalog supports formats: b64_zlib_yaml dot pson raw yaml; using pson
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not intern from b64_zlib_yaml: invalid date
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
debug: Using cached certificate for ca
debug: Using cached certificate for node1
debug: Using cached certificate_revocation_list for ca
debug: Value of 'preferred_serialization_format' (pson) is invalid for report, using default (b64_zlib_yaml)
debug: report supports formats: b64_zlib_yaml raw yaml; using b64_zlib_yaml

We found the cause of the problem and this relates to a fact:

Facter.add("LastUpgrade") do
        setcode do
                if File.exists?("/tmp/status")
                        file = File.open("/tmp/status")
                        content = file.read
                        content.chomp
                else
                        content = "Unknown"
                        content.chomp
                end

        end
end

This fact should read the content of the file as a string. Puppet some how interpret this as a date and fails when the format is wrong.

How to reproduce: 1. add the facts to a client 2. add a line containing “2012-16-10” to /tmp/status 3. execute a new puppet run.

The client will fail with the error message above.


Related issues

Related to Puppet - Feature #21427: Deprecate YAML for network data transmission Closed

History

#1 Updated by Ken Johnson over 3 years ago

  • Affected Puppet version set to 2.7.19

#2 Updated by Ken Johnson over 3 years ago

  • Description updated (diff)

#3 Updated by Ken Johnson over 3 years ago

  • Description updated (diff)

#4 Updated by Ken Johnson over 3 years ago

  • Description updated (diff)

#5 Updated by Patrick Carlisle over 3 years ago

  • Description updated (diff)

#6 Updated by Anonymous over 3 years ago

This should be fixed for PE >= 2.7.0

This (closed) pull request may fix it in earlier versions of PE https://github.com/puppetlabs/puppet/pull/1281

Ken, do you want to try testing out this patch?

#7 Updated by eric sorenson over 3 years ago

  • Status changed from Unreviewed to Needs Decision
  • Assignee set to Anonymous
  • Branch set to https://github.com/puppetlabs/puppet/pull/1281

David thanks for working on this — from the last comments on the pull request, Jeff wants further tests around this and can be available to help you get started with writing them if you want. OTOH if it’s fixed already in newer versions maybe you don’t have to work to get it fully cleaned up. Feel free to close if that’s case.

#8 Updated by Anonymous over 3 years ago

Eric-

My hesitance is related entirely to my lack of understanding of the process of getting tests accepted for non-HEAD versions of Puppet. If you could walk me through that policy/process/perspective, I’d be more than happy to write the test(s).

Also available in: Atom PDF