Jira (PDB-5185) PuppetDB rejects catalogs with tags containing newlines (automatically by Puppet)

2 views
Skip to first unread message

Alexander Fisher (Jira)

unread,
Jul 9, 2021, 9:54:02 AM7/9/21
to puppe...@googlegroups.com
Alexander Fisher created an issue
 
PuppetDB / Bug PDB-5185
PuppetDB rejects catalogs with tags containing newlines (automatically by Puppet)
Issue Type: Bug Bug
Affects Versions: PDB 6.17.0
Assignee: Unassigned
Components: PuppetDB
Created: 2021/07/09 6:53 AM
Priority: Normal Normal
Reporter: Alexander Fisher

Puppet Version: 6.23.0
Puppet Server Version: 6.16.0
OS Name/Version: CentOS 7

Puppet allows you to create resources with titles containing newlines. (In my case, this was not entirely intentional and fixable. See below).  It also automatically creates a tag with the resource title name.  Resource titles with newlines is apparently valid

From https://puppet.com/docs/puppet/7/lang_reserved.html#lang_acceptable_char-resource-names

"Resource titles can contain any characters whatsoever and are case-sensitive."

But PuppetDB is less than impressed by these tag names.

2021-07-08T11:29:54.869+01:00 ERROR [p.p.command] [613,251] [replace catalog] Fatal error on attempt 0 for example.com
clojure.lang.ExceptionInfo:
        at puppetlabs.puppetdb.command$fatality.invokeStatic(command.clj:247)
        at puppetlabs.puppetdb.command$fatality.invoke(command.clj:246)
        at puppetlabs.puppetdb.command$prep_replace_catalog.invokeStatic(command.clj:313)
        at puppetlabs.puppetdb.command$prep_replace_catalog.invoke(command.clj:312)
        at puppetlabs.puppetdb.command$prep_command.invokeStatic(command.clj:468)
        at puppetlabs.puppetdb.command$prep_command.invoke(command.clj:464)
        at puppetlabs.puppetdb.command$process_message.invokeStatic(command.clj:785)
        at puppetlabs.puppetdb.command$process_message.invoke(command.clj:742)
        at puppetlabs.puppetdb.command$message_handler$fn__32797.invoke(command.clj:820)
        at puppetlabs.puppetdb.threadpool$dochan$fn__32390$fn__32391.invoke(threadpool.clj:116)
        at puppetlabs.puppetdb.threadpool$gated_execute$fn__32352.invoke(threadpool.clj:69)
        at clojure.lang.AFn.run(AFn.java:22)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException: Resource '{:type "Concat_fragment", :title "contact_fragment_itteam\n"}' has an invalid tag 'contact_fragment_itteam
'. Tags must match the pattern /[[\p{L}&&[^\p{Lu}]]\p{N}_][[\p{L}&&[^\p{Lu}]]\p{N}_:.-]*/.
        at puppetlabs.puppetdb.catalogs$validate_resources.invokeStatic(catalogs.clj:321)
        at puppetlabs.puppetdb.catalogs$validate_resources.invoke(catalogs.clj:312)
        at puppetlabs.puppetdb.catalogs$validate.invokeStatic(catalogs.clj:364)
        at puppetlabs.puppetdb.catalogs$validate.invoke(catalogs.clj:361)
        at puppetlabs.puppetdb.catalogs$fn__25995.invokeStatic(catalogs.clj:447)
        at puppetlabs.puppetdb.catalogs$fn__25995.invoke(catalogs.clj:443)
        at clojure.lang.MultiFn.invoke(MultiFn.java:239)
        at puppetlabs.puppetdb.command$prep_replace_catalog.invokeStatic(command.clj:314)
        ... 12 common frames omitted

Desired Behavior:

**For PuppetDB to store the catalog or for Puppet to reject the resource title or sanitise the tag created.

Actual Behavior:

PuppetDB does not store the catalog, (in my case causing another node's catalog to be missing some squid ACLs)

 

FWIW, my code looked a bit like...

$users = generate('/my_ldap_script_that_returns_users.sh).split(',')
 
# What I should have done!
# $users = generate('/my_ldap_script_that_returns_users.sh).chomp.split(',')
 
foo::user { $users:
  ...
}

So the last foo::user resource created has a trailing newline.  This actually caused no issues with Puppet/PuppetDB 4, but PuppetDB 6 won't store this catalog.

https://tickets.puppetlabs.com/browse/PDB-4326

and https://tickets.puppetlabs.com/browse/PUP-6670 seem related.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages