bibendi / dip

The dip is a CLI dev–tool that provides native-like interaction with a Dockerized application.
MIT License
1.26k stars 44 forks source link

Since 7.1.2 `shell: false` commands with any argument fails with "undefined local variable or method `default_args' " #135

Closed zaratan closed 3 years ago

zaratan commented 3 years ago

Describe the bug Since 7.1.2 (It works with 7.1.1) if a command is declared as shell: false it will fail if given any argument.

Here is the stacktrace:

Traceback (most recent call last):
        9: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/exe/dip:23:in `<main>'
        8: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/lib/dip/cli.rb:31:in `start'
        7: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/thor-0.20.3/lib/thor/base.rb:466:in `start'
        6: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
        5: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
        4: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
        3: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/lib/dip/cli.rb:85:in `run'
        2: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/lib/dip/commands/run.rb:30:in `execute'
        1: from /Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/lib/dip/commands/run.rb:59:in `compose_arguments'
/Users/pasind/.rvm/gems/ruby-2.7.4@shotgun/gems/dip-7.1.2/lib/dip/commands/run.rb:84:in `get_args': undefined local variable or method `default_args' for #<Dip::Commands::Run:0x00007f939d82d628> (NameError)

To Reproduce Steps to reproduce the behavior:

  1. Provide dip.yml config

    compose:
    files:
    - ./docker-compose.yml
    interaction:
    rvm:
    description: Start rvm in the app container
    service: app_dev
    command: rvm
    shell: false
  2. Provide docker-compose.yml Not really relevant. I can provide one if needed.

  3. Run command dip rvm install 2.7.4

  4. See error

Expected behavior Should work.

Screenshots

Capture d’écran 2021-07-14 à 09 45 51

The second dip command is using 7.1.1

Context (please complete the following information):

zaratan commented 3 years ago

I know what the problem is and how to fix it. I'll open a PR soon. I wanted to have a corresponding issue to document the problem.

zaratan commented 3 years ago

This commit is the culprit: https://github.com/bibendi/dip/commit/7d2c3525f46fd9b9dcac0190e84480bc8f0d471b