Class: Chef::Knife::EnvironmentTarUpload

Inherits:
Chef::Knife show all
Defined in:
lib/chef/knife/environment_tar_upload.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.upload_environments(tar_file) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/chef/knife/environment_tar_upload.rb', line 25

def self.upload_environments(tar_file)
  environment_from_file = Chef::Knife::EnvironmentFromFile.new
  
  tar_file.environments.each do |environment_path|
    environment_from_file.name_args = [environment_path]
    environment_from_file.run
  end
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/chef/knife/environment_tar_upload.rb', line 12

def run
  #Get Arguments
  if @name_args.size != 1
    ui.info("Please specify a tar path")
    show_usage
    exit 1
  end
  
  tar_file = Chef::TarFile.new(@name_args.first)
  EnvironmentTarUpload.upload_environments tar_file
  
end