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

crowbar: Do not use @logger in forks where it's not available anymore #369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions crowbar_framework/app/models/service_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1588,14 +1588,22 @@ def wait_for_chef_daemons(node_list)
private

def wait_for_chef_clients(node_name, options = {})
options = if options.fetch(:logger)
use_logger = options.fetch(:logger, nil)
options = if use_logger
{logger: @logger}
else
{}
end
@logger.debug("wait_for_chef_clients: Waiting for already running chef-clients on #{node_name}.")
if use_logger
@logger.debug("wait_for_chef_clients: Waiting for already running chef-clients on #{node_name}.")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. 103/100

end
unless RemoteNode.chef_ready?(node_name, 1200, 10, options)
@logger.error("Waiting for already running chef-clients on #{node_name} failed.")
msg = "Waiting for already running chef-clients on #{node_name} failed."
if use_logger
@logger.error(msg)
else
puts(msg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so not even Rails.logger is available here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm, I don't know actually, but the intent is to actually log (through stdout) to a different file. Which is what we already do in RemoteNode.chef_ready?. That's why I put it that way.

end
exit(1)
end
end
Expand Down