blower 4.0 → 4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 347f6e63c590bd170c7e942416850924fd0a10f9
4
- data.tar.gz: 8389ddabdcc2e0bb4144806433b82b9a0a1f3eb0
3
+ metadata.gz: 695f6fc9dc74d93169915948b0223367c3527bca
4
+ data.tar.gz: 900f31427700bc6879c8fbd2295aeb6647802c24
5
5
  SHA512:
6
- metadata.gz: 5dfd5196f69a28330ab5b560c3c2a94379b3c6aabedabe81e17aacfd27ffec190bd62bedd33aaa0969f379f61a6c34324fac39903b52465aa43970e9be3ceb39
7
- data.tar.gz: 9e0c0317df8fecb554f59a088d5d298ee4025678434f0feea924cb66d81f9f94b34b0c6775ba3371e4b29e2aa8e404af24b38a58059d1891c512fc5ac2d6d10a
6
+ metadata.gz: ef2781ac7652126053e28006165de815451a7fc17d33243a8055c878c8f15663829424f9b106ec85daf37468dfcc68893bed7d4cfb87931d8a166c6d3832a0b5
7
+ data.tar.gz: c8fb921ceecac7cef82aa00f9ce377dbd6b45d0ad59a975862e247c77065f33996daf4813b9dda2e2b93b99b93cd8ae16a8347859a29ddccf9bf2f95534189cc
data/lib/blower/host.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'net/ssh'
2
+ require 'net/ssh/gateway'
2
3
  require 'net/scp'
3
4
  require 'monitor'
4
5
  require 'colorize'
@@ -16,12 +17,16 @@ module Blower
16
17
  # The host adress.
17
18
  attr_accessor :address
18
19
 
20
+ # The gateway host
21
+ attr_accessor :via
22
+
19
23
  def_delegators :data, :[], :[]=
20
24
 
21
- def initialize (address, data: {}, user: "root")
25
+ def initialize (address, data: {}, user: "root", via: nil)
22
26
  @address = address
23
27
  @user = user
24
28
  @data = data
29
+ @via = via
25
30
  super()
26
31
  end
27
32
 
@@ -139,6 +144,12 @@ module Blower
139
144
  @log ||= Logger.instance.with_prefix("on #{self}: ")
140
145
  end
141
146
 
147
+ # Connect to the host as a Gateway
148
+ # @api private
149
+ def gateway ()
150
+ Net::SSH::Gateway(address, user)
151
+ end
152
+
142
153
  private
143
154
 
144
155
  attr_accessor :data
@@ -150,8 +161,13 @@ module Blower
150
161
  @sessions[user] = nil
151
162
  end
152
163
  @sessions[user] ||= begin
153
- log.debug "Connecting to ssh:#{self}"
154
- Net::SSH.start(address, user)
164
+ if @via
165
+ log.debug "Connecting to ssh:#{self} via ssh:#{via}"
166
+ via.gateway.ssh(address, user)
167
+ else
168
+ log.debug "Connecting to ssh:#{self}"
169
+ Net::SSH.start(address, user)
170
+ end
155
171
  end
156
172
  end
157
173
 
@@ -1,3 +1,3 @@
1
1
  module Blower
2
- VERSION = "4.0"
2
+ VERSION = "4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blower
3
3
  version: !ruby/object:Gem::Version
4
- version: '4.0'
4
+ version: '4.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Baum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-13 00:00:00.000000000 Z
11
+ date: 2016-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh