Chapter 09/circuit-oneops-1-master/components/cookbooks/azure/recipes/del_node.rb
# delete the NIC from the platform specific resource group
delete the NIC from the platform specific resource group
delete the NIC from the platform specific resource group
def delete_nic(credentials, subscription_id, resource_group_name, nic_name)
  begin
    start_time = Time.now.to_i
    networkclient = NetworkResourceProviderClient.new(credentials)
    networkclient.subscription_id = subscription_id
    promise = networkclient.network_interfaces.delete(resource_group_name, nic_name)
    result = promise.value!
    end_time = Time.now.to_i
    duration = end_time - start_time
    Chef::Log.info("Deleting NIC '#{nic_name}' in #{duration} seconds")
  rescue MsRestAzure::AzureOperationError => e
    OOLog.fatal("***FAULT:FATAL=Error deleting NIC, resource group: '#{resource_group_name}', NIC name: '#{nic_name}', Error: #{e.body.values[0]['message']}")
  rescue => ex
    OOLog.fatal("***FAULT:FATAL=Error deleting NIC, resource group: '#{resource_group_name}', NIC name: '#{nic_name}', Error: #{ex.message}")
  end
end
def delete_nic ( credentials , subscription_id , resource_group_name , nic_name ) begin start_time = Time . now . to_i networkclient = NetworkResourceProviderClient . new ( credentials ) networkclient . subscription_id = subscription_id promise = networkclient . network_interfaces . delete ( resource_group_name , nic_name ) result = promise . value! end_time = Time . now . to_i duration = end_time - start_time Chef :: Log . info ( "Deleting NIC '#{nic_name}' in #{duration} seconds" ) rescue MsRestAzure :: AzureOperationError => e OOLog . fatal ( "***FAULT:FATAL=Error deleting NIC, resource group: '#{resource_group_name}', NIC name: '#{nic_name}', Error: #{e.body.values[0]['message']}" ) rescue => ex OOLog . fatal ( "***FAULT:FATAL=Error deleting NIC, resource group: '#{resource_group_name}', NIC name: '#{nic_name}', Error: #{ex.message}" ) end end
delete the NIC from the platform specific resource group
delete the NIC from the platform specific resource group
credentials
<not_specific>
subscription_id
<not_specific>
resource_group_name
<not_specific>
nic_name
<not_specific>