Jira (PUP-10710) Disable setting invalid sections in puppet.conf

4 views
Skip to first unread message

Dorin Pleava (Jira)

unread,
Oct 8, 2020, 6:11:03 AM10/8/20
to puppe...@googlegroups.com
Dorin Pleava created an issue
 
Puppet / Bug PUP-10710
Disable setting invalid sections in puppet.conf
Issue Type: Bug Bug
Affects Versions: PUP 6.18.0
Assignee: Unassigned
Created: 2020/10/08 3:10 AM
Priority: Normal Normal
Reporter: Dorin Pleava

Puppet Version: 6.18.0
Puppet Server Version: N/A
OS Name/Version: RedHat 8

Puppet does not reject setting an invalid section in puppet.conf via the set command.

As the invalid section will be written into puppet.conf, the next time puppet.conf gets parsed, an error will be shown.

root@unlikely-beggar ~# puppet config set random213 aaaa --section random4212 root@unlikely-beggar ~# cat /etc/puppetlabs/puppet/puppet.conf [random4212] random213 = aaaa root@unlikely-beggar ~# puppet config print server Error: Could not parse /etc/puppetlabs/puppet/puppet.conf: Illegal section 'random4212' in config file at (file: /etc/puppetlabs/puppet/puppet.conf, line: 1). The only valid puppet.conf sections are: [main, master, agent, user, server]. Please use the directory environments feature to specify environments. (See https://puppet.com/docs/puppet/latest/environments_about.html) puppet

 

Desired Behavior: Do not allow setting of invalid sections in puppet.conf

Actual Behavior: Setting of invalid sections in puppet.conf works only on the first try

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
Oct 8, 2020, 11:46:04 AM10/8/20
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-10710
 
Re: Disable setting invalid sections in puppet.conf

Ah I remembered something about this. Puppet supports specifying environments as a section, see https://puppet.com/docs/puppet/6.18/config_print.html#environments and https://github.com/puppetlabs/puppet/blob/main/lib/puppet/settings.rb#L832. We could at least verify that the section name is [:main, etc] or matches Puppet::Node::Environment.valid_name?

A stricter check would be to verify that the environment exists, but that would break cases where the setting is set before the environment is created.

Reply all
Reply to author
Forward
0 new messages