Issue #8255 has been updated by Josh Cooper. Status changed from In Topic Branch Pending Review to Merged - Pending Release
This was merged in 2.7.x in commit [https://github.com/puppetlabs/puppet/commit/aef93cee8ae2133f9b2c571b23c490ef3405e3fe](https://github.com/puppetlabs/puppet/commit/aef93cee8ae2133f9b2c571b23c490ef3405e3fe) Note at the time the original bug report was filed, modes expressed as strings were not correctly converted. But between that time and now, that part was fixed in a different commit. For example, here a directory with a string mode is correctly converted: <pre> :client_datadir => { :default => "$vardir/client_data", :mode => "750", :desc => "The directory in which serialized data is stored on the client."}, </pre> And the result of genmanifest: <pre> file { '/Users/josh/.puppet/var/client_data': ensure => 'directory', backup => 'false', links => 'follow', loglevel => 'debug', mode => '750', } </pre> The part that was broken and is now fixed by this commit is the case where modes are expressed as fixnum's: <pre> :lastrunreport => { :default => "$statedir/last_run_report.yaml", :mode => 0660, :desc => "Where puppet agent stores the last run report in yaml format." }, </pre> Which genmanifest incorrectly converted to: <pre> file { '/Users/josh/.puppet/var/state/last_run_report.yaml': ensure => 'file', backup => 'false', links => 'follow', loglevel => 'debug', mode => '432', } </pre> This commit fixes the fixnum case (mode => 0660) and doesn't break the string cases (mode => '750' and mode => '0750') ---------------------------------------- Bug #8255: inconsistent handling of octal in file { mode => 'nnnn' } https://projects.puppetlabs.com/issues/8255 Author: tgeeky - Status: Merged - Pending Release Priority: Normal Assignee: tgeeky - Category: settings Target version: 2.7.x Affected Puppet version: 2.7.1 Keywords: octal, permissions, genmanifest, defaults Branch: https://github.com/jhelwig/puppet/tree/tickets/2.7.x/8255-use-string-mode-creating-file-setting-resources ****I just noticed this is a repeat of bug [[1756]](http://projects.puppetlabs.com/issues/1756)****. But for serveral reasons (including the much different version of puppet), I'm posting it separately. I believe this merits priority ****High**** because it represents a major stumbling block for people using puppet for the first time, and a tool which doesn't properly generate its own configuration (though it claims to in docs) represents a serious slight against the stability of the software in question. ****However****, since this problem may only be restricted to the scope of --genmanifest (I suspect there is more inconsistent handling of octal in puppet), I leave it at ****Normal**** for now. In an out ****of-of-the-box**** configuration, the following command will produce incorrect output: puppet --genmanifest > /etc/puppet/manifests/site.pp The resulting output contains decimal file modes like this one: file { '/etc/puppet/ssl/private': ensure => 'directory', backup => 'false', links => 'follow', loglevel => 'debug', mode => '488', owner => 'puppet', } Trying to run with this autogenerated manifest: puppet agent --server puppet --verbose --test --debug trace Fails: ... err: Could not run Puppet configuration client: Parameter mode failed: File modes can only be octal numbers, not "488" A one-liner fix was suggested by richardc, and tested by me (and it works, insfoar as the output is parseable now): diff --git a/lib/puppet/util/settings/file_setting.rb b/lib/puppet/util/settings/file_setting.rb index 776398e..c765a4b 100644 --- a/lib/puppet/util/settings/file_setting.rb +++ b/lib/puppet/util/settings/file_setting.rb @@ -91,7 +91,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting resource = Puppet::Resource.new(:file, path) if Puppet[:manage_internal_file_permissions] - resource[:mode] = self.mode if self.mode + resource[:mode] = sprintf("%o", self.mode) if self.mode if Puppet.features.root? resource[:owner] = self.owner if self.owner Much more detail is available in this [[pastie]](http://www.pastie.org/pastes/2173089). -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to puppet-bugs@googlegroups.com. To unsubscribe from this group, send email to puppet-bugs+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.