Skip to content
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

Merged
merged 24 commits into from
Mar 25, 2015
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
254f982
test commit to see if i have permissions
mhughes-r7 Mar 19, 2015
ea6ccb4
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 19, 2015
8ea2538
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
f59c878
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
28b5196
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
c5bb006
test commit to see if i have permissions
mhughes-r7 Mar 19, 2015
692d308
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 19, 2015
c4184a2
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
68faf78
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
b31deb1
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
b07db1d
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
2129b59
Merge remote-tracking branch 'origin/site-api-adhoc-schedule' into si…
mhughes-r7 Mar 20, 2015
e7fbdde
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
d1d757b
Update adhoc schedules to support force parameter
mhughes-r7 Mar 24, 2015
4fedde9
test commit to see if i have permissions
mhughes-r7 Mar 19, 2015
1475254
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 19, 2015
c6df1d3
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
312329a
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
29112ac
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
b6daafb
Add support for ad-hoc scans with schedules
mhughes-r7 Mar 20, 2015
77f1ded
Update adhoc schedules to support force parameter
mhughes-r7 Mar 24, 2015
5f302bd
Merge remote-tracking branch 'origin/site-api-adhoc-schedule' into si…
mhughes-r7 Mar 24, 2015
3353498
Fix error with scan_device_with_schedule
mhughes-r7 Mar 24, 2015
9239c25
Clean up code based on rubocop/hound output
mhughes-r7 Mar 24, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add support for ad-hoc scans with schedules
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
mhughes-r7 committed Mar 20, 2015
commit b31deb1bf594b7e0c1fe076f510616066b7e9425
6 changes: 3 additions & 3 deletions lib/nexpose/scan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ def scan_device(device)
# @return [Status] whether the request was successful
#
def scan_device_with_schedule(device, schedule)
Copy link
Contributor

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 and scan_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.

Copy link
Contributor Author

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.

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.
Expand Down Expand Up @@ -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)

Choose a reason for hiding this comment

The 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]

Choose a reason for hiding this comment

The 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})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant curly braces around a hash parameter.
Space inside { missing.
Space inside } missing.

elem = REXML::Element.new('Devices')
devices.each do |device|
Expand Down