class Chef::Knife::ProfitbricksNicDelete
Public Instance Methods
run()
click to toggle source
# File lib/chef/knife/profitbricks_nic_delete.rb, line 21 def run connection validate_required_params(%i(datacenter_id server_id), Chef::Config[:knife]) @name_args.each do |nic_id| begin nic = ProfitBricks::NIC.get(Chef::Config[:knife][:datacenter_id], Chef::Config[:knife][:server_id], nic_id) rescue Excon::Errors::NotFound ui.error("NIC ID #{nic_id} not found. Skipping.") next end msg_pair('ID', nic.id) msg_pair('Name', nic.properties['name']) msg_pair('IPs', nic.properties['cores']) msg_pair('DHCP', nic.properties['ram']) msg_pair('LAN', nic.properties['availabilityZone']) confirm('Do you really want to delete this NIC') nic.delete ui.warn("Deleted nic #{nic.id}") end end