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

Fixed logging for proxy when storage not defined #15028

Merged

Conversation

yrudman
Copy link
Contributor

@yrudman yrudman commented May 8, 2017

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

@miq-bot miq-bot added the bug label May 8, 2017
@yrudman yrudman force-pushed the fix-proxy-logging-when0-storage-not-setup branch from d43db58 to e9f8f69 Compare May 8, 2017 22:10
@miq-bot
Copy link
Member

miq-bot commented May 8, 2017

Checked commit yrudman@e9f8f69 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks fine. 🏆

@cfcosta
Copy link

cfcosta commented May 9, 2017

LGTM, however I think this is a prime target for the Null Object Pattern: https://robots.thoughtbot.com/rails-refactoring-example-introduce-null-object

@Fryguy Fryguy merged commit 7e621e2 into ManageIQ:master May 9, 2017
@yrudman yrudman deleted the fix-proxy-logging-when0-storage-not-setup branch May 9, 2017 14:11
@Fryguy Fryguy added this to the Sprint 61 Ending May 22, 2017 milestone May 9, 2017
@Fryguy Fryguy assigned Fryguy and unassigned jrafanie May 9, 2017
else
"No storage"
end
msg
Copy link
Member

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

Copy link
Contributor Author

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

@Fryguy
Copy link
Member

Fryguy commented May 9, 2017

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.

@yrudman
Copy link
Contributor Author

yrudman commented May 9, 2017

@Fryguy fixed style in #15037

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants