Class: Chef::Knife::TarUpload

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

Instance Method Summary collapse

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/chef/knife/tar_upload_all.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
  
  # Attempt to upload all the components in the tar file
  # If our tar file does not contain a component ignore the error and skip it
  begin
    ClientTarUpload.upload_clients tar_file
  rescue TarFile::MissingChefComponentError => e
    ui.info("No Client files to upload")
  end
  
  begin
    CookbookTarUpload.upload_cookbooks tar_file
  rescue TarFile::MissingChefComponentError => e
    ui.info("No Cookbooks to upload")
  end
  
  begin
    DataBagTarUpload.upload_data_bags tar_file
  rescue TarFile::MissingChefComponentError => e
    ui.info("No data bag files to upload")
  end
  
  begin
    EnvironmentTarUpload.upload_environments tar_file
  rescue TarFile::MissingChefComponentError => e
    ui.info("No Environment files to upload")
  end
  
  begin
    NodeTarUpload.upload_nodes tar_file
  rescue TarFile::MissingChefComponentError => e
    ui.info("No Node files to upload")
  end
  
  begin
    RoleTarUpload.upload_roles tar_file
  rescue TarFile::MissingChefComponentError => e
    ui.info("No Role files to upload")
  end
  
  begin
    UserTarUpload.upload_users tar_file
  rescue TarFile::MissingChefComponentError => e
    ui.info("No User files to upload")
  end
  
end