Class: Chef::Knife::InventoryCookbook

Inherits:
Chef::Knife show all
Includes:
KnifeChefInventory::Shared
Defined in:
lib/chef/knife/inventory_cookbook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from KnifeChefInventory::Shared

#max_results, #search_nodes, #time_since

Instance Attribute Details

#cookbook_nameObject

Returns the value of attribute cookbook_name.



42
43
44
# File 'lib/chef/knife/inventory_cookbook.rb', line 42

def cookbook_name
  @cookbook_name
end

#cookbook_versionObject

Returns the value of attribute cookbook_version.



43
44
45
# File 'lib/chef/knife/inventory_cookbook.rb', line 43

def cookbook_version
  @cookbook_version
end

Instance Method Details

#runObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/chef/knife/inventory_cookbook.rb', line 25

def run
  @cookbook_name = name_args[0]
  @cookbook_version = name_args[1]
  @show_env_constraints = config[:env_constraints]

  unless @cookbook_name
    ui.error "You need to specify a cookbook"
    exit 1
  end

  if @cookbook_version
    output_version_analysis
  else
    output_analysis
  end
end