class Gitchefsync::AuditItem
contains functionality associated to audit information gathering TODO: just reference Cookbook
clas in knife_util
Public Class Methods
new(name, version, exception = nil, action = 'UPDATE', extra_info = nil, ts = Time.now)
click to toggle source
# File lib/gitchefsync/audit.rb, line 255 def initialize(name, version, exception = nil, action = 'UPDATE', extra_info = nil, ts = Time.now) @name = name @version = version @ts = ts.to_i @exception = exception @action = action @extra_info = extra_info end
Public Instance Methods
ex()
click to toggle source
# File lib/gitchefsync/audit.rb, line 270 def ex @exception end
extra_info()
click to toggle source
# File lib/gitchefsync/audit.rb, line 288 def extra_info @extra_info end
from_hash(h)
click to toggle source
# File lib/gitchefsync/audit.rb, line 313 def from_hash(h) @name = h['name'] @ts = h['ts'] @exception = h['exception'] @version = h['version'] @type = h['type'] @action = h['action'] @cookbook = Cookbook.new(@name,@version,h['maintainer'],h['maintainer_email']) @extra_info = h['extra_info'] return self end
name()
click to toggle source
# File lib/gitchefsync/audit.rb, line 264 def name @name end
setAction(action)
click to toggle source
TODO action should be an enumeration
# File lib/gitchefsync/audit.rb, line 284 def setAction action @action = action end
setCookbook(cb)
click to toggle source
# File lib/gitchefsync/audit.rb, line 279 def setCookbook(cb) @cookbook = cb end
setType(type)
click to toggle source
types are CB and ENV
# File lib/gitchefsync/audit.rb, line 275 def setType type @type = type end
set_extra_info(hash)
click to toggle source
# File lib/gitchefsync/audit.rb, line 291 def set_extra_info hash @extra_info = hash end
to_hash()
click to toggle source
this method doesn’t work when called when exception is created from json (from_hash
)
# File lib/gitchefsync/audit.rb, line 295 def to_hash h = Hash.new h[:name] = @name h[:ts] = @ts if @exception.is_a? Exception h[:exception] = @exception.message unless @exception == nil else h[:exception] = @exception unless @exception == nil end h[:version] = @version unless @version == nil h[:type] = @type unless @type == nil h[:action] = @action unless @action == nil h[:maintainer] = @cookbook.maintainer unless @cookbook == nil h[:maintainer_email] = @cookbook.maintainer_email unless @cookbook == nil h[:extra_info] = @extra_info unless @extra_info == nil h end
version()
click to toggle source
# File lib/gitchefsync/audit.rb, line 267 def version @version end