Skip to content

Commit

Permalink
Merge pull request #6290 from tinaafitz/retire_tag_fix
Browse files Browse the repository at this point in the history
Automate - Retirement - Remove miq_provision and/or tag code
  • Loading branch information
gmcculloug committed Jan 22, 2016
2 parents 43e3386 + 3e1b9e2 commit 7211589
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# Get vm from root object
vm = $evm.root['vm']
category = "lifecycle"
tag = "retire_full"

removal_type = $evm.inputs['removal_type'].downcase
$evm.set_state_var('vm_removed_from_provider', false)
Expand All @@ -14,11 +12,9 @@
ems = vm.ext_management_system
case removal_type
when "remove_from_disk"
if vm.miq_provision || vm.tagged_with?(category, tag)
$evm.log('info', "Removing VM:<#{vm.name}> from provider:<#{ems.try(:name)}>")
vm.remove_from_disk(false)
$evm.set_state_var('vm_removed_from_provider', true)
end
$evm.log('info', "Removing VM:<#{vm.name}> from provider:<#{ems.try(:name)}>")
vm.remove_from_disk(false)
$evm.set_state_var('vm_removed_from_provider', true)
when "unregister"
$evm.log('info', "Unregistering VM:<#{vm.name}> from provider:<#{ems.try(:name)}")
vm.unregister
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

# Get vm from root object
vm = $evm.root['vm']
category = "lifecycle"
tag = "retire_full"

removal_type = $evm.inputs['removal_type'].downcase
$evm.set_state_var('vm_removed_from_provider', false)
Expand All @@ -14,11 +12,9 @@
ems = vm.ext_management_system
case removal_type
when "remove_from_disk"
if vm.miq_provision || vm.tagged_with?(category, tag)
$evm.log('info', "Removing VM:<#{vm.name}> from provider:<#{ems.try(:name)}>")
vm.remove_from_disk(false)
$evm.set_state_var('vm_removed_from_provider', true)
end
$evm.log('info', "Removing VM:<#{vm.name}> from provider:<#{ems.try(:name)}>")
vm.remove_from_disk(false)
$evm.set_state_var('vm_removed_from_provider', true)
when "unregister"
$evm.log('info', "Unregistering VM:<#{vm.name}> from provider:<#{ems.try(:name)}")
vm.unregister
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
@vm = FactoryGirl.create(:vm_vmware, :host => @host,
:ems_id => @ems.id, :name => "testVM", :raw_power_state => "poweredOn",
:registered => true)
@vm.tag_with("retire_full", :ns => "/managed", :cat => "lifecycle")
@ins = "/Infrastructure/VM/Retirement/StateMachines/Methods/RemoveFromProvider"
end

Expand Down

0 comments on commit 7211589

Please sign in to comment.