xlogin 0.6.29 → 0.6.31

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: 9cf6cc5d3360756020f661eca6254eb65bec6ec3
4
- data.tar.gz: 474a9b59b05719522535610e30b59f9a51f58f2a
3
+ metadata.gz: d6cecc1941f217b65d75839af8ec66dbd3c6fa53
4
+ data.tar.gz: f45469b1160d246c5f065671e65e6f9945c642d5
5
5
  SHA512:
6
- metadata.gz: 5d26cb132c50e42067461ca310026d5f99f8262146dc71e473d69f8b9a99e1f81b48df7151951891f764b3c5b24ca79b0cf79333ed3d54d1c023fbfa6db41f62
7
- data.tar.gz: faff67cfcd7d6ed68f5d48db3c0783b665ddc3fb0e2cb6d52d221cda2bf1a2fc63d2e924625910313162e36003110c717eea263c7ff0153ebfac12d76bd48c8e
6
+ metadata.gz: b6c5e727b05904282986743645fe5bd2a0fcfa44a2e61365266b668ebde2655e07e0d359cf7064bea351a557a2b32a33d1668bb4f7e116ddff760f335de5104c
7
+ data.tar.gz: 7975f93f7df0c6900cc36839b3b61b186a600fb8233b7133e5cd14e7a586390063997ec229d64f3f34b98f9534a5df53a5ddf4957a0761f48f1f9af3bd4d075c
data/lib/xlogin/cli.rb CHANGED
@@ -21,7 +21,7 @@ module Xlogin
21
21
  config = OpenStruct.new(
22
22
  task: 'tty',
23
23
  hostlist: [],
24
- parallels: 5,
24
+ parallels: 1,
25
25
  inventory: nil,
26
26
  templates: [],
27
27
  )
@@ -117,16 +117,17 @@ module Xlogin
117
117
 
118
118
  session = Xlogin.factory.build(hostinfo.merge(log: loggers))
119
119
  session.enable(session.opts.enable) if config.enable && session.respond_to?(:enable)
120
+ session.cmd('')
120
121
 
121
122
  block.call(session)
122
123
  rescue => e
123
- lines = (config.parallels > 1)? "\n#{hostname}\t| [Error] #{e}" : "\n[Error] #{e}"
124
- lines.each_line { |line| $stderr.print "#{line.chomp}\n" }
124
+ lines = (config.parallels > 1)? ["\n#{hostname}\t| [Error] #{e}"] : ["\n[Error] #{e}"]
125
+ lines.each { |line| $stderr.print "#{line.chomp}\n" }
125
126
  end
126
127
 
127
128
  if config.parallels > 1
128
129
  lines = buffer.string.lines.map { |line| "#{hostname}\t| " + line.gsub("\r", '') }
129
- lines.each_line { |line| $stderr.print "#{line.chomp}\n" }
130
+ lines.each { |line| $stdout.print "#{line.chomp}\n" }
130
131
  end
131
132
  end
132
133
  end
@@ -14,7 +14,7 @@ module Xlogin
14
14
 
15
15
  login = @methods.fetch(:login)
16
16
  delegate = @methods.fetch(:delegate)
17
- raise TemplateError.new("'login' and 'delegate' methods are necessary in the #{target_info[:type]} template.") unless login && delegate
17
+ raise TemplateError.new("'login' and 'delegate' must be defined in the #{target_info[:type]} template.") unless login && delegate
18
18
 
19
19
  relay_uri = URI(uri.to_s)
20
20
  userinfo_cache = relay_uri.userinfo.dup
@@ -44,7 +44,7 @@ module Xlogin
44
44
  # end
45
45
  #
46
46
  # delegate do |uri, **opts|
47
- # cmd("telnet #{uri.host}")
47
+ # puts("telnet #{uri.host}")
48
48
  # login(*uri.userinfo.split(':'))
49
49
  # end
50
50
 
@@ -76,7 +76,7 @@ module Xlogin
76
76
  hostinfo = get(hostname)
77
77
  raise Xlogin::SessionError.new("Host not found: '#{hostname}'") unless hostinfo
78
78
 
79
- build(hostinfo.merge(**params))
79
+ build(hostinfo.merge(**params)).tap { |s| s.name = hostname }
80
80
  end
81
81
 
82
82
  def method_missing(method_name, *args, &block)
@@ -87,11 +87,4 @@ module Xlogin
87
87
 
88
88
  end
89
89
 
90
- # monkey patch to SessionModule#cmd method
91
- module SessionModule
92
- def cmd(*args)
93
- super(*args) { |resp| yield resp if block_given? }
94
- end
95
- end
96
-
97
90
  end
@@ -81,12 +81,14 @@ module Xlogin
81
81
  end
82
82
 
83
83
  def close(*args)
84
+ logout(*args) if respond_to?(:logout)
84
85
  @gateway.shutdown! if @gateway
85
86
  @output_loggers.each do |output_log, logger|
86
87
  next unless logger
87
88
  logger.close if output_log.kind_of?(String)
88
89
  end
89
- logout(*args) if respond_to?(:logout)
90
+ rescue
91
+ ensure
90
92
  super
91
93
  end
92
94
 
@@ -1,3 +1,3 @@
1
1
  module Xlogin
2
- VERSION = "0.6.29"
2
+ VERSION = "0.6.31"
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.29
4
+ version: 0.6.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - haccht
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-22 00:00:00.000000000 Z
11
+ date: 2018-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-telnet