xlogin 0.6.6 → 0.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dcf7616b6aca051514dc83fd78d0404230a50ed9
4
- data.tar.gz: 631a3d7ea97cc422a0c91ff6a257a8f384688370
3
+ metadata.gz: 95893b3808428acd30e3bc7f48ea6d4b38771c97
4
+ data.tar.gz: 257cdc2bfb9c90785fe629586c4d1eaccb18f285
5
5
  SHA512:
6
- metadata.gz: a220037b93c800ac4bbe120bb3e6ef4d69ce34bd188d6b64e9d022869700ef2a1ccb9acea10504e008a2a746654af2e032706d136abc95aba6baf5d4a170676e
7
- data.tar.gz: c755f66e92023dc47f0c4b876e306a165007bbed2acde20fd5f55bf1276f3524c30a99909d78faec292e2d8c34cf662a89d51e1c0ef2b264705e15beed14ce9a
6
+ metadata.gz: c73ab2e886935518c13cb8be9aa085854745ecdc61c5eaa171fc4400a43ae68f9e230d8feb3f753da4ad1b1f221b11830492d2cc9b42d668c7f11f1f2eeb1afb
7
+ data.tar.gz: 7603d4a210ff9b6f549833a9271d320c2cb5b6dbd19308727eafa2b5411e58a400de8cc4a37fd2cb4f2ce111fce7e6a775ffa256ba91d6ceb2e9a926efb1da06
data/lib/xlogin/cli.rb CHANGED
@@ -56,7 +56,8 @@ module Xlogin
56
56
  authorize(config.assume_yes)
57
57
  end
58
58
 
59
- config.hostlist += parser.parse(args).flat_map do |target|
59
+ args = parser.parse(args)
60
+ config.hostlist += args.flat_map do |target|
60
61
  hostlist = Xlogin.factory.list(target)
61
62
  hostlist.tap { |e| raise "Invalid inventory - #{target}" if e.empty? }
62
63
  end
@@ -103,7 +104,6 @@ module Xlogin
103
104
 
104
105
  private
105
106
  def login(config, &block)
106
- display = Mutex.new
107
107
  buffer = StringIO.new
108
108
 
109
109
  Parallel.map(config.hostlist, in_thread: config.parallels) do |hostinfo|
@@ -120,13 +120,13 @@ module Xlogin
120
120
 
121
121
  block.call(session)
122
122
  rescue => e
123
- lines = (config.parallels > 1)? "\n#{hostname}\t[Error] #{e}" : "\n[Error] #{e}"
124
- display.synchronize { $stderr.puts lines }
123
+ lines = (config.parallels > 1)? "\n#{hostname}\t| [Error] #{e}" : "\n[Error] #{e}"
124
+ lines.each { |line| $stderr.print "#{line.chomp}\n" }
125
125
  end
126
126
 
127
127
  if config.parallels > 1
128
- lines = buffer.string.lines.map { |line| "#{hostname}\t" + line.gsub("\r", '') }
129
- display.synchronize { $stdout.puts lines }
128
+ lines = buffer.string.lines.map { |line| "#{hostname}\t| " + line.gsub("\r", '') }
129
+ lines.each { |line| $stderr.print "#{line.chomp}\n" }
130
130
  end
131
131
  end
132
132
  end
@@ -1,6 +1,5 @@
1
1
  require 'rake'
2
2
  require 'rake/tasklib'
3
- require 'thread'
4
3
  require 'stringio'
5
4
 
6
5
  module Xlogin
@@ -31,10 +30,6 @@ module Xlogin
31
30
  end
32
31
  end
33
32
  end
34
-
35
- def mutex
36
- @mutex ||= Mutex.new
37
- end
38
33
  end
39
34
 
40
35
 
@@ -89,14 +84,12 @@ module Xlogin
89
84
  begin
90
85
  session = Xlogin.factory.build_from_hostname(name, log: loggers)
91
86
  @runner.call(session)
92
- RakeTask.mutex.synchronize do
93
- $stdout.puts buffer.string.lines.map { |line| "#{name}\t" + line.gsub("\r", '') }
94
- end
87
+ lines = buffer.string.lines.map { |line| "#{name}\t" + line.gsub("\r", '') }
88
+ lines.each { |line| $stdout.print line.chomp + "\n" }
95
89
  rescue => e
96
- RakeTask.mutex.synchronize do
97
- $stdout.puts buffer.string.lines.map { |line| "#{name}\t" + line.gsub("\r", '') }
98
- $stderr.puts "#{name}\t#{e}"
99
- end
90
+ lines = buffer.string.lines.map { |line| "#{name}\t" + line.gsub("\r", '') }
91
+ lines.each { |line| $stdout.print line.chomp + "\n" }
92
+ $stderr.puts "#{name}\t#{e}"
100
93
  end
101
94
  else
102
95
  loggers << $stdout unless silent
@@ -83,7 +83,7 @@ module Xlogin
83
83
  end
84
84
 
85
85
  def close
86
- @gateway.close(@port) if @gateway
86
+ @gateway.shutdown! if @gateway
87
87
  super
88
88
  end
89
89
 
@@ -1,3 +1,3 @@
1
1
  module Xlogin
2
- VERSION = "0.6.6"
2
+ VERSION = "0.6.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xlogin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - haccht
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2017-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-telnet