-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update gem to support XML API adding of schedules to adhoc scans #142
Changes from 1 commit
254f982
ea6ccb4
8ea2538
f59c878
28b5196
c5bb006
692d308
c4184a2
68faf78
b31deb1
b07db1d
2129b59
e7fbdde
d1d757b
4fedde9
1475254
c6df1d3
312329a
29112ac
b6daafb
77f1ded
5f302bd
3353498
9239c25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Fix scan_device(s)_with schedule to work properly as I'd moved a line of code I shouldn't have NEX-40391
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,8 +18,7 @@ def scan_device(device) | |
# @return [Status] whether the request was successful | ||
# | ||
def scan_device_with_schedule(device, schedule) | ||
site_id = devices.map { |d| d.site_id }.uniq.first | ||
scan_devices_with_schedule(site_id, [device], schedule) | ||
scan_devices_with_schedule(device, schedule) | ||
end | ||
|
||
# Perform an ad hoc scan of a subset of devices for a site. | ||
|
@@ -59,7 +58,8 @@ def scan_devices(devices) | |
# @param [Array[adhoc_schedules]] list of scheduled times at which to run | ||
# @return [Status] whether the request was successful | ||
# | ||
def scan_devices_with_schedule(site_id, devices, schedules) | ||
def scan_devices_with_schedule(devices, schedules) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assignment Branch Condition size for scan_devices_with_schedule is too high. [16.49/15] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Assignment Branch Condition size for scan_devices_with_schedule is too high. [15.52/15] |
||
site_id = devices.map { |d| d.site_id }.uniq.first | ||
xml = make_xml('SiteDevicesScanRequest', {'site-id' => site_id}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Redundant curly braces around a hash parameter. |
||
elem = REXML::Element.new('Devices') | ||
devices.each do |device| | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's different between
scan_device_with_schedule
andscan_asset_with_schedule
? Do we need both? Can we alias one or drop one altogether? I think we should prefer to use asset instead of device in general if we're providing asset IDs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that when I was looking at it to start with. However these are kind of the wrong way round name wise. the asset one actually takes the hostname/ip/range to scan and the device one takes the device(asset) id. they've both been there for starting ad-hoc scans for a while now and I just copied the pattern as it seemed sensible to give options for defining the scan targets since both ways are valid.
There's a third way where you can just pass in an array of single ip addresses too.