Skip to content

Ruby 3 compatibility issue? :into keyword in ask? #40

@fwolfst

Description

@fwolfst

When invoking ask in a runbook which is executed with ruby 3.0 (3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]), following errors are thrown:

/home/felix/.rvm/gems/ruby-3.0.0/gems/runbook-1.0.0/lib/runbook/statements/ask.rb:5:in `initialize': wrong number of arguments (given 2, expected 1; required keyword: into) (ArgumentError)

The invocation seems correct, like ask 'E-Mail-Address of user:', into: 'email' and works in older ruby versions.

I assume this has to do with how keyword arguments are handled in ruby 3.

Other specs also do not pass with ruby 3 (and manually loosened bundler constraint).

E.g. a similar case as for the "ask" case fails like this:

34) Runbook::Runner shared variables capture_all command captures cmd on all hosts
      Failure/Error:
        def initialize(cmd, into:, ssh_config: nil, raw: false, strip: true)
          @cmd = cmd
          @into = into
          @ssh_config = ssh_config
          @raw = raw
          @strip = strip
        end
      
      ArgumentError:
        wrong number of arguments (given 2, expected 1; required keyword: into)
      # ./lib/runbook/statements/capture_all.rb:5:in `initialize'
      # ./lib/runbook/extensions/statements.rb:6:in `new'
      # ./lib/runbook/extensions/statements.rb:6:in `method_missing'
      # ./spec/runner_spec.rb:1036:in `block (7 levels) in <top (required)>'
      # ./lib/runbook/extensions/steps.rb:16:in `instance_eval'
      # ./lib/runbook/extensions/steps.rb:16:in `block in step'
      # <internal:kernel>:90:in `tap'
      # ./lib/runbook/extensions/steps.rb:14:in `step'
      # ./spec/runner_spec.rb:1033:in `block (6 levels) in <top (required)>'
      # ./lib/runbook/extensions/sections.rb:11:in `instance_eval'
      # ./lib/runbook/extensions/sections.rb:11:in `block in section'
      # <internal:kernel>:90:in `tap'
      # ./lib/runbook/extensions/sections.rb:9:in `section'
      # ./spec/runner_spec.rb:1032:in `block (5 levels) in <top (required)>'
      # ./lib/runbook.rb:96:in `instance_eval'
      # ./lib/runbook.rb:96:in `block in book'
      # <internal:kernel>:90:in `tap'
      # ./lib/runbook.rb:95:in `book'
      # ./spec/runner_spec.rb:1031:in `block (4 levels) in <top (required)>'
      # ./spec/runner_spec.rb:30:in `block (2 levels) in <top (required)>'
      # ./spec/runner_spec.rb:1060:in `block (4 levels) in <top (required)>'
      # /home/felix/.rvm/gems/ruby-3.0.0/gems/aruba-0.14.14/lib/aruba/rspec.rb:22:in `block (2 levels) in <top (required)>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions