Bug #12104
Non escaped quote for comment text in puppet resource -e host
| Status: | Accepted | Start date: | 01/24/2012 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | ralsh | |||
| Target version: | 2.7.x | |||
| Affected Puppet version: | Branch: | |||
| Keywords: | ||||
| Votes: | 0 |
Description
Steps to recreate error:
Assuming the comment field of a host resource has a ‘ in the text, then resource editing fails
2.7.6 (Puppet Enterprise 2.0.0)
[root@training ~]# puppet resource -e host localhost.localdomain
host { 'localhost.localdomain':
ensure => 'present',
comment => 'This host is required for Puppet's name resolution to work correctly.',
host_aliases => ['localhost', 'moocow'],
ip => '127.0.0.1',
target => '/etc/hosts',
}
^[[A^[[Ainfo: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
Could not parse for environment production: Syntax error at 's'; expected '}' at /root/x2puppet20120124-14698-rqq2jb-0:3 on node training.puppetlabs.lan
If you escape manually:
comment => 'This host is required for Puppet\'s name resolution to work correctly.',
info: Loading facts in facter_dot_d
info: Loading facts in facter_dot_d
info: Applying configuration version '1327403914'
notice: /Stage[main]//Host[localhost.localdomain]/comment: comment changed 'This host is required' for Puppets name resolution to work correctly.' to 'This host is required for Puppet's name resolution to work correctly.'
info: FileBucket adding {md5}791fb6bce2de118dee81bd818586f944
notice: Finished catalog run in 0.08 seconds
BUT then subsequent edits fail without manual escaping:
comment => 'This host is required for Puppet's DNS name resolution to work correctly.', Could not parse for environment production: Syntax error at 's'; expected '}' at /root/x2puppet20120124-3676-1lg4uky-0:3 on node training.puppetlabs.lan
and other edits on this resource (or even for example a ‘puppet resource -e host’ to edit all hosts) fail to commit subsequently even if the comment field is not edited.
History
Updated by Daniel Pittman 4 months ago
- Description updated (diff)
- Category set to ralsh
- Status changed from Unreviewed to Accepted
I can confirm this; there is insufficient escaping of values in lib/puppet/parameter.rb, self.format_value_for_display, where it doesn’t account for embedded quotes in the content. The fix should be fairly simple, but checking that there are no flow-on effects in a stable release will take some little time.