Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logrotate rule ERB template should not take variables from the scope object #37

Closed
imriz opened this issue Aug 9, 2016 · 3 comments
Closed

Comments

@imriz
Copy link

imriz commented Aug 9, 2016

It should use has_variable? and instance_variable_get methods.
The reason is that the scope object has variables from any scope, and this might add variable values from other logrotate::rule instances, depending on declaration/parsing order.

This is probably the same root cause for #22

@imriz
Copy link
Author

imriz commented Aug 9, 2016

To reproduce, add the following test to the rule_spec.rb spec file:

  context 'template should not inherit variables from other scopes' do
      let(:title) { 'foo' }
      let(:params) {
        {:path => '/var/log/foo.log',:ifempty => true}
      }
      let(:facts) {
        {
            :osfamily => 'RedHat',
            :operatingsystemmajrelease => 7
        }
      }
      it do
        should contain_file('/etc/logrotate.d/btmp').without_content(/ifempty/)
      end
  end

imriz added a commit to myheritage/puppet-logrotate that referenced this issue Aug 9, 2016
imriz added a commit to myheritage/puppet-logrotate that referenced this issue Aug 9, 2016
imriz added a commit to myheritage/puppet-logrotate that referenced this issue Aug 9, 2016
imriz added a commit to myheritage/puppet-logrotate that referenced this issue Aug 9, 2016
imriz added a commit to myheritage/puppet-logrotate that referenced this issue Aug 9, 2016
imriz added a commit to myheritage/puppet-logrotate that referenced this issue Aug 9, 2016
imriz added a commit to myheritage/puppet-logrotate that referenced this issue Aug 9, 2016
imriz added a commit to myheritage/puppet-logrotate that referenced this issue Aug 9, 2016
@natemccurdy
Copy link

This is likely the root cause of issue #13

@applewiskey
Copy link

@natemccurdy , definitely. Have the same issue.

Any chance on #38 merged?

bastelfreak added a commit that referenced this issue May 25, 2017
Fixes #37 - Logrotate rule ERB template should not take variables from the scope object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants