Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updates rm_all_assets script to new AssetGroup refactoring.

  • Loading branch information...
commit c326f94384b3a8d6fcb63039397f512f3e9a2dfe 1 parent 6b0fce6
@mdaines-r7 mdaines-r7 authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 scripts/rm_all_assets_from_group.rb
View
9 scripts/rm_all_assets_from_group.rb
@@ -1,3 +1,4 @@
+#!/usr/bin/env ruby
require 'optparse'
require 'highline/import'
require 'nexpose'
@@ -34,17 +35,17 @@ def get_password(prompt = 'Password: ')
ask(prompt) { |query| query.echo = false }
end
puts 'Upon entering a password, deletion will begin.'
-puts 'Use --dry-run to ensure only the desired assets will be deleted.'
+puts 'Use --dry-run to ensure only the desired assets will be deleted.' unless @dry_run
@password = get_password
nsc = Nexpose::Connection.new(@host, @user, @password, @port)
nsc.login
-nsc.asset_group_config(group_id).each do |device|
+Nexpose::AssetGroup.load(nsc, group_id).devices.each do |device|
if @dry_run
- puts "#{device[:address]} [ID: #{device[:device_id]}] Site: #{device[:site_id]}"
+ puts "#{device.address} [ID: #{device.id}] Site: #{device.site_id}"
else
- nsc.device_delete(device[:device_id])
+ nsc.device_delete(device.id)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.