Code Review: ensure cook logs to /var/log/install when in booting state #44

Merged
merged 4 commits into from Mar 20, 2012

Conversation

Projects
None yet
2 participants

The agent logs to additional file in certain states (booting and decom). This change will ensure the additional file is passed to cook via CookState so that cook can log to the same files as the agent.

Jon Seaberg agent logs to additional file in certain states. this change passes t…
…he additional file to cook via CookState so that cook can log to the same files as the agent.
759a19e

@xeger xeger commented on an outdated diff Mar 17, 2012

lib/instance/cook/cook.rb
Log.program_name = 'RightLink'
Log.log_to_file_only(options[:log_to_file_only])
- Log.init(agent_id, options[:log_path])
Log.level = CookState.log_level
@xeger

xeger Mar 17, 2012

Member

Careful! Merely setting the level here, causes Log to init himself if he hasn't been initialized!

c.f. master branch of RightAgent:
308 def level=(level)
309 init unless @initialized

@xeger xeger commented on the diff Mar 17, 2012

lib/instance/cook/cook_state.rb
+ # Reset class state and load persisted state if any
+ #
+ # === Return
+ # true:: Always return true
+ def init(reset=false)
+ if @state.nil? || reset
+ @state = CookState.new
+ end
+ true
+ end
+
+ private
+ # not sure if method_missing is the best way to go to expose
+ # our state interface as class methods. If this is not the best
+ # approach, then we should look for another...
+ def method_missing(method, *args, &block)
@xeger

xeger Mar 17, 2012

Member

This seems like a really good use case for RightSupport::Ruby::EasySingleton ...

@xeger xeger added a commit that referenced this pull request Mar 20, 2012

@xeger xeger Merge pull request #44 from rightscale/azure_12_3_cook_should_log_to_…
…install

Code Review: ensure cook logs to /var/log/install when in booting state
2327aeb

@xeger xeger merged commit 2327aeb into master Mar 20, 2012

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