corosync-ruby 0.0.4 → 0.1.0
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 +7 -0
- data/lib/corosync-ruby/cluster.rb +14 -7
- metadata +21 -43
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ccf8476a70dcc4ae66fcf38be96c3e49f92bb40e
|
4
|
+
data.tar.gz: 476eb05e0fc2bfbfe9194c6870d44d09176e5188
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 365d721fc88a3db876b671792005c1f0f73eb81eb20dc828d027927a1a63f1ddf6758155de176a4b7d4fa9d13838a803e3571071f15001b761772d58726e69bf
|
7
|
+
data.tar.gz: e7158b83d421aaeefade04b8de6971dd22b01e6692e487523b9ac3006f8d2c911b934ad1dce0daf726c8bc78cd0c7dccf345ea0afc01a29b7e50525be4105e51
|
@@ -2,6 +2,9 @@ module Corosync
|
|
2
2
|
class Cluster
|
3
3
|
COMMAND = "sudo crm"
|
4
4
|
|
5
|
+
attr_reader :nodes_configured, :resources_configured, :online, :offline
|
6
|
+
attr_reader :resources_started, :resources_stopped, :failed_actions
|
7
|
+
|
5
8
|
def initialize
|
6
9
|
parse
|
7
10
|
end
|
@@ -61,34 +64,36 @@ module Corosync
|
|
61
64
|
|
62
65
|
# parse output
|
63
66
|
@nodes_configured = []
|
64
|
-
if /(\d+)
|
67
|
+
if /(\d+) [Nn]odes.*?configured/.match(output)
|
65
68
|
@nodes_configured = Regexp.last_match[1].to_i
|
66
69
|
else
|
67
70
|
raise "Can't parse output"
|
68
71
|
end
|
69
72
|
|
70
73
|
@resources_configured = []
|
71
|
-
if /(\d+)
|
74
|
+
if /(\d+) [Rr]esources.*?configured/.match(output)
|
72
75
|
@resources_configured = Regexp.last_match[1].to_i
|
73
76
|
else
|
74
77
|
raise "Can't parse output"
|
75
78
|
end
|
76
79
|
|
77
80
|
@online = []
|
78
|
-
if /
|
81
|
+
if (/online:\s+\[\s+(.+?)\s+\]/i).match(output)
|
79
82
|
@online = Regexp.last_match[1].split(' ')
|
80
83
|
end
|
81
84
|
|
82
85
|
@offline = []
|
83
|
-
if /
|
86
|
+
if (/offline:\s+\[\s+(.+?)\s+\]/i).match(output)
|
84
87
|
@offline = Regexp.last_match[1].split(' ')
|
85
88
|
end
|
86
89
|
|
87
|
-
|
90
|
+
if @online.empty? && @offline.empty?
|
91
|
+
raise "Can't parse output"
|
92
|
+
end
|
88
93
|
|
89
94
|
@resources_started = []
|
90
95
|
@resources_stopped = []
|
91
|
-
resources = output.scan(/^\s*(
|
96
|
+
resources = output.scan(/^\s*(.+?)\s+\(.+?\):\s+(.+?)$/)
|
92
97
|
resources.each do |res|
|
93
98
|
status = res[1].split(' ')
|
94
99
|
if status.include? 'Started'
|
@@ -98,7 +103,9 @@ module Corosync
|
|
98
103
|
end
|
99
104
|
end
|
100
105
|
|
101
|
-
|
106
|
+
if @resources_started.empty? && @resources_stopped.empty?
|
107
|
+
raise "Can't parse output"
|
108
|
+
end
|
102
109
|
|
103
110
|
@failed_actions = []
|
104
111
|
if (/Failed actions:.*/m).match(output)
|
metadata
CHANGED
@@ -1,67 +1,45 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: corosync-ruby
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 0.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Pavel Ivanov
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2013-05-06 00:00:00 Z
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
19
12
|
dependencies: []
|
20
|
-
|
21
13
|
description:
|
22
14
|
email: ivpavig@gmail.com
|
23
15
|
executables: []
|
24
|
-
|
25
16
|
extensions: []
|
26
|
-
|
27
17
|
extra_rdoc_files: []
|
28
|
-
|
29
|
-
files:
|
18
|
+
files:
|
30
19
|
- lib/corosync-ruby.rb
|
31
20
|
- lib/corosync-ruby/resource.rb
|
32
21
|
- lib/corosync-ruby/cluster.rb
|
33
|
-
homepage:
|
22
|
+
homepage: https://github.com/schfkt/corosync-ruby
|
34
23
|
licenses: []
|
35
|
-
|
24
|
+
metadata: {}
|
36
25
|
post_install_message:
|
37
26
|
rdoc_options: []
|
38
|
-
|
39
|
-
require_paths:
|
27
|
+
require_paths:
|
40
28
|
- lib
|
41
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
none: false
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
hash: 3
|
56
|
-
segments:
|
57
|
-
- 0
|
58
|
-
version: "0"
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
59
39
|
requirements: []
|
60
|
-
|
61
40
|
rubyforge_project:
|
62
|
-
rubygems_version:
|
41
|
+
rubygems_version: 2.0.14.1
|
63
42
|
signing_key:
|
64
|
-
specification_version:
|
43
|
+
specification_version: 4
|
65
44
|
summary: A simple wrapper for corosync cmd tool 'crm'
|
66
45
|
test_files: []
|
67
|
-
|