Comments (13)
Can you try:
on roles(:app).to_a, in: :sequence do |host|
See Set#to_a.
I wonder if that could be it?
from sshkit.
Thanks @leehambley, using:
on roles(:app).to_a, in: :sequence do |host|
actually works.
I can use it this way, but its counterintuitive. Do you think this can be changed, so that:
role :demo, %w{example.com example.org example.net}
task :uptime do |host|
on roles(:demo), in: :parallel do
uptime = capture(:uptime)
puts "#{host.hostname} reports: #{uptime}"
end
end
and
role :demo, %w{example.com example.org example.net}
task :uptime do |host|
on roles(:demo), in: :sequence do
uptime = capture(:uptime)
puts "#{host.hostname} reports: #{uptime}"
end
end
both work the same way?
from sshkit.
Definitely that's a bug. It must have something to do with how #each
is working on a Set
vs. an Array
here
I'm not sure where best to fix it, actually. I know that Capistrano's roles()
and release_roles()
etc, use Sets in preference to arrays (precisely because usually their order is unimportant). Perhaps we should revisit that and make the order deterministic.
I know it sucks, but if you can work around it for the time being, please do. I'm leaving to go on vacation tomorrow, and won't have time to fix this for a while.
@seenmyfate I know you're busy mate, but any thoughts on that one way or another. I always liked Sets, and I believe it was my idea originally, but perhaps if people give us an array, we should keep it. Seem to recall wanting to take away the #first
crutch that people were relying on rather than specifying a primary: true
host property, but I didn't foresee this side effect.
from sshkit.
@leehambley There is no rush in fixing this, I can live with the workaround for now! Thanks for the help!
from sshkit.
Just ran in to this bug with Capistrano 3.2.0. The workaround fixes it, but in: :sequence
is essentially useless without it based on the documentation.
from sshkit.
but in: :sequence is essentially useless without it based on the documentation.
Sorry, I'm not understanding what you mean, could you rephrase that?
from sshkit.
Reading up I see that I asked @seenmyfate for some input, he's a busy man and just a day or two ago started a vacation, I don't expect to hear back from him, but perhaps someone else could pick up the baton and find out if Set vs. Array each is the problem?
@seenmyfate I know you're busy mate, but any thoughts on that one way or another. I always liked Sets, and I believe it was my idea originally, but perhaps if people give us an array, we should keep it. Seem to recall wanting to take away the #first crutch that people were relying on rather than specifying a primary: true host property, but I didn't foresee this side effect.
from sshkit.
@leehambley I just meant to say that in: :sequence
is documented as a working feature, however, without coming across this issue, it doesn't work out of the box. A pretty run-of-the-mill bug 😄
I consider this a pretty fundamental feature of Capistrano. I think folks may get confused trying to get this to work, so I was thinking that considering the amount of time that's passed since it was noticed, updating the docs may be a quick win?
from sshkit.
I can't reproduce this in [email protected]
, [email protected]
. Here's my task (tested using 3 servers):
task :test_seq do
on roles(:all), :in => :sequence do |host|
uptime = capture(:uptime)
puts "#{host.hostname} reports: #{uptime}"
end
end
The three uptime
commands were executed in sequence, as expected.
The only thing I can think of is that perhaps you mistyped :in
, e.g. as :In
or "in"
, in which case SSHKit would ignore it and default to :parallel
.
from sshkit.
The only thing I can think of is that perhaps you mistyped :in, e.g. as :In or "in", in which case SSHKit would ignore it and default to :parallel.
I also wonder if without the parenthesis around roles(…)
the Ruby parser is parsing that as roles(:foo, in: :parallel)
or something?
from sshkit.
I also wonder if without the parenthesis around roles(…) the Ruby parser is parsing that as roles(:foo, in: :parallel) or something?
I thought so too, but I tried many variations of spacing and parentheses and couldn't reproduce. When Ruby parses it as roles(:foo, in: :parallel)
, it just finds zero hosts and doesn't run the block at all.
from sshkit.
Alright, so I'll re-close the issue, thanks for the investigative work Matt :)
from sshkit.
@leehambley :in => :sequence
works! I was originally using the syntax you highlighted in the second comment of this issue (The first response you gave). I originally got it from the sshkit documentation: https://github.com/capistrano/sshkit#how-might-it-work
Thanks for looking in to this!
from sshkit.
Related Issues (20)
- Upgrade to mocha 1.10+ HOT 1
- Unknown constant SSHKit::MappingInteractionHandler HOT 5
- getaddrinfo HOT 5
- connection pool session keepalive HOT 5
- whoami and id -a return different users HOT 16
- "connection closed by remote host" (JRuby / Capistrano) HOT 6
- Exports added by :with are ineffective when :user is specified
- Using a single tunnel/gateway/jump host to connect to multiple hosts HOT 5
- Any way to set the ssh port in the DSL? HOT 1
- `could not settle on host_key algorithm (SSHKit::Runner::ExecuteError)` with certificate based authentication HOT 1
- Connections with openssl-3.0.0 fail with incompatibility error HOT 1
- Issue with dependency versions (net-ssh and net-scp versions are incompatible) HOT 1
- Connection pending forever if command to execute is long HOT 2
- Is there travis-ci.com build? HOT 2
- pls delete this issue.
- download! method doesn't close file HOT 1
- Dependency Issue in i18n with the latest version of sshkit HOT 2
- SFTP transfer does not work with Ruby 2.0 HOT 1
- sshkit broken with net-ssh 7.2.2 HOT 4
- Unbracketed IPv6 addresses don't work
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sshkit.