Capistrano: run with options --dry-run
cap local deploy --dry-run --trace
** Invoke local (first_time)
** Execute local
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
cap aborted!
undefined method `verbosity' for "/usr/bin/env #<StringIO:0x007ff7a9827118> /tmp/git-ssh.sh":String
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/formatters/pretty.rb:10:in `write'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/printer.rb:14:in `block in execute'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/printer.rb:13:in `tap'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/printer.rb:13:in `execute'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/capistrano-3.0.0/lib/capistrano/tasks/git.rake:11:in `block (3 levels) in <top (required)>'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/printer.rb:9:in `instance_exec'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/backends/printer.rb:9:in `run'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.1.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:check => git:wrapper
In https://github.com/leehambley/sshkit/blob/ffbce7622ae57bb960d4a75375f5afb18b9228b7/lib/sshkit/backends/printer.rb#L14
output << cmd.to_s
This line call SSHKit::Formatter::Pretty.write() with object String
If temporary comment this line https://github.com/leehambley/sshkit/blob/ffbce7622ae57bb960d4a75375f5afb18b9228b7/lib/sshkit/formatters/pretty.rb#L10 I will get messages:
Output formatter doesn't know how to handle String
In 5 minutes I have change line to:
return if obj.respond_to?(:verbosity) && obj.verbosity < SSHKit.config.output_verbosity
And add more condition:
when ::String then original_output << obj + "\n"
It's look like what I want.
cap local deploy --dry-run
/usr/bin/env #<StringIO:0x007f92cb827368> /tmp/git-ssh.sh
/usr/bin/env chmod +x /tmp/git-ssh.sh
/usr/bin/env git ls-remote [email protected]:stamm/grape.git
/usr/bin/env mkdir -pv /var/www/shared /var/www/releases
/usr/bin/env mkdir -pv /var/www/shared/log /var/www/shared/tmp/pids /var/www/shared/tmp/cache /var/www/shared/tmp/sockets
/usr/bin/env mkdir -pv /var/www/shared/config
/usr/bin/env [ -f /var/www/shared/config/thin.yml ]
/usr/bin/env [ -f /var/www/repo/HEAD ]
INFO The repository mirror is at /var/www/repo
/usr/bin/env if test ! -d /var/www/repo; then echo "Directory does not exist '/var/www/repo'" 1>&2; false; fi
/usr/bin/env git remote update
/usr/bin/env if test ! -d /var/www/repo; then echo "Directory does not exist '/var/www/repo'" 1>&2; false; fi
/usr/bin/env mkdir -p /var/www/releases/20131028002432
/usr/bin/env git archive master | tar -x -C /var/www/releases/20131028002432
/usr/bin/env mkdir -pv /var/www/releases/20131028002432/config
/usr/bin/env [ -L /var/www/releases/20131028002432/config/thin.yml ]
/usr/bin/env mkdir -pv /var/www/releases/20131028002432 /var/www/releases/20131028002432/tmp /var/www/releases/20131028002432/tmp /var/www/releases/20131028002432/tmp
/usr/bin/env [ -L /var/www/releases/20131028002432/log ]
/usr/bin/env [ -L /var/www/releases/20131028002432/tmp/pids ]
/usr/bin/env [ -L /var/www/releases/20131028002432/tmp/cache ]
/usr/bin/env [ -L /var/www/releases/20131028002432/tmp/sockets ]
/usr/bin/env if test ! -d /var/www/releases/20131028002432; then echo "Directory does not exist '/var/www/releases/20131028002432'" 1>&2; false; fi
/usr/bin/env bundle --gemfile /var/www/releases/20131028002432/Gemfile --path /var/www/shared/bundle --deployment --quiet --binstubs /var/www/shared/bin --without development test
/usr/bin/env rm -rf /var/www/current
/usr/bin/env ln -s /var/www/releases/20131028002432 /var/www/current
/usr/bin/env if test ! -d /var/www/releases/20131028002432; then echo "Directory does not exist '/var/www/releases/20131028002432'" 1>&2; false; fi
/usr/bin/env /var/www/shared/bin/thin restart -C /var/www/releases/20131028002432/config/thin.yml
/usr/bin/env ls -x /var/www/releases
/usr/bin/env if test ! -d /var/www/releases; then echo "Directory does not exist '/var/www/releases'" 1>&2; false; fi
/usr/bin/env echo "Branch master deployed as release 20131028002432 by stamm; " >> /var/www/revisions.log
I knew that is bad idea. What you think about this problem?
Now the option --dry-run is not working. for me too.
Downgrading to 1.0.0 works for me. I noticed that Rubygems has 1.1.0, but the repo hasn't been updated on master?
I think, it would work nicely if the Printer didn't call to_s on the command and just shovel the whole command object into the output (which is the Pretty formatter expecting the command). The other formatter works well with Command as well (or simply don't care)
I may have changed & broken that. I can confirm the log formatters expect objects on Command and LogMessage (?) classes. Any thing contrary is incorrect On 30 Oct 2013 16:21, "Marek Rosa" [email protected] wrote:
I think, it would work nicely if the Printer didn't call to_s on the command and just shovel the whole command object into the output (which is the Pretty formatter expecting the command). The other formatter works well with Command as well (or simply don't care)
— Reply to this email directly or view it on GitHubhttps://github.com/leehambley/sshkit/issues/39#issuecomment-27398471 .
Downgrading to 1.0.0 works for me. I noticed that Rubygems has 1.1.0, but the repo hasn't been updated on master?
Yep, it works!
same issue here. using rbenv 2.0.0p247
@reicheltd confirmed w rbenv 2.0.0-p247
adding gem 'sshkit', '~> 1.0.0' before capistrano fixed issue for me
Version 1.2.0 has just been released to rubygems.org, but this issue is still present.
Yes, @sanichi that's why the issue is still open… ?
@leehambley same error on version 1.2.0
cap local deploy --dry-run --trace
** Invoke local (first_time)
** Execute local
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke deploy (first_time)
** Execute deploy
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Execute deploy:check
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
cap aborted!
undefined method `verbosity' for "/usr/bin/env mkdir -p /tmp/my_app_name/\n":String
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.2.0/lib/sshkit/formatters/pretty.rb:10:in `write'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:14:in `block in execute'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:13:in `tap'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:13:in `execute'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/capistrano-3.0.1/lib/capistrano/tasks/git.rake:13:in `block (3 levels) in <top (required)>'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:9:in `instance_exec'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.2.0/lib/sshkit/backends/printer.rb:9:in `run'
/Users/stamm/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sshkit-1.2.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => git:check => git:wrapper
@Nikita-V has a solution capistrano/sshkit#58 but I guess the commit message wasn't clear, and I don't think any tests were included.
The problem is with printer line 14:
def execute(*args)
command(*args).tap do |cmd|
output << sprintf("%s\n", cmd) # Offending line, sprintf returns String, output<< expects Command
end
end
A quick and dirty solution is:
def execute(*args)
command(*args).tap do |cmd|
output << cmd # cmd is a Command and has the `verbosity` method
end
end
I guess at one point in time output<< accepted Strings
+1
$ cap production deploy --dry-run
cap aborted!
undefined method `verbosity' for "mkdir -p /tmp/project.com/\n":String
What is the +1 supposed to say?
#58 was merged, and has been released. If that was not a solution, then please be more desciptive and see the contributing guidelines at https://github.com/capistrano/capistrano/blob/master/CONTRIBUTING.md
@leehambley, hello! I just have same problem. I don't know why - but I have it.
GEM
remote: http://rubygems.org/
specs:
capistrano (3.0.1)
i18n
rake (>= 10.0.0)
sshkit (>= 0.0.23)
capistrano-bundler (1.1.1)
capistrano (~> 3.0)
sshkit (>= 1.2.0)
capistrano-rails (1.1.0)
capistrano (>= 3.0.0)
capistrano-bundler (>= 1.0.0)
capistrano-rvm (0.0.3)
capistrano
i18n (0.6.9)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.7.0)
rake (10.1.1)
settingslogic (2.0.9)
sshkit (1.3.0)
net-scp (>= 1.1.2)
net-ssh
term-ansicolor
term-ansicolor (1.2.2)
tins (~> 0.8)
tins (0.13.1)
PLATFORMS
ruby
DEPENDENCIES
capistrano (~> 3.0.1)
capistrano-bundler
capistrano-rails (~> 1.1)
capistrano-rvm
settingslogic
@the-teacher The gem hasn't been updated on Rubygem.org yet. Just use the repository
gem 'sshkit', '~> 1.3', github: 'capistrano/sshkit'
It should be released??
Sent from my Nexus 4. On 6 Jan 2014 06:10, "mengqing" [email protected] wrote:
@the-teacher https://github.com/the-teacher The gem hasn't been updated on Rubygem.org yet. Just use the repository
gem 'sshkit', '~> 1.3', github: 'capistrano/sshkit'
— Reply to this email directly or view it on GitHubhttps://github.com/capistrano/sshkit/issues/39#issuecomment-31627926 .
http://rubygems.org/gems/sshkit/versions/1.3.0
Sent from my Nexus 4. On 6 Jan 2014 06:52, "Lee Hambley" [email protected] wrote:
It should be released??
Sent from my Nexus 4. On 6 Jan 2014 06:10, "mengqing" [email protected] wrote:
@the-teacher https://github.com/the-teacher The gem hasn't been updated on Rubygem.org yet. Just use the repository
gem 'sshkit', '~> 1.3', github: 'capistrano/sshkit'
— Reply to this email directly or view it on GitHubhttps://github.com/capistrano/sshkit/issues/39#issuecomment-31627926 .
Not with the #58 merge which @the-teacher is still having problems with
This is still an issue. Even with this in my Gemfile : gem 'sshkit', '~> 1.3', github: 'capistrano/sshkit' The latest patch 'maybe' solves the "undefined method 'verbosity'" error message, but still create an issue with Capistrano : you can not anymore call a task from within anoth task. The only workaround is to use gem 'capistrano', '~> 3.0.1' gem 'sshkit', '~> 1.0.0'