-
Notifications
You must be signed in to change notification settings - Fork 897
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
Fixed logging for proxy when storage not defined #15028
Fixed logging for proxy when storage not defined #15028
Conversation
d43db58
to
e9f8f69
Compare
Checked commit yrudman@e9f8f69 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
LGTM, however I think this is a prime target for the Null Object Pattern: https://robots.thoughtbot.com/rails-refactoring-example-introduce-null-object |
else | ||
"No storage" | ||
end | ||
msg |
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.
Style:
- Avoid the line continuation
\
...just make it a single line. - Prefer
<<
over+=
- There's no need to append and then return the variable, it can be done in one shot
def log_proxies_vm_config
msg = "[#{log_proxies_format_instance(self)}] on host [#{log_proxies_format_instance(host)}] #{ui_lookup(:table => "storages").downcase} "
msg << storage ? "[#{storage.name}-#{storage.store_type}]" : "No storage"
end
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.
@Fryguy OK, it does look cleaner, will change it in PR removing not used log_proxies
I merged to get the repos green, but I do have a comment about the code style, which could be done in a separate PR. |
Merging #15009 cause UI spec failing when attempting to log not existing storage.
Fix: check for nil before attempting to log storage info
@miq-bot add-label bug
\cc @jrafanie