Class: HealthInspector::Context

Inherits:
Struct
  • Object
show all
Defined in:
lib/health_inspector/context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#config_pathObject

Returns the value of attribute config_path

Returns:

  • (Object)

    the current value of config_path



4
5
6
# File 'lib/health_inspector/context.rb', line 4

def config_path
  @config_path
end

#no_colorObject

Returns the value of attribute no_color.



6
7
8
# File 'lib/health_inspector/context.rb', line 6

def no_color
  @no_color
end

#quiet_successObject

Returns the value of attribute quiet_success.



6
7
8
# File 'lib/health_inspector/context.rb', line 6

def quiet_success
  @quiet_success
end

#repo_pathObject

Returns the value of attribute repo_path

Returns:

  • (Object)

    the current value of repo_path



4
5
6
# File 'lib/health_inspector/context.rb', line 4

def repo_path
  @repo_path
end

Instance Method Details

#chef_restObject



25
26
27
# File 'lib/health_inspector/context.rb', line 25

def chef_rest
  @chef_rest ||= Chef::REST.new( config[:chef_server_url], config[:node_name], config[:client_key] )
end

#configObject



12
13
14
# File 'lib/health_inspector/context.rb', line 12

def config
  @config ||= configure
end

#configureObject



16
17
18
19
20
21
22
23
# File 'lib/health_inspector/context.rb', line 16

def configure
  begin
    Chef::Config.from_file(config_path)
  rescue LoadError
    Chef::Config.from_file("#{ENV['PWD']}/#{config_path}")
  end
  Chef::Config
end

#cookbook_pathObject



8
9
10
# File 'lib/health_inspector/context.rb', line 8

def cookbook_path
  Array( config.cookbook_path )
end