Logrotate rule ERB template should not take variables from the scope object
Closed this issue · 3 comments
imriz commented
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 commented
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
natemccurdy commented
This is likely the root cause of issue #13
applewiskey commented
@natemccurdy , definitely. Have the same issue.
Any chance on #38 merged?