voxpupuli/puppet-logrotate

Return FreeBSD to `metadata.json`

Opened this issue · 2 comments

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 7.14
  • Ruby: 3.0
  • Distribution: Fedora
  • Module version: 6.0.0

How to reproduce (e.g Puppet code you use)

Return FreeBSD to metadata.json, run github actions

What are you seeing

Github actions fail. Local tests succeed.

What behaviour did you expect instead

Github actions work

Output log


  1) logrotate::conf => /etc/logrotate.conf is expected to contain File[/etc/logrotate.conf] with owner => "root", group => "root", ensure => "present", mode => "0644" and content =~ /\ninclude \/etc\/logrotate.d\n/
     Failure/Error:
       is_expected.to contain_file('/etc/logrotate.conf').with(
         'owner' => 'root',
         'group' => 'root',
         'ensure' => 'present',
         'mode' => '0644'
       ).with_content(%r{\ninclude \/etc\/logrotate.d\n})
       expected that the catalogue would contain File[/etc/logrotate.conf] with group set to "root" but it is set to "wheel", and parameter content set to /\ninclude \/etc\/logrotate.d\n/ but it is set to "# THIS FILE IS AUTOMATICALLY DISTRIBUTED BY PUPPET.\n# ANY CHANGES WILL BE OVERWRITTEN.\n\ncreate\nrotate 4\nweekly\n\n# configurable file rotations\ninclude /usr/local/etc/logrotate.d\n"
       Diff:
       @@ -1,4 +1,12 @@
       -root
       +wheel
       -(?-mix:\ninclude \/etc\/logrotate.d\n)
       +# THIS FILE IS AUTOMATICALLY DISTRIBUTED BY PUPPET.
       +# ANY CHANGES WILL BE OVERWRITTEN.
       +
       +create
       +rotate 4
       +weekly
       +
       +# configurable file rotations
       +include /usr/local/etc/logrotate.d
     # ./spec/defines/conf_spec.rb:110:in `block (3 levels) in <top (required)>'
  2) logrotate::conf => /etc/logrotate_custom.config is expected to contain File[/etc/logrotate_custom.config] with owner => "root", group => "root", ensure => "present", mode => "0644" and content =~ /\ninclude \/etc\/logrotate.d\n/
     Failure/Error:
       is_expected.to contain_file('/etc/logrotate_custom.config').with(
         'owner' => 'root',
         'group' => 'root',
         'ensure' => 'present',
         'mode' => '0644'
       ).with_content(%r{\ninclude \/etc\/logrotate.d\n})
       expected that the catalogue would contain File[/etc/logrotate_custom.config] with group set to "root" but it is set to "wheel", and parameter content set to /\ninclude \/etc\/logrotate.d\n/ but it is set to "# THIS FILE IS AUTOMATICALLY DISTRIBUTED BY PUPPET.\n# ANY CHANGES WILL BE OVERWRITTEN.\n\ncreate\nrotate 4\nweekly\n\n# configurable file rotations\ninclude /usr/local/etc/logrotate.d\n"
       Diff:
       @@ -1,4 +1,12 @@
       -root
       +wheel
       -(?-mix:\ninclude \/etc\/logrotate.d\n)
       +# THIS FILE IS AUTOMATICALLY DISTRIBUTED BY PUPPET.
       +# ANY CHANGES WILL BE OVERWRITTEN.
       +
       +create
       +rotate 4
       +weekly
       +
       +# configurable file rotations
       +include /usr/local/etc/logrotate.d
     # ./spec/defines/conf_spec.rb:438:in `block (3 levels) in <top (required)>'

Any additional information you'd like to impart

Opened so we don't lose track of the working FreeBSD support

Note that FreeBSD isn't working on a live system with release 6.0.0. A regression occurred somewhere after commit 63f2b13 where all of the $logrotate::root_user and $logrotate::root_group variables got replaced with the hard-coded value root.

In the test output log shown above, both examples want to create files with the group root which does not exist on the BSD-family OSs including FreeBSD and ye olde Solaris (RIP). The correct group is wheel on those platforms.

Here's some output from me moving from an old version of this module (which did mostly work) to the latest:

Error: /Stage[main]/Logrotate::Hourly/File[/usr/local/etc/logrotate.d/hourly]/group: change from 'wheel' to 'root' failed: Could not find group root

Digging a bit more, looks like 6.1.0 fixes the actual problem, but the spec for the conf defined type doesn't test across all platforms so the output above is wrong still.