lib/vagrant-hp/action/delete_server.rb in vagrant-hp-0.1.3 vs lib/vagrant-hp/action/delete_server.rb in vagrant-hp-0.1.4

- old
+ new

@@ -15,12 +15,15 @@ @logger = Log4r::Logger.new('vagrant_hp::action::delete_server') end def call(env) if env[:machine].id - @logger.info(I18n.t('vagrant_hp.deleting_floating_ip')) - ip = env[:hp_compute].addresses.find { |ip| ip.instance_id==env[:machine].id } - ip.destroy + config = env[:machine].provider_config + if not config.floating_ip + @logger.info(I18n.t('vagrant_hp.deleting_floating_ip')) + ip = env[:hp_compute].addresses.find { |ip| ip.instance_id==env[:machine].id } + ip.destroy + end @logger.info(I18n.t('vagrant_hp.deleting_server')) server = env[:hp_compute].servers.get(env[:machine].id) server.destroy env[:machine].id = nil end