{"action":"created","issue":{"url":"https://api.github.com/repos/yo61/puppet-logrotate/issues/13","repository_url":"https://api.github.com/repos/yo61/puppet-logrotate","labels_url":"https://api.github.com/repos/yo61/puppet-logrotate/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/yo61/puppet-logrotate/issues/13/comments","events_url":"https://api.github.com/repos/yo61/puppet-logrotate/issues/13/events","html_url":"https://github.com/yo61/puppet-logrotate/issues/13","id":120060675,"number":13,"title":"wtmp and btmp are different when using the future parser","user":{"login":"natemccurdy","id":10200384,"avatar_url":"https://avatars.githubusercontent.com/u/10200384?v=3","gravatar_id":"","url":"https://api.github.com/users/natemccurdy","html_url":"https://github.com/natemccurdy","followers_url":"https://api.github.com/users/natemccurdy/followers","following_url":"https://api.github.com/users/natemccurdy/following{/other_user}","gists_url":"https://api.github.com/users/natemccurdy/gists{/gist_id}","starred_url":"https://api.github.com/users/natemccurdy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natemccurdy/subscriptions","organizations_url":"https://api.github.com/users/natemccurdy/orgs","repos_url":"https://api.github.com/users/natemccurdy/repos","events_url":"https://api.github.com/users/natemccurdy/events{/privacy}","received_events_url":"https://api.github.com/users/natemccurdy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-02T23:37:21Z","updated_at":"2016-02-05T01:21:02Z","closed_at":"2015-12-16T00:03:25Z","body":"I noticed that when using Puppet 4 and/or the future parser, the default wtmp and btmp rules are being made with different options set. Specifically, they are missing: `compress`, `delaycompress`, and `notifempty`.\r\n\r\nThis is happening on RedHat nodes with a stock Puppet Enterprise 3.8.2 installation.\r\n\r\nPuppet version: 3.8.2\r\nRuby version: ruby 1.9.3p551\r\n\r\n\r\nHere's a puppet 3 parser vs. future parser diff of the resource:\r\n\r\n```diff\r\nfile[/etc/logrotate.d/wtmp]  \r\n    file{\"/etc/logrotate.d/wtmp\":  \r\n         backup => \"main\"  \r\n         content => {  \r\n-                    checksum =>             \"72a136dc57f58796ff8e23686f1bcd02\",  \r\n+                    checksum =>             \"6e830130e1660b31f445d32314e51578\",  \r\n                     content =>             \"# THIS FILE IS AUTOMATICALLY DISTRIBUTED BY PUPPET. ANY CHANGES WILL BE  \r\n # OVERWRITTEN.  \r\n   \r\n /var/log/wtmp {  \r\n-  compress  \r\n   create 0664 root utmp  \r\n-  delaycompress  \r\n   minsize 1M  \r\n   monthly  \r\n   nomissingok  \r\n-  notifempty  \r\n   rotate 1  \r\n }  \r\n \",\r\n``` \r\n\r\n```diff\r\nfile[/etc/logrotate.d/btmp]  \r\n    file{\"/etc/logrotate.d/btmp\":  \r\n         backup => \"main\"  \r\n         content => {  \r\n-                    checksum =>             \"2b48a089a480d0a58255ee662b2f066a\",  \r\n+                    checksum =>             \"8d8fad6501d5a201dbafc5eea144bea1\",  \r\n                     content =>             \"# THIS FILE IS AUTOMATICALLY DISTRIBUTED BY PUPPET. ANY CHANGES WILL BE  \r\n # OVERWRITTEN.  \r\n   \r\n /var/log/btmp {  \r\n-  compress  \r\n   create 0600 root utmp  \r\n-  delaycompress  \r\n   minsize 1M  \r\n   missingok  \r\n   monthly  \r\n-  notifempty  \r\n   rotate 1  \r\n }  \r\n \",\r\n```"},"comment":{"url":"https://api.github.com/repos/yo61/puppet-logrotate/issues/comments/180139567","html_url":"https://github.com/yo61/puppet-logrotate/issues/13#issuecomment-180139567","issue_url":"https://api.github.com/repos/yo61/puppet-logrotate/issues/13","id":180139567,"user":{"login":"natemccurdy","id":10200384,"avatar_url":"https://avatars.githubusercontent.com/u/10200384?v=3","gravatar_id":"","url":"https://api.github.com/users/natemccurdy","html_url":"https://github.com/natemccurdy","followers_url":"https://api.github.com/users/natemccurdy/followers","following_url":"https://api.github.com/users/natemccurdy/following{/other_user}","gists_url":"https://api.github.com/users/natemccurdy/gists{/gist_id}","starred_url":"https://api.github.com/users/natemccurdy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/natemccurdy/subscriptions","organizations_url":"https://api.github.com/users/natemccurdy/orgs","repos_url":"https://api.github.com/users/natemccurdy/repos","events_url":"https://api.github.com/users/natemccurdy/events{/privacy}","received_events_url":"https://api.github.com/users/natemccurdy/received_events","type":"User","site_admin":false},"created_at":"2016-02-05T01:21:02Z","updated_at":"2016-02-05T01:21:02Z","body":"@robinbowes I was able to reliably replicate the issue with Puppet version 3.6.2 and 3.8.x:\r\n```puppet\r\nlogrotate::rule { \"thing\":\r\n  path          => '/var/log/fake.log',\r\n  compress      => true,\r\n  delaycompress => true,\r\n  dateext       => true,\r\n}\r\n```\r\n```shell\r\nroot@foss-master:~# puppet --version\r\n3.6.2\r\nroot@foss-master:~# ruby --version\r\nruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]\r\n```\r\n\r\nWhat's going on is that the `compress`, `delaycompress`, and `dateext` parameters of a `logrotate::rule` declaration are leaking into the `wtmp` and `btmp` rules defined in `logrotate::defaults`.\r\n\r\nWhen I comment out any one of those parameters in the Puppet code above and re-run puppet apply against it, `wtmp` and `btmp` also change to reflect the commented out parameter.\r\n\r\n**Likely Cause**\r\nThe `scope` lookup happening in the ERB template that builds these files is looking at the wrong scope in older versions of Puppet. There were always issues with dynamic scoping in older Puppet versions, and the issue in this ticket is a side-effect of that.\r\n\r\n"}}