Class: Chef::Knife::AppShow
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::AppShow
- Defined in:
- lib/chef/knife/app_show.rb
Instance Method Summary collapse
- #print_hash(hash, spacing = 4) ⇒ Object
-
#run ⇒ Object
This method will be executed when you run this knife command.
Instance Method Details
#print_hash(hash, spacing = 4) ⇒ Object
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/chef/knife/app_show.rb', line 80 def print_hash hash, spacing=4 hash.each do |key, value| if !value.is_a? Hash puts "#{" " * spacing}#{key} : #{value}" else puts "#{" " * spacing}#{key} : " print_hash hash[key], (spacing + 2) end end end |
#run ⇒ Object
This method will be executed when you run this knife command.
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 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/chef/knife/app_show.rb', line 12 def run # Get Arguments if @name_args.size != 1 ui.info("Please specify an app_id") show_usage exit 1 end app_id = {} @name_args[0].split(" ").each do |id_arg| key_value = id_arg.split("=") app_id[key_value.first] = key_value.last end app = Chapp.database.app app_id app_config = app.config puts "App :" puts " id : #{app_config.id}" puts " name_space :" print_hash app_config.name_space puts " name : #{app_config.name}" puts " type : #{app_config.type}" puts " cookbook : #{app_config.cookbook}" puts " recipe : #{app_config.recipe}" puts " cloud :" print_hash app_config.cloud puts " used_apps :" app_config.used_apps.each do |used_app| print_hash used_app end puts " node :" print_hash app_config.node puts " dependencies :" app_config.dependencies.each do |cookbook, version_constraint| puts " #{cookbook} #{version_constraint}" end puts " pre_run_list :" app_config.pre_run_list.each do |run_list_item| puts " #{run_list_item}" end puts " post_run_list :" app_config.post_run_list.each do |run_list_item| puts " #{run_list_item}" end puts "" puts "App Attributes :" print_hash app.attributes, 2 puts "App Instances :" app.instances.each do |app_instance| puts " #{app_instance.fqdn}" end end |