rboss 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +2 -2
- data/bin/jboss-profile +1 -1
- data/bin/rboss-cli +8 -2
- data/bin/twiddle +3 -3
- data/lib/rboss.rb +6 -2
- data/lib/rboss/bin/command_actions.rb +3 -2
- data/lib/rboss/cli/jboss_cli.rb +3 -3
- data/lib/rboss/cli/mappings.rb +12 -2
- data/lib/rboss/cli/mappings/resources/connector.yaml +10 -35
- data/lib/rboss/cli/mappings/resources/datasource.yaml +19 -26
- data/lib/rboss/cli/mappings/resources/jdbc_driver.yaml +0 -1
- data/lib/rboss/cli/mappings/resources/server.yaml +151 -34
- data/lib/rboss/cli/resource.rb +18 -10
- data/lib/rboss/component_processor.rb +87 -85
- data/lib/rboss/components/component.rb +2 -2
- data/lib/rboss/components/datasource.rb +1 -1
- data/lib/rboss/components/deploy_folder.rb +1 -1
- data/lib/rboss/components/hypersonic_replacer.rb +1 -1
- data/lib/rboss/components/jbossweb.rb +1 -1
- data/lib/rboss/components/jmx.rb +1 -1
- data/lib/rboss/components/mod_cluster.rb +1 -1
- data/lib/rboss/components/org/6.0/deploy_folder.rb +1 -1
- data/lib/rboss/components/org/jmx.rb +1 -1
- data/lib/rboss/components/profile_folder.rb +1 -1
- data/lib/rboss/components/resource.rb +1 -1
- data/lib/rboss/components/restore_slimming.rb +3 -3
- data/lib/rboss/components/run_conf.rb +4 -4
- data/lib/rboss/components/service_script.rb +1 -1
- data/lib/rboss/components/slimming.rb +1 -1
- data/lib/rboss/components/soa-p/hypersonic_replacer.rb +1 -1
- data/lib/rboss/components/soa-p/jmx.rb +1 -1
- data/lib/rboss/components/xadatasource.rb +2 -2
- data/lib/rboss/file_processor.rb +70 -66
- data/lib/rboss/jboss_path.rb +1 -1
- data/lib/rboss/jboss_profile.rb +28 -27
- data/lib/rboss/plaftorm.rb +64 -0
- data/lib/rboss/resources/run.conf.bat.erb +60 -0
- data/lib/rboss/twiddle/base_monitor.rb +2 -2
- data/lib/rboss/twiddle/mbean.rb +1 -1
- data/lib/rboss/twiddle/monitor.rb +26 -39
- data/lib/rboss/twiddle/twiddle.rb +3 -2
- data/lib/rboss/utils.rb +0 -62
- data/lib/rboss/version.rb +1 -1
- data/lib/rboss/view/colorizers.rb +20 -0
- data/lib/rboss/view/formatters.rb +21 -0
- data/lib/rboss/view/health_checkers.rb +41 -0
- data/lib/rboss/view/table_builder.rb +93 -0
- data/test/test_helper.rb +1 -1
- metadata +8 -6
- data/lib/rboss/cli.rb +0 -22
- data/lib/rboss/cli/colorizers.rb +0 -22
- data/lib/rboss/cli/formatters.rb +0 -17
- data/lib/rboss/cli/health_checkers.rb +0 -43
data/lib/rboss/cli/resource.rb
CHANGED
@@ -20,11 +20,7 @@
|
|
20
20
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
21
|
# THE SOFTWARE.
|
22
22
|
|
23
|
-
|
24
|
-
require_relative 'colorizers'
|
25
|
-
require_relative 'health_checkers'
|
26
|
-
|
27
|
-
module JBoss
|
23
|
+
module RBoss
|
28
24
|
module Cli
|
29
25
|
class Resource
|
30
26
|
|
@@ -32,7 +28,8 @@ module JBoss
|
|
32
28
|
@config = config
|
33
29
|
@invoker = invoker
|
34
30
|
@context = {
|
35
|
-
:name => ''
|
31
|
+
:name => '',
|
32
|
+
:read_resource => 'read-resource(include-runtime=true)'
|
36
33
|
}
|
37
34
|
@context[:path] = parse(@config[:path])
|
38
35
|
@tables = []
|
@@ -40,13 +37,13 @@ module JBoss
|
|
40
37
|
end
|
41
38
|
|
42
39
|
def content(resources)
|
43
|
-
if :all == resources
|
40
|
+
if :all == resources and scannable?
|
44
41
|
resources = scan
|
45
42
|
end
|
46
43
|
resources = [resources] unless resources.is_a? Array
|
47
44
|
params = @config[:print]
|
48
45
|
params.each do |p|
|
49
|
-
table_builder = TableBuilder::new p
|
46
|
+
table_builder = RBoss::TableBuilder::new p
|
50
47
|
table_builder.add_name_column if scannable?
|
51
48
|
@tables << table_builder.build_table
|
52
49
|
end
|
@@ -61,6 +58,7 @@ module JBoss
|
|
61
58
|
result = ""
|
62
59
|
@tables.each do |table|
|
63
60
|
result << table.to_s
|
61
|
+
result << $/
|
64
62
|
end
|
65
63
|
result
|
66
64
|
end
|
@@ -93,17 +91,27 @@ module JBoss
|
|
93
91
|
end
|
94
92
|
|
95
93
|
def get_data(config)
|
96
|
-
|
94
|
+
command = (config[:command] or '${PATH}:${READ_RESOURCE}')
|
95
|
+
result = @invoker.execute(parse command)
|
97
96
|
result = eval_result(result)
|
98
97
|
data = []
|
99
98
|
config[:properties].each do |prop|
|
100
|
-
data << result
|
99
|
+
data << get_property(prop, result)
|
101
100
|
end
|
102
101
|
data
|
103
102
|
end
|
104
103
|
|
104
|
+
def get_property(prop, result)
|
105
|
+
value = result["result"]
|
106
|
+
prop.split(/\s*->\s*/).each do |p|
|
107
|
+
value = value[p]
|
108
|
+
end
|
109
|
+
value
|
110
|
+
end
|
111
|
+
|
105
112
|
def eval_result(result)
|
106
113
|
undefined = nil #prevents error because undefined means nil in result object
|
114
|
+
result = result.gsub /(\d+)L/, '\1' #removes the long type mark
|
107
115
|
eval(result)
|
108
116
|
end
|
109
117
|
|
@@ -67,111 +67,113 @@
|
|
67
67
|
# it will be passed to the block for processing.
|
68
68
|
#
|
69
69
|
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
70
|
-
|
70
|
+
module RBoss
|
71
|
+
class ComponentProcessor
|
71
72
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
def initialize &block
|
74
|
+
@process = block
|
75
|
+
@process ||= lambda { |type, config| type.new(config).process }
|
76
|
+
end
|
76
77
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
78
|
+
# Register a component using the given id (which must be used for adding it to process) and parameters
|
79
|
+
def register component_id, params
|
80
|
+
params = {
|
81
|
+
:type => nil,
|
82
|
+
:multiple_instances => false,
|
83
|
+
:priority => 0,
|
84
|
+
:enabled => false,
|
85
|
+
:defaults => {}
|
86
|
+
}.merge! params
|
87
|
+
@components ||= {}
|
88
|
+
params[:configs] ||= [] if params[:multiple_instances]
|
89
|
+
@components[component_id] = params unless @components.has_key? component_id
|
90
|
+
end
|
90
91
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
92
|
+
def add component_id, config = {}
|
93
|
+
registered_component = @components[component_id]
|
94
|
+
return unless registered_component
|
95
|
+
defaults = registered_component[:defaults]
|
96
|
+
registered_component[:enabled] = true
|
97
|
+
config = defaults.merge config if config.is_a? Hash
|
98
|
+
if registered_component[:multiple_instances]
|
99
|
+
registered_component[:configs] << config
|
100
|
+
else
|
101
|
+
registered_component[:config] = config
|
102
|
+
end
|
103
|
+
propagate_configs registered_component
|
101
104
|
end
|
102
|
-
propagate_configs registered_component
|
103
|
-
end
|
104
105
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
106
|
+
def defaults component_id, defaults
|
107
|
+
registered_component = @components[component_id]
|
108
|
+
registered_component[:defaults] = defaults if registered_component
|
109
|
+
end
|
109
110
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
111
|
+
def process_components
|
112
|
+
enabled_components = @components.find_all { |component_id, params| params[:enabled] }
|
113
|
+
(enabled_components.sort_by { |key, value| value[:priority] }).each do |key, component|
|
114
|
+
process_component component
|
115
|
+
end
|
114
116
|
end
|
115
|
-
end
|
116
117
|
|
117
|
-
|
118
|
+
private
|
118
119
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
def process_component component
|
121
|
+
return unless component[:type]
|
122
|
+
if component[:multiple_instances]
|
123
|
+
component[:configs].each do |config|
|
124
|
+
@process.call component[:type], config
|
125
|
+
end
|
126
|
+
else
|
127
|
+
config = component[:config]
|
128
|
+
config ||= component[:defaults]
|
123
129
|
@process.call component[:type], config
|
124
130
|
end
|
125
|
-
else
|
126
|
-
config = component[:config]
|
127
|
-
config ||= component[:defaults]
|
128
|
-
@process.call component[:type], config
|
129
131
|
end
|
130
|
-
end
|
131
132
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
133
|
+
def propagate_configs component
|
134
|
+
#TODO refactor this -----------------------------------
|
135
|
+
if component[:send_config] and component[:config].is_a? Hash
|
136
|
+
component[:send_config].each do |to, keys|
|
137
|
+
destination = to.to_s.gsub(/^to_/, '').to_sym
|
138
|
+
config = {}
|
139
|
+
if keys.is_a? Array
|
140
|
+
keys.each do |key|
|
141
|
+
config[key] = component[:config][key] if component[:config].has_key? key
|
142
|
+
end
|
143
|
+
elsif keys.is_a? Hash
|
144
|
+
keys.each do |k, v|
|
145
|
+
config[v] = component[:config][k] if component[:config].has_key? k
|
146
|
+
end
|
145
147
|
end
|
148
|
+
send_config destination, config
|
146
149
|
end
|
147
|
-
send_config destination, config
|
148
150
|
end
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
151
|
+
if component[:move_config] and component[:config].is_a? Hash
|
152
|
+
component[:move_config].each do |to, keys|
|
153
|
+
destination = to.to_s.gsub(/^to_/, '').to_sym
|
154
|
+
config = {}
|
155
|
+
if keys.is_a? Array
|
156
|
+
keys.each do |key|
|
157
|
+
config[key] = component[:config].delete key if component[:config].has_key? key
|
158
|
+
end
|
159
|
+
elsif keys.is_a? Hash
|
160
|
+
keys.each do |k, v|
|
161
|
+
config[v] = component[:config].delete k if component[:config].has_key? k
|
162
|
+
end
|
161
163
|
end
|
164
|
+
send_config destination, config, :enable_component => true
|
162
165
|
end
|
163
|
-
send_config destination, config, :enable_component => true
|
164
166
|
end
|
167
|
+
#------------------------------------------------------
|
165
168
|
end
|
166
|
-
#------------------------------------------------------
|
167
|
-
end
|
168
169
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
170
|
+
def send_config component_id, config, opts = {}
|
171
|
+
component = @components[component_id]
|
172
|
+
component[:defaults] ||= {}
|
173
|
+
component_config = @components[component_id][:defaults]
|
174
|
+
component_config.merge! config
|
175
|
+
component[:enabled] = true if opts[:enable_component]
|
176
|
+
end
|
176
177
|
|
178
|
+
end
|
177
179
|
end
|
@@ -26,7 +26,7 @@ require_relative "../utils"
|
|
26
26
|
|
27
27
|
require 'yaml'
|
28
28
|
|
29
|
-
module
|
29
|
+
module RBoss
|
30
30
|
|
31
31
|
# A base helper module for JBoss Components
|
32
32
|
#
|
@@ -47,7 +47,7 @@ module JBoss
|
|
47
47
|
# Creates a FileProcessor using the same logger and
|
48
48
|
# jboss path as the variable
|
49
49
|
def new_file_processor
|
50
|
-
FileProcessor::new :logger => @logger, :var => @jboss
|
50
|
+
RBoss::FileProcessor::new :logger => @logger, :var => @jboss
|
51
51
|
end
|
52
52
|
|
53
53
|
def load_yaml resource
|
data/lib/rboss/components/jmx.rb
CHANGED
@@ -22,15 +22,15 @@
|
|
22
22
|
|
23
23
|
require_relative 'slimming'
|
24
24
|
|
25
|
-
module
|
25
|
+
module RBoss
|
26
26
|
# A class for restore slimmed services in a JBoss profile
|
27
27
|
#
|
28
28
|
# Configuration:
|
29
29
|
#
|
30
|
-
# See the
|
30
|
+
# See the RBoss::Slimming class for supported services
|
31
31
|
#
|
32
32
|
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
33
|
-
class Restore <
|
33
|
+
class Restore < RBoss::Slimming
|
34
34
|
|
35
35
|
def log service
|
36
36
|
@logger.info "Enabling #{service}"
|
@@ -25,7 +25,7 @@ require_relative "component"
|
|
25
25
|
require 'yaml'
|
26
26
|
require 'erb'
|
27
27
|
|
28
|
-
module
|
28
|
+
module RBoss
|
29
29
|
# A class to create a custom run.conf file to a JBoss Profile
|
30
30
|
#
|
31
31
|
# The configuration is based on a erb template, variables and jvm args:
|
@@ -39,7 +39,7 @@ module JBoss
|
|
39
39
|
#
|
40
40
|
# author: Marcelo Guimarães <ataxexe@gmail.com>
|
41
41
|
class RunConf
|
42
|
-
include Component
|
42
|
+
include Component, RBoss::Platform
|
43
43
|
|
44
44
|
def defaults
|
45
45
|
{:jvm_args => []}
|
@@ -61,11 +61,11 @@ module JBoss
|
|
61
61
|
action.to_process do |content|
|
62
62
|
process_template content
|
63
63
|
end
|
64
|
-
processor.copy_to
|
64
|
+
processor.copy_to run_conf
|
65
65
|
end
|
66
66
|
processor.process
|
67
67
|
else
|
68
|
-
File.open(
|
68
|
+
File.open(run_conf, "w+") { |f| f.write process_template @template }
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|