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

Shell-escape tasks before passing them to capistrano #12

Merged
merged 1 commit into from
Jul 26, 2013
Merged

Shell-escape tasks before passing them to capistrano #12

merged 1 commit into from
Jul 26, 2013

Conversation

njam
Copy link
Contributor

@njam njam commented Jul 23, 2013

When I try to to use the invoke command I have the problem that the COMMAND='some command' is not being escaped before passed to capistrano.
Let's say I run:

pulsar -v -l trace app env invoke COMMAND='uname -a'

Pulsar will eventually run:

bundle exec cap CONFIG_PATH=/tmp/pulsar/conf-repo-2013-07-23-183838-s5061 --file /tmp/pulsar/capfile-2013-07-23-183838-s5061 invoke COMMAND=uname -a

which doesn't work and results in:

/usr/local/homebrew/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/capistrano-2.15.5/lib/capistrano/cli/options.rb:154:in `parse_options!': invalid option: -a (OptionParser::InvalidOption)
    from /usr/local/homebrew/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/capistrano-2.15.5/lib/capistrano/cli/options.rb:15:in `parse'
    from /usr/local/homebrew/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/capistrano-2.15.5/lib/capistrano/cli/execute.rb:14:in `execute'
    from /usr/local/homebrew/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/capistrano-2.15.5/bin/cap:4:in `<top (required)>'
    from /usr/local/opt/ruby/bin/cap:23:in `load'
    from /usr/local/opt/ruby/bin/cap:23:in `<main>'

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 64d6a3d on njam:issue-12 into e06c151 on nebulab:master.

@njam
Copy link
Contributor Author

njam commented Jul 23, 2013

Is this the right approach, escaping the task list?
Can you point me into the right direction as how/where to test this?

With this patch the command executed by pulsar will become invoke COMMAND\=uname\ -a.

@mtylty
Copy link
Member

mtylty commented Jul 25, 2013

@njam great! it seems something really handy!

Just one thing before I merge the pull request; you should move the require inside https://github.com/nebulab/pulsar/blob/master/lib/pulsar.rb. You can add the require before require "pulsar/helpers/all".

@mtylty
Copy link
Member

mtylty commented Jul 26, 2013

I'm going to release a bugfix version now. I'll merge and make the change myself.

Thanks for the PR!

mtylty added a commit that referenced this pull request Jul 26, 2013
Shell-escape tasks before passing them to capistrano
@mtylty mtylty merged commit be64fd1 into nebulab:master Jul 26, 2013
@njam
Copy link
Contributor Author

njam commented Jul 26, 2013

Oh, I actually had it in lib/pulsar.rb but moved it back into the file. The whole structuring with ruby is still nebulous to me. Thanks for adjusting it!

@mtylty
Copy link
Member

mtylty commented Jul 26, 2013

no problem! 😄

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

Successfully merging this pull request may close these issues.

None yet

3 participants