capistrano-karaf 1.7.0 → 1.7.1

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.
@@ -0,0 +1,75 @@
1
+ require 'sshkit/backends/netssh'
2
+
3
+ module Capistrano_karaf
4
+ module Backend
5
+ class SshProxy < SSHKit::Backend::Netssh
6
+
7
+ @pool = SSHKit::Backend::ConnectionPool.new
8
+
9
+ def capture(*args)
10
+ karaf_role = fetch :karaf_role, :karaf
11
+ if host.has_role? karaf_role
12
+
13
+ karaf_username = fetch :karaf_username, "smx"
14
+ karaf_password = fetch :karaf_password, "smx"
15
+ karaf_port = fetch :karaf_port, "8101"
16
+
17
+ args1 = ["sshpass", "-p", karaf_password, "ssh", "-o", "NoHostAuthenticationForLocalhost=yes", "-o", "StrictHostKeyChecking=no", "#{karaf_username}@localhost", "-p", karaf_port].concat(args)
18
+ options = { verbosity: Logger::DEBUG }.merge(args1.extract_options!)
19
+
20
+ r = nil
21
+ counter = 0
22
+ ex = nil
23
+ begin
24
+ counter += 1
25
+ begin
26
+ r = _execute(*[*args1, options])
27
+ ex = nil
28
+ break
29
+ rescue SSHKit::Command::Failed => e
30
+ output << SSHKit::LogMessage.new(Logger::WARN, "Got exception while running command #{args1} on host #{host.hostname}")
31
+ ex = e
32
+ end
33
+ end while counter < 4
34
+
35
+ raise ex unless ex.nil?
36
+ r.full_stdout.strip
37
+ else
38
+ options = { verbosity: Logger::DEBUG }.merge(args.extract_options!)
39
+ _execute(*[*args, options]).full_stdout.strip
40
+ end
41
+ end
42
+
43
+ def execute(*args)
44
+ karaf_role = fetch :karaf_role, :karaf
45
+ if host.has_role? karaf_role
46
+
47
+ karaf_username = fetch :karaf_username, "smx"
48
+ karaf_password = fetch :karaf_password, "smx"
49
+ karaf_port = fetch :karaf_port, "8101"
50
+
51
+ args1 = ["sshpass", "-p", karaf_password, "ssh", "-o", "NoHostAuthenticationForLocalhost=yes", "-o", "StrictHostKeyChecking=no", "#{karaf_username}@localhost", "-p", karaf_port].concat(args)
52
+ r = nil
53
+ counter = 0
54
+ ex = nil
55
+ begin
56
+ counter += 1
57
+ begin
58
+ r = _execute(*args1)
59
+ ex = nil
60
+ break
61
+ rescue SSHKit::Command::Failed => e
62
+ output << SSHKit::LogMessage.new(Logger::WARN, "Got exception while running command #{args1} on host #{host.hostname}")
63
+ ex = e
64
+ end
65
+ end while counter < 4
66
+
67
+ raise ex unless ex.nil?
68
+ r.success?
69
+ else
70
+ _execute(*args).success?
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-karaf
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -22,6 +22,7 @@ files:
22
22
  - lib/capistrano-karaf/extended.rb
23
23
  - lib/capistrano-karaf/semver.rb
24
24
  - lib/capistrano-karaf/install.rb
25
+ - lib/capistrano-karaf/backends/opensshproxy.rb
25
26
  homepage: http://github.com/bhoflack/capistrano-karaf
26
27
  licenses:
27
28
  - bsd