-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
MODULES-1382: support multiple access log directives #951
Conversation
Feedback on this implementation would be great! |
@jlambert121 i like the general look and feel of the design: the hash (struct, really ;) makes the intent very obvious. |
<% elsif @access_log -%> | ||
CustomLog "<%= @access_log_destination %>" <%= @_access_log_format %> | ||
<% @_access_logs.each do |log| -%> | ||
<% log['env'] ? env = "env=#{log['env']}" : env = '' -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line can be simplified as:
env ||= "env=#{log['env']}" if log['env']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This being easier to read/simpler is a matter of opinion, I prefer ternary operators because I think they're easier to read. That being said, I don't mind changing it. I think later on in the template though <%= env %> could result to the literal 'nil' or 'undef' for older versions of ruby if log['env'](and therefore env) was unset, wouldn't it? The purpose of setting it to if log['env'] was undefined was to ensure the template was clean on output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think so, but maybe that's why we need more tests ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually:
env ||= "env=#{log['env']}" if log['env']
env ||= ''
That said, I'd say this is not logic that should be in a template but should be passed and used as-is with the logic whereever the template is included at.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but, puppet 3 :(
ebce295
to
80c5f68
Compare
80c5f68
to
bb96180
Compare
MODULES-1382: support multiple access log directives
thank you @jlambert121! |
MODULES-1382: https://tickets.puppetlabs.com/browse/MODULES-1382