Sha256: 0ece6b2b92a1d0fcf1a1ec12a19896d018664ef35ee140c5ffc21ab4fd087d66
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require 'chef/knife/profitbricks_base' class Chef class Knife class ProfitbricksLanDelete < Knife include Knife::ProfitbricksBase banner 'knife profitbricks lan delete LAN_ID [LAN_ID] (options)' option :datacenter_id, short: '-D DATACENTER_ID', long: '--datacenter-id DATACENTER_ID', description: 'Name of the data center', proc: proc { |datacenter_id| Chef::Config[:knife][:datacenter_id] = datacenter_id }, required: true def run connection @name_args.each do |lan_id| begin lan = ProfitBricks::LAN.get(config[:datacenter_id], lan_id) rescue Excon::Errors::NotFound ui.error("Lan ID #{lan_id} not found. Skipping.") next end msg_pair('ID', lan.id) msg_pair('Name', lan.properties['name']) msg_pair('Public', lan.properties['public'].to_s) confirm('Do you really want to delete this LAN') lan.delete ui.warn("Deleted LAN #{lan.id}") end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
knife-profitbricks-1.2.0 | lib/chef/knife/profitbricks_lan_delete.rb |
knife-profitbricks-1.1.2 | lib/chef/knife/profitbricks_lan_delete.rb |