-
Notifications
You must be signed in to change notification settings - Fork 124
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
[WIP] Do not display log message about a resource when it will not be updated #74
Conversation
@@ -108,9 +108,23 @@ def initialize(recipe, resource_name, &block) | |||
end | |||
|
|||
def run(specific_action = nil, options = {}) | |||
Logger.info "#{resource_type}[#{resource_name}]" | |||
Logger.debug "#{resource_type}[#{resource_name}]" |
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.
log level が DEBUG の時には、対象のリソースを必ず表示します。
current_value && | ||
@attributes[key] && | ||
! current_value.nil? && | ||
! @attributes[key].nil? && | ||
current_value != @attributes[key] |
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.
プルリクの本題とは関係ないのですが、current_value が false で、@attributes[key] が true といった場合に、変更があるため true を返して欲しいのに、false を返してしまうため、nil かどうかでチェックを行うように修正しました。
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.
この変更はLGTMです。nitpickですが!
の後のスペースなくしてもらえると〜
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.
了解です!
|
||
Logger.formatter.indent do | ||
Logger.debug "(in set_current_attributes)" | ||
set_current_attributes |
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.
アクションを実行した後はcurrent attributeが変わっている可能性があるので、run_actionで実行する必要があります
メモ。 口頭で話した結果、処理の流れを大きく変えるのは厳しい、かといって変えないとログの出力を抑えるのも難しい、なので出力は抑えずに、色を変えたり、info で出しているものを debug にする、といった方向で行くことに。Chef のログが割と見やすいので参考にする。 |
クローズします。レビューとアドバイスありがとうございました! |
リソースに何も変更がなかった場合には、ログに何も表示しないようにするための修正です(まだ途中です)。
このプルリク適用前の状態で、既に httpd が running かつ enabled な状態で、action [:start, :enable] すると、次のようにログが表示されます。
プルリク適用後は、以下のようになります。