capistrano-karaf 1.7.3 → 1.8.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.
- checksums.yaml +15 -0
- data/lib/capistrano-karaf/docker.rb +100 -0
- metadata +8 -9
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YzdlZDA2ZDFlMWMzZmIzMzFlYTYxOGQ0MGE0OTM3MTIyMThmZTNiMA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ODIwZmUyMTkwMmQzYTU1ZjZlYmYyNTFjNzAxZjFlZGE5NWFlNGU0Zg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZDUxYjhlOGI2MmEwZWEwNzVhNTY5ZDc2ZWVmMzRhZjdkMWE4ZjhiOTg5NDAw
|
10
|
+
MmNjNDhjYTJiZTMwYzg2ODczMGEyMGYxMWMwMmEwMDg0OGNkMGUwZDNiNDdh
|
11
|
+
YzI4MGFiODM1OGYyNDg3NjdmMzU0ZjM3MzNiYTcxZGMxNDc2OGQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NTFlZmJjMmQ2YmM4NjdlYmVmZmU3MDEzYzQ0YjE3ZTc1NTIzNTI3YzI5OWRl
|
14
|
+
NjkzYmQzNzQ1OTkwNTI5ZTlhMzZiMjRkNTU2NjdkMmFjZTUyMDI5ZmQ4MmRi
|
15
|
+
ZTQ3OTcyZWQyZTljZDhhZWFkM2YzYTYwNWYzY2U5ZWM2ODI2Y2Q=
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'capistrano-karaf/core'
|
2
|
+
require 'capistrano-karaf/extended'
|
3
|
+
|
4
|
+
module Docker
|
5
|
+
|
6
|
+
include Capistrano_Karaf
|
7
|
+
|
8
|
+
def list_processes
|
9
|
+
matches = []
|
10
|
+
procs = capture(:ps, "ax")
|
11
|
+
procs.each_line do |line|
|
12
|
+
m = /(?<PID>\d+)[ ]*(?<TTY>[?\w\/\d]+)[ ]*(?<STATUS>[\w\+]+)[ ]*(?<TIME>\d+:\d{1,2}+) (?<COMMAND>.*)/.match(line)
|
13
|
+
if m then
|
14
|
+
matches.push ({ :pid => m['PID'],
|
15
|
+
:tty => m['TTY'],
|
16
|
+
:status => m['STATUS'],
|
17
|
+
:time => m['TIME'],
|
18
|
+
:command => m['COMMAND']
|
19
|
+
})
|
20
|
+
end
|
21
|
+
end
|
22
|
+
matches
|
23
|
+
end
|
24
|
+
|
25
|
+
def force_stop
|
26
|
+
# kill all remaining karaf processes on the server
|
27
|
+
on roles(:esb) do
|
28
|
+
begin
|
29
|
+
procs = list_processes
|
30
|
+
karaf_procs = procs.find_all { |p| p[:command].include? "karaf" }
|
31
|
+
karaf_procs.each do |p|
|
32
|
+
as "smx-fuse" do
|
33
|
+
begin
|
34
|
+
execute(:kill, p[:pid])
|
35
|
+
rescue
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
rescue Exception => e
|
40
|
+
puts "#{host.hostname} got exception #{e.message}"
|
41
|
+
raise e
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# wait_for_smx_to_start - function that blocks till all bundles are active, and the last one is started
|
47
|
+
def wait_for_smx_to_start
|
48
|
+
# wait so we can ssh to the smx console
|
49
|
+
on roles(:karaf) do
|
50
|
+
# wait until all bundles are started and spring context is loaded"
|
51
|
+
puts "Waiting till all bundles are started"
|
52
|
+
wait_for_all_bundles(:timeout => 180, :sleeptime => 10) do
|
53
|
+
|b| ["Active", "Resolved", "Installed"].include? b[:status]
|
54
|
+
end
|
55
|
+
wait_for_bundle(:timeout => 500, :sleeptime => 10) do |b|
|
56
|
+
if b[:name] == "Apache CXF Bundle Jar"
|
57
|
+
puts "Bundle status #{b}"
|
58
|
+
end
|
59
|
+
b[:name] == "Apache CXF Bundle Jar" and (b[:blueprint] == 'Started' or b[:blueprint] == 'Created')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# karaf_started? - verify if karaf is listening to its ssh port
|
65
|
+
def karaf_started?
|
66
|
+
n = `netstat -ao | grep 8101 | wc -l`
|
67
|
+
n.to_i > 0
|
68
|
+
end
|
69
|
+
|
70
|
+
# block_till_karaf_started - wait till the karaf server is listening to its ssh port
|
71
|
+
def block_till_karaf_started (args={})
|
72
|
+
args = {:timeout => 120, :sleeptime => 1}.merge(args)
|
73
|
+
timeout = Time.now + args[:timeout]
|
74
|
+
until (karaf_started? || timeout < Time.now) do
|
75
|
+
sleep args[:sleeptime]
|
76
|
+
end
|
77
|
+
|
78
|
+
raise "Karaf didn\' start within #{args[:timeout]} seconds." unless karaf_started?
|
79
|
+
end
|
80
|
+
|
81
|
+
def block_till_everything_is_started
|
82
|
+
block_till_karaf_started
|
83
|
+
puts "Sleeping for 20 seconds"
|
84
|
+
sleep 20
|
85
|
+
wait_for_smx_to_start
|
86
|
+
end
|
87
|
+
|
88
|
+
def with_karaf
|
89
|
+
if not karaf_started?
|
90
|
+
pid = Process.spawn "/root/apache-karaf/bin/start"
|
91
|
+
Process.detach pid
|
92
|
+
block_till_everything_is_started
|
93
|
+
puts "Karaf is started"
|
94
|
+
else
|
95
|
+
puts "Karaf is already started!"
|
96
|
+
end
|
97
|
+
|
98
|
+
yield
|
99
|
+
end
|
100
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-karaf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.8.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Brecht Hoflack
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-
|
11
|
+
date: 2015-06-19 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description:
|
15
14
|
email: brecht.hoflack@gmail.com
|
@@ -18,34 +17,34 @@ extensions: []
|
|
18
17
|
extra_rdoc_files: []
|
19
18
|
files:
|
20
19
|
- lib/capistrano-karaf.rb
|
20
|
+
- lib/capistrano-karaf/backends/opensshproxy.rb
|
21
21
|
- lib/capistrano-karaf/core.rb
|
22
|
+
- lib/capistrano-karaf/docker.rb
|
22
23
|
- lib/capistrano-karaf/extended.rb
|
23
|
-
- lib/capistrano-karaf/semver.rb
|
24
24
|
- lib/capistrano-karaf/install.rb
|
25
|
-
- lib/capistrano-karaf/
|
25
|
+
- lib/capistrano-karaf/semver.rb
|
26
26
|
homepage: http://github.com/bhoflack/capistrano-karaf
|
27
27
|
licenses:
|
28
28
|
- bsd
|
29
|
+
metadata: {}
|
29
30
|
post_install_message:
|
30
31
|
rdoc_options: []
|
31
32
|
require_paths:
|
32
33
|
- lib
|
33
34
|
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
35
|
requirements:
|
36
36
|
- - ! '>='
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: '0'
|
39
39
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
40
|
requirements:
|
42
41
|
- - ! '>='
|
43
42
|
- !ruby/object:Gem::Version
|
44
43
|
version: '0'
|
45
44
|
requirements: []
|
46
45
|
rubyforge_project:
|
47
|
-
rubygems_version:
|
46
|
+
rubygems_version: 2.4.8
|
48
47
|
signing_key:
|
49
|
-
specification_version:
|
48
|
+
specification_version: 4
|
50
49
|
summary: Capistrano functions for communicating with karaf
|
51
50
|
test_files: []
|