Last active
August 29, 2015 14:08
-
-
Save erran-r7/3cbe2d713c7c02d515f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When(/^I create a copy of the "(.*)" scan template$/) do |template_name| | |
scan_templates = @nexpose_client.scan_templates | |
ifnone = -> { raise ArgumentError, "No scan template named '#{template_name}' found." } | |
template_summary = scan_templates.find(ifnone) do |scan_template| | |
scan_template.name.eql?(template_name) | |
end | |
@scan_template = Nexpose::ScanTemplate.copy(@nexpose_client, template_summary.id) | |
if scan_templates.map(&:name).include?(@scan_template.name) | |
@scan_template.name << "via (ControlsInsight automation – #{Time.now.utc.to_i})" | |
end | |
@scan_template.save(@nexpose_client) | |
Custodian.register_task do | |
@nexpose_client = nexpose_api_login | |
@scan_template.delete(@nexpose_client) | |
end | |
end | |
# When Custodian is called the following is raised: | |
# undefined method `gsub' for nil:NilClass (NoMethodError) | |
# /Users/ecarey/.rbenv/versions/2.1.3/lib/ruby/2.1.0/uri/common.rb:304:in `escape' | |
# /Users/ecarey/.rbenv/versions/2.1.3/lib/ruby/2.1.0/uri/common.rb:623:in `escape' | |
# /Users/ecarey/rapid7/controls/automation/vendor/bundle/ruby/2.1.0/gems/nexpose-0.8.11/lib/nexpose/scan_template.rb:22:in #`delete_scan_template' | |
# /Users/ecarey/rapid7/controls/automation/vendor/bundle/ruby/2.1.0/gems/nexpose-0.8.11/lib/nexpose/scan_template.rb:426:in `delete' | |
# /Users/ecarey/rapid7/controls/automation/features/step_definitions/nexpose_integration/scan_template_steps.rb:16:in `block (2 levels) in <top (required)>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment