Class: Chef::Knife::EsxTemplateDelete
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::EsxTemplateDelete
- Includes:
- ESXBase
- Defined in:
- lib/chef/knife/esx_template_delete.rb
Instance Method Summary collapse
Methods included from ESXBase
#connection, included, #locate_config_value
Instance Method Details
#run ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/chef/knife/esx_template_delete.rb', line 34 def run deleted = [] connection.list_templates.each do |tmpl| @name_args.each do |tmpl_name| if tmpl_name == File.basename(tmpl) if config[:force_delete] !~ /true|yes/i confirm("Do you really want to delete this template '#{tmpl_name}'") end connection.delete_template tmpl_name deleted << tmpl_name ui.info("Deleted template #{tmpl_name}") end end end @name_args.each do |tmpl_name| ui.warn "Template #{tmpl_name} not found" if not deleted.include?(tmpl_name) end end |