Skip to content

Commit

Permalink
Ruby 1.9+-Kompabilität: Fix for can't add a new key into hash during …
Browse files Browse the repository at this point in the history
…iteration:

There are several other places to fix... still, but this one is fixed now.

Creating a backup to .ssh/authorized_keys-2015-04-14.bak if not already done today...
~/.ssh does not seem to exist, creating it with 700...
/usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:305:in `open_channel': can't add a new key into hash during iteration (RuntimeError)
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:329:in `exec'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:363:in `exec!'
        from /homelokal/ms/Debian/distkeys/distkeys.git/distkeys:174:in `block in commit'
        from /usr/lib/ruby/vendor_ruby/net/sftp/request.rb:87:in `call'
        from /usr/lib/ruby/vendor_ruby/net/sftp/request.rb:87:in `respond_to'
        from /usr/lib/ruby/vendor_ruby/net/sftp/session.rb:948:in `dispatch_request'
        from /usr/lib/ruby/vendor_ruby/net/sftp/session.rb:911:in `when_channel_polled'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/channel.rb:311:in `call'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/channel.rb:311:in `process'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:222:in `block in preprocess'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:222:in `each'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:222:in `preprocess'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:205:in `process'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:169:in `block in loop'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:169:in `loop'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:169:in `loop'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/channel.rb:269:in `wait'
        from /usr/lib/ruby/vendor_ruby/net/ssh/connection/session.rb:364:in `exec!'
        from /homelokal/ms/Debian/distkeys/distkeys.git/distkeys:184:in `commit'
        from /homelokal/ms/Debian/distkeys/distkeys.git/distkeys:628:in `handle_host'
        from /homelokal/ms/Debian/distkeys/distkeys.git/distkeys:703:in `block in handle_gwhost'
        from /homelokal/ms/Debian/distkeys/distkeys.git/distkeys:686:in `each'
        from /homelokal/ms/Debian/distkeys/distkeys.git/distkeys:686:in `handle_gwhost'
        from /homelokal/ms/Debian/distkeys/distkeys.git/distkeys:718:in `loop'
        from /homelokal/ms/Debian/distkeys/distkeys.git/distkeys:828:in `<main>'
  • Loading branch information
Martin Steigerwald committed Apr 14, 2015
1 parent c4742db commit 1092384
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions distkeys
Expand Up @@ -168,12 +168,12 @@ class SSHAuthKeys
end

# Try to create ~/.ssh if it does not already exist
@sftp.lstat( ".ssh" ) do | response |
if not response.ok?
ok=false
@sftp.lstat( ".ssh" ) do |response| ok = response.ok?; end
if not ok then
puts "~/.ssh does not seem to exist, creating it with 700..."
@ssh.exec!( "mkdir ~/.ssh" )
@ssh.exec!( "chmod 700 ~/.ssh" )
end
end

# Create a backup
Expand Down

0 comments on commit 1092384

Please sign in to comment.