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

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

Open
fwolfst opened this issue Jan 7, 2021 · 2 comments
Open

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

fwolfst opened this issue Jan 7, 2021 · 2 comments

Comments

@fwolfst
Copy link
Contributor

fwolfst commented Jan 7, 2021

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)>'
@fwolfst
Copy link
Contributor Author

fwolfst commented Jan 7, 2021

Pretty sure it has to do with mandatory keyword argument splatting in lib/runbook/extensions/statements.rb#method_missing .

@coopergillan
Copy link
Contributor

@fwolfst - have you been able to confirm that the latest release resolves this issue? Version 1.1.0 includes support for Ruby 3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants