Class: Umami::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/chef-umami/client.rb

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



19
20
21
# File 'lib/chef-umami/client.rb', line 19

def initialize
  @client = client
end

Instance Method Details

#clientObject



23
24
25
# File 'lib/chef-umami/client.rb', line 23

def client
  @client ||= Chef::Client.new
end

#compileObject

Execute the compile phase of a Chef client run.



36
37
38
39
# File 'lib/chef-umami/client.rb', line 36

def compile
  prep
  client.setup_run_context
end

#prepObject

Perform the steps required prior to compiling resources, including running Ohai and building up the node object.



29
30
31
32
33
# File 'lib/chef-umami/client.rb', line 29

def prep
  client.run_ohai
  client.load_node # from the server
  client.build_node
end

#resource_collectionObject

TODO: This can only be called after #prep completes successfully. Add some check to determine if the client is actually prepped.



43
44
45
# File 'lib/chef-umami/client.rb', line 43

def resource_collection
  client.run_status.run_context.resource_collection
end