java.lang.IllegalArgumentException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • The Puppet compiler uses the following regex to determine whether or not a tag\ is valid: {code} ^[0-9A-Za-z_][0-9A-Za-z_:.-]*$ {code} This regex has an issue in that validation will stop at the first newline character in a tag. PuppetDB uses a stricter regex that will reject any tag containing newlines: {code} \A[a-z0-9_][a-z0-9_:\-.]*\Z {code} This rejection causes PuppetDB to discard catalogs containing resources tagged with strings containing newlines. h2. Reproduction Case Install PE 2016.2.1 and add the following resource to the default node declaration in {{/etc/puppetlabs/code/environments/production/manifests/site.pp}}: {code:puppet} notify {"two\nlines": } {code} Run {{puppet agent -t}}. h3. Outcome The catalog compiles and applies just fine: {noformat} # puppet agent -t Info: Using configured environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Info: Caching catalog for pe-201621-master.puppetdebug.vlan Info: Applying configuration version '1472744920' Notice: two lines {noformat} However, errors are present in the PuppetDB log: {noformat} 2016-09-01 08:48:49,635 ERROR [p.p.mq-listener] [a7244661-f9cd-469c-bfac-ca35be92db5c] [replace catalog] Fatal error on attempt 0 for pe-201621-master.puppetdebug.vlan java.lang.IllegalArgumentException: Resource '{:type "Notify", :title "two\nlines"}' has an invalid tag 'two lines'. Tags must match the pattern /\A[a-z0-9_][a-z0-9_:\-.]*\Z/. at puppetlabs.puppetdb.catalogs$validate_resources.invokeStatic(catalogs.clj:303) ~[na:na] at puppetlabs.puppetdb.catalogs$validate_resources.invoke(catalogs.clj:294) ~[na:na] ... {noformat} And a query to the PuppetDB node endpoint shows that a new set of facts was stored along with a new report, but the catlog is out of date: {noformat} # curl http://127.0.0.1:8080/pdb/query/v4/nodes/$(hostname -f)f) { "deactivated" : null, "latest_report_hash" : "221e50f615f0320d22c276dd4c4cc01634ba0841", "facts_environment" : "production", "cached_catalog_status" : "not_used", "report_environment" : "production", "catalog_environment" : "production", "facts_timestamp" : "2016-09-01T15:56:58.329Z", "latest_report_noop" : false, "expired" : null, "report_timestamp" : "2016-09-01T15:57:14.151Z", "certname" : "pe-201621-master.puppetdebug.vlan", "catalog_timestamp" : "2016-09-01T01:57:03.472Z", "latest_report_status" : "changed" } {noformat} h3. Expected Outcome The Puppet compiler uses {{/A}} and {{/Z}} to validate tags so that newlines don't break validation.
    via by Charlie Sharpsteen,
    • java.lang.IllegalArgumentException: Resource '{:type "Notify", :title "two\nlines"}' has an invalid tag 'two lines'. Tags must match the pattern /\A[a-z0-9_][a-z0-9_:\-.]*\Z/. at puppetlabs.puppetdb.catalogs$validate_resources.invokeStatic(catalogs.clj:303)[na:na] at puppetlabs.puppetdb.catalogs$validate_resources.invoke(catalogs.clj:294)[na:na]
    No Bugmate found.