Class: KnifeTopo::TopoCookbookUpload

Inherits:
Chef::Knife
  • Object
show all
Includes:
Loader
Defined in:
lib/chef/knife/topo_cookbook_upload.rb

Overview

knife topo cookbook upload

Instance Attribute Summary

Attributes included from Loader

#loader, #ui

Instance Method Summary collapse

Methods included from Loader

#auto_detect_format, #check_file, #create_topo_bag, #get_local_topo_path, #list_topo_bag, #load_local_topo_or_exit, #load_node_data, #load_topo_from_file_or_exit, #load_topo_from_server, #load_topo_from_server_or_exit, #priority_attrs, #topo_bag_name, #topologies_path

Constructor Details

#initialize(args) ⇒ TopoCookbookUpload

Returns a new instance of TopoCookbookUpload.



45
46
47
48
49
50
51
# File 'lib/chef/knife/topo_cookbook_upload.rb', line 45

def initialize(args)
  super
  @args = args

  # All called commands need to accept union of options
  Chef::Knife::CookbookUpload.options = options
end

Instance Method Details

#runObject



53
54
55
56
57
58
59
60
61
62
# File 'lib/chef/knife/topo_cookbook_upload.rb', line 53

def run
  validate_args

  # Load the topology data
  @topo = load_local_topo_or_exit(@topo_name)

  # Run cookbook upload command on the topology cookbook
  @processor = KnifeTopo::Processor.for_topo(@topo)
  @processor.upload_artifacts('cmd' => self, 'cmd_args' => @args)
end

#validate_argsObject



64
65
66
67
68
69
70
71
# File 'lib/chef/knife/topo_cookbook_upload.rb', line 64

def validate_args
  unless @name_args[0]
    show_usage
    ui.fatal('You must specify the name of a topology')
    exit 1
  end
  @topo_name = @name_args[0]
end