Skip to content

Nexpose client gem: Module ISO8601: method to_string bug #305

@jbrunner-r7

Description

@jbrunner-r7

Expected Behavior

Current Behavior

When trying to save a site with a Schedule object, I currently get the following error:

C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/util.rb:105:in to_string': undefined method to_time' for "20181016T181411.812Z":String (NoMethodError)
Did you mean? to_i
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/common.rb:221:in to_h' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/site.rb:428:in map'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/site.rb:428:in to_h' from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/site.rb:411:in to_json'
from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/nexpose-7.1.1/lib/nexpose/site.rb:517:in save' from set-sites-schedule.rb:42:in

'

Possible Solution

By replacing the current line with the one I've specified below, I was able to save the schedule in the site.
In util.rb on line 105 (https://github.com/rapid7/nexpose-client/blob/master/lib/nexpose/util.rb#L105), shouldn't the line be:

to_time(time).utc.strftime('%Y%m%dT%H%M%S.%LZ')

Steps to Reproduce (for bugs)

Ruby code that reproduces the issue:

puts "this is only an example Ruby code block"

Context

Your Environment

  • Nexpose gem version:
  • Ruby version:
  • Operating System and version:
  • Nexpose product version:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions