riak-client 1.4.5 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Gemfile +0 -1
  4. data/{LICENSE → LICENSE.md} +0 -0
  5. data/README.markdown +211 -66
  6. data/RELEASE_NOTES.md +22 -47
  7. data/Rakefile +45 -0
  8. data/lib/riak.rb +1 -1
  9. data/lib/riak/bucket.rb +2 -2
  10. data/lib/riak/client.rb +22 -195
  11. data/lib/riak/client/beefcake/crdt_loader.rb +127 -0
  12. data/lib/riak/client/beefcake/crdt_operator.rb +222 -0
  13. data/lib/riak/client/beefcake/footer +4 -0
  14. data/lib/riak/client/beefcake/header +6 -0
  15. data/lib/riak/client/beefcake/message_codes.rb +29 -0
  16. data/lib/riak/client/beefcake/message_overlay.rb +61 -0
  17. data/lib/riak/client/beefcake/messages.rb +733 -371
  18. data/lib/riak/client/beefcake/object_methods.rb +1 -1
  19. data/lib/riak/client/beefcake/protocol.rb +105 -0
  20. data/lib/riak/client/beefcake/socket.rb +243 -0
  21. data/lib/riak/client/beefcake_protobuffs_backend.rb +262 -122
  22. data/lib/riak/client/node.rb +4 -75
  23. data/lib/riak/client/protobuffs_backend.rb +6 -14
  24. data/lib/riak/client/search.rb +0 -64
  25. data/lib/riak/client/yokozuna.rb +52 -0
  26. data/lib/riak/counter.rb +1 -1
  27. data/lib/riak/crdt.rb +21 -0
  28. data/lib/riak/crdt/base.rb +97 -0
  29. data/lib/riak/crdt/batch_counter.rb +19 -0
  30. data/lib/riak/crdt/batch_map.rb +41 -0
  31. data/lib/riak/crdt/counter.rb +71 -0
  32. data/lib/riak/crdt/inner_counter.rb +74 -0
  33. data/lib/riak/crdt/inner_flag.rb +42 -0
  34. data/lib/riak/crdt/inner_map.rb +53 -0
  35. data/lib/riak/crdt/inner_register.rb +26 -0
  36. data/lib/riak/crdt/inner_set.rb +95 -0
  37. data/lib/riak/crdt/map.rb +88 -0
  38. data/lib/riak/crdt/operation.rb +19 -0
  39. data/lib/riak/crdt/set.rb +156 -0
  40. data/lib/riak/crdt/typed_collection.rb +131 -0
  41. data/lib/riak/errors/base.rb +9 -0
  42. data/lib/riak/errors/connection_error.rb +44 -0
  43. data/lib/riak/errors/crdt_error.rb +18 -0
  44. data/lib/riak/errors/failed_request.rb +56 -0
  45. data/lib/riak/errors/protobuffs_error.rb +11 -0
  46. data/lib/riak/i18n.rb +2 -0
  47. data/lib/riak/json.rb +1 -1
  48. data/lib/riak/locale/en.yml +26 -1
  49. data/lib/riak/locale/fr.yml +0 -1
  50. data/lib/riak/map_reduce.rb +1 -1
  51. data/lib/riak/map_reduce/results.rb +1 -1
  52. data/lib/riak/multiget.rb +1 -2
  53. data/lib/riak/rcontent.rb +8 -3
  54. data/lib/riak/robject.rb +2 -8
  55. data/lib/riak/secondary_index.rb +4 -4
  56. data/lib/riak/serializers.rb +1 -1
  57. data/lib/riak/util/escape.rb +3 -5
  58. data/lib/riak/version.rb +1 -1
  59. data/lib/riak/walk_spec.rb +7 -3
  60. data/riak-client.gemspec +10 -8
  61. data/spec/fixtures/bitcask.txt +25 -0
  62. data/spec/integration/riak/bucket_types_spec.rb +61 -0
  63. data/spec/integration/riak/counters_spec.rb +17 -32
  64. data/spec/integration/riak/crdt_spec.rb +181 -0
  65. data/spec/integration/riak/crdt_validation/map_spec.rb +63 -0
  66. data/spec/integration/riak/crdt_validation/set_spec.rb +122 -0
  67. data/spec/integration/riak/protobuffs_backends_spec.rb +9 -26
  68. data/spec/integration/riak/security_spec.rb +94 -0
  69. data/spec/integration/riak/threading_spec.rb +24 -67
  70. data/spec/integration/yokozuna/index_spec.rb +61 -0
  71. data/spec/integration/yokozuna/queries_spec.rb +116 -0
  72. data/spec/integration/yokozuna/schema_spec.rb +49 -0
  73. data/spec/riak/beefcake_protobuffs_backend/crdt_operator_spec.rb +222 -0
  74. data/spec/riak/beefcake_protobuffs_backend/object_methods_spec.rb +4 -4
  75. data/spec/riak/beefcake_protobuffs_backend/protocol_spec.rb +189 -0
  76. data/spec/riak/beefcake_protobuffs_backend/socket_spec.rb +151 -0
  77. data/spec/riak/beefcake_protobuffs_backend_spec.rb +68 -106
  78. data/spec/riak/bucket_spec.rb +81 -77
  79. data/spec/riak/client_spec.rb +43 -340
  80. data/spec/riak/core_ext/to_param_spec.rb +2 -2
  81. data/spec/riak/counter_spec.rb +20 -20
  82. data/spec/riak/crdt/counter_spec.rb +52 -0
  83. data/spec/riak/crdt/inner_counter_spec.rb +21 -0
  84. data/spec/riak/crdt/inner_flag_spec.rb +39 -0
  85. data/spec/riak/crdt/inner_map_spec.rb +47 -0
  86. data/spec/riak/crdt/inner_register_spec.rb +40 -0
  87. data/spec/riak/crdt/inner_set_spec.rb +33 -0
  88. data/spec/riak/crdt/map_spec.rb +77 -0
  89. data/spec/riak/crdt/set_spec.rb +58 -0
  90. data/spec/riak/crdt/shared_examples.rb +74 -0
  91. data/spec/riak/crdt/typed_collection_spec.rb +231 -0
  92. data/spec/riak/escape_spec.rb +33 -37
  93. data/spec/riak/feature_detection_spec.rb +45 -45
  94. data/spec/riak/index_collection_spec.rb +12 -12
  95. data/spec/riak/link_spec.rb +34 -34
  96. data/spec/riak/list_buckets_spec.rb +7 -7
  97. data/spec/riak/map_reduce/filter_builder_spec.rb +6 -6
  98. data/spec/riak/map_reduce/phase_spec.rb +35 -35
  99. data/spec/riak/map_reduce_spec.rb +89 -87
  100. data/spec/riak/multiget_spec.rb +20 -15
  101. data/spec/riak/node_spec.rb +5 -152
  102. data/spec/riak/robject_spec.rb +95 -108
  103. data/spec/riak/search_spec.rb +17 -139
  104. data/spec/riak/secondary_index_spec.rb +49 -49
  105. data/spec/riak/serializers_spec.rb +9 -9
  106. data/spec/riak/stamp_spec.rb +9 -9
  107. data/spec/riak/walk_spec_spec.rb +46 -46
  108. data/spec/spec_helper.rb +14 -22
  109. data/spec/support/certs/README.md +13 -0
  110. data/spec/support/certs/ca.crt +22 -0
  111. data/spec/support/certs/client.crt +95 -0
  112. data/spec/support/certs/client.key +27 -0
  113. data/spec/support/certs/empty_ca.crt +21 -0
  114. data/spec/support/certs/server.crl +13 -0
  115. data/spec/support/certs/server.crt +95 -0
  116. data/spec/support/certs/server.key +27 -0
  117. data/spec/support/integration_setup.rb +1 -1
  118. data/spec/support/search_corpus_setup.rb +29 -8
  119. data/spec/support/test_client.rb +46 -0
  120. data/spec/support/test_client.yml.example +10 -0
  121. data/spec/support/unified_backend_examples.rb +104 -83
  122. data/spec/support/version_filter.rb +2 -2
  123. data/spec/support/wait_until.rb +14 -0
  124. metadata +134 -132
  125. data/erl_src/riak_kv_test014_backend.beam +0 -0
  126. data/erl_src/riak_kv_test014_backend.erl +0 -189
  127. data/erl_src/riak_kv_test_backend.beam +0 -0
  128. data/erl_src/riak_kv_test_backend.erl +0 -731
  129. data/erl_src/riak_search_test_backend.beam +0 -0
  130. data/erl_src/riak_search_test_backend.erl +0 -175
  131. data/lib/riak/client/excon_backend.rb +0 -172
  132. data/lib/riak/client/http_backend.rb +0 -413
  133. data/lib/riak/client/http_backend/bucket_streamer.rb +0 -15
  134. data/lib/riak/client/http_backend/chunked_json_streamer.rb +0 -42
  135. data/lib/riak/client/http_backend/configuration.rb +0 -227
  136. data/lib/riak/client/http_backend/key_streamer.rb +0 -15
  137. data/lib/riak/client/http_backend/object_methods.rb +0 -114
  138. data/lib/riak/client/http_backend/request_headers.rb +0 -34
  139. data/lib/riak/client/http_backend/transport_methods.rb +0 -201
  140. data/lib/riak/client/instrumentation.rb +0 -25
  141. data/lib/riak/client/net_http_backend.rb +0 -82
  142. data/lib/riak/cluster.rb +0 -151
  143. data/lib/riak/failed_request.rb +0 -81
  144. data/lib/riak/instrumentation.rb +0 -6
  145. data/lib/riak/node.rb +0 -40
  146. data/lib/riak/node/configuration.rb +0 -304
  147. data/lib/riak/node/console.rb +0 -133
  148. data/lib/riak/node/control.rb +0 -207
  149. data/lib/riak/node/defaults.rb +0 -85
  150. data/lib/riak/node/generation.rb +0 -127
  151. data/lib/riak/node/log.rb +0 -34
  152. data/lib/riak/node/version.rb +0 -29
  153. data/lib/riak/search.rb +0 -3
  154. data/lib/riak/test_server.rb +0 -89
  155. data/lib/riak/util/headers.rb +0 -32
  156. data/lib/riak/util/multipart.rb +0 -52
  157. data/lib/riak/util/multipart/stream_parser.rb +0 -62
  158. data/spec/fixtures/munchausen.txt +0 -1033
  159. data/spec/integration/riak/cluster_spec.rb +0 -88
  160. data/spec/integration/riak/http_backends_spec.rb +0 -180
  161. data/spec/integration/riak/node_spec.rb +0 -170
  162. data/spec/integration/riak/test_server_spec.rb +0 -57
  163. data/spec/riak/excon_backend_spec.rb +0 -102
  164. data/spec/riak/headers_spec.rb +0 -21
  165. data/spec/riak/http_backend/configuration_spec.rb +0 -273
  166. data/spec/riak/http_backend/object_methods_spec.rb +0 -243
  167. data/spec/riak/http_backend/transport_methods_spec.rb +0 -97
  168. data/spec/riak/http_backend_spec.rb +0 -367
  169. data/spec/riak/instrumentation_spec.rb +0 -167
  170. data/spec/riak/multipart_spec.rb +0 -23
  171. data/spec/riak/net_http_backend_spec.rb +0 -15
  172. data/spec/riak/stream_parser_spec.rb +0 -53
  173. data/spec/support/drb_mock_server.rb +0 -39
  174. data/spec/support/http_backend_implementation_examples.rb +0 -253
  175. data/spec/support/mock_server.rb +0 -81
  176. data/spec/support/mocks.rb +0 -4
  177. data/spec/support/riak_test.rb +0 -77
  178. data/spec/support/sometimes.rb +0 -46
  179. data/spec/support/test_server.rb +0 -61
  180. data/spec/support/test_server.yml.example +0 -14
@@ -1,207 +0,0 @@
1
- require 'riak/node/console'
2
- require 'riak/util/tcp_socket_extensions'
3
-
4
- module Riak
5
- class Node
6
- # Regexp for parsing riak-admin status output. Takes into account
7
- # the minor bug fixed by {https://github.com/basho/riak_kv/pull/134}
8
- # and multiline output used when lists of things grow long.
9
- STATS_REGEXP = /^([^:\n]+)\s:\s((?:.*)(?:\n\s+[^\n]+)*)/
10
-
11
- # Is the node running?
12
- # @return [true, false] If the node is running
13
- def started?
14
- pinged = ping
15
- pinged.strip =~ /pong/ || pinged.strip !~ /Node '[^']+' not responding to pings/
16
- end
17
-
18
- # Is the node stopped? (opposite of {#started?}).
19
- # @return [true, false] If the node is stopped
20
- # @see #started?
21
- def stopped?
22
- !started?
23
- end
24
-
25
- # Starts the node.
26
- # @return [String] the output of the 'riak start' command
27
- def start
28
- res = riak 'start'
29
- wait_for_startup
30
- res
31
- end
32
-
33
- # Stops the node
34
- # @return [String] the output of the 'riak stop' command
35
- def stop
36
- res = riak 'stop'
37
- wait_for_shutdown
38
- res
39
- end
40
-
41
- # Restarts the node
42
- # @return [String] the output of the 'riak restart' command
43
- def restart
44
- riak 'restart'
45
- end
46
-
47
- # Reboots the node
48
- # @return [String] the output of the 'riak reboot' command
49
- def restart
50
- riak 'reboot'
51
- end
52
-
53
- # Pings the node
54
- # @return [String] the output of the 'riak ping' command
55
- def ping
56
- begin
57
- riak 'ping'
58
- rescue SystemCallError
59
- # If the control script doesn't exist or has the wrong
60
- # permissions, we should still return something sane so we can
61
- # do the right thing.
62
- "Node '#{name}' not responding to pings."
63
- end
64
- end
65
-
66
- # Attach to the node's console via the pipe.
67
- # @return [Riak::Node::Console] A console manager for sending
68
- # commands to the Riak node
69
- # @see #with_console
70
- def attach
71
- Console.open self
72
- end
73
-
74
- # Execute the block against the Riak node's console.
75
- # @yield [console] A block of commands to be run against the console
76
- # @yieldparam [Riak::Node::Console] console A console manager for
77
- # sending commands to the Riak node
78
- def with_console
79
- begin
80
- console = attach
81
- yield console
82
- ensure
83
- console.close if console
84
- end
85
- end
86
-
87
- # Joins the node to another node to create a cluster.
88
- # @return [String] the output of the 'riak-admin join' command
89
- def join(node)
90
- node = node.name if Node === node
91
- riak_admin 'join', node
92
- end
93
-
94
- # Removes this node from its current cluster, handing off all data.
95
- # @return [String] the output of the 'riak-admin leave' command
96
- def leave
97
- riak_admin 'leave'
98
- end
99
-
100
- # Forcibly removes a node from the current cluster without
101
- # invoking handoff.
102
- # @return [String] the output of the 'riak-admin remove <node>'
103
- # command
104
- def remove(node)
105
- node = node.name if Node === node
106
- riak_admin 'remove', node
107
- end
108
-
109
- # Captures the status of the node.
110
- # @return [Hash] a collection of information about the node
111
- def status
112
- output = riak_admin 'status'
113
- if $?.success?
114
- result = {}
115
- Hash[output.scan(STATS_REGEXP)]
116
- end
117
- end
118
-
119
- # Detects whether the node's cluster has converged on the ring.
120
- # @return [true,false] whether the ring is stable
121
- def ringready?
122
- output = riak_admin 'ringready'
123
- output =~ /^TRUE/ || $?.success?
124
- end
125
-
126
- # Lists riak_core applications that have registered as available,
127
- # e.g. ["riak_kv", "riak_search", "riak_pipe"]
128
- # @return [Array<String>] a list of running services
129
- def services
130
- output = riak_admin 'services'
131
- if $?.success?
132
- output.strip.match(/^\[(.*)\]$/)[1].split(/,/)
133
- else
134
- []
135
- end
136
- end
137
-
138
- # Forces the node to restart/reload its JavaScript VMs,
139
- # effectively reloading any user-provided code.
140
- def js_reload
141
- riak_admin 'js_reload'
142
- end
143
-
144
- # Provides the status of members of the ring.
145
- # @return [Hash] a collection of stats about ring members
146
- def member_status
147
- output = riak_admin 'member_status'
148
- result = {}
149
- if $?.success?
150
- output.each_line do |line|
151
- next if line =~ /^(?:[=-]|Status)+/ # Skip the pretty headers
152
- if line =~ %r{^Valid:(\d+) / Leaving:(\d+) / Exiting:(\d+) / Joining:(\d+) / Down:(\d+)}
153
- result.merge!(:valid => $1.to_i,
154
- :leaving => $2.to_i,
155
- :exiting => $3.to_i,
156
- :joining => $4.to_i,
157
- :down => $5.to_i)
158
- else
159
- result[:members] ||= {}
160
- status, ring, pending, node = line.split(/\s+/)
161
- node = $1 if node =~ /^'(.*)'$/
162
- ring = $1.to_f if ring =~ /(\d+\.\d+)%/
163
- result[:members][node] = {
164
- :status => status,
165
- :ring => ring,
166
- :pending => (pending == '--') ? 0 : pending.to_i
167
- }
168
- end
169
- end
170
- end
171
- result
172
- end
173
-
174
- # @return [Array<String>] a list of node names that are also
175
- # members of this node's cluster, and empty list if the
176
- # {#member_status} fails or no other nodes are present
177
- def peers
178
- all_nodes = member_status[:members] && member_status[:members].keys.reject {|n| n == name }
179
- all_nodes || []
180
- end
181
-
182
- protected
183
- # Runs a command using the 'riak' control script.
184
- def riak(*commands)
185
- `#{control_script} #{commands.join(' ')} 2>&1`
186
- end
187
-
188
- # Runs a command using the 'riak-admin' script.
189
- def riak_admin(*commands)
190
- `#{admin_script} #{commands.join(' ')} 2>&1`
191
- end
192
-
193
- # Waits for the HTTP port to become available, which is a better
194
- # indication of readiness than the start script finishing.
195
- def wait_for_startup
196
- TCPSocket.wait_for_service_with_timeout(:host => http_ip,
197
- :port => http_port,
198
- :timeout => 10)
199
- end
200
-
201
- def wait_for_shutdown
202
- TCPSocket.wait_for_service_termination_with_timeout(:host => http_ip,
203
- :port => http_port,
204
- :timeout => 10)
205
- end
206
- end
207
- end
@@ -1,85 +0,0 @@
1
- require 'riak/core_ext/deep_dup'
2
-
3
- module Riak
4
- class Node
5
- # Settings based on Riak 1.1.
6
- ENV_DEFAULTS = {
7
- :riak_api => {
8
- },
9
- :riak_core => {
10
- :ring_creation_size => 64
11
- },
12
- :riak_kv => {
13
- :storage_backend => :riak_kv_bitcask_backend,
14
- :map_js_vm_count => 8,
15
- :reduce_js_vm_count => 6,
16
- :hook_js_vm_count => 2,
17
- :mapper_batch_size => 5,
18
- :js_max_vm_mem => 8,
19
- :js_thread_stack => 16,
20
- :riak_kv_stat => true,
21
- :legacy_stats => true,
22
- :vnode_vclocks => true,
23
- :http_url_encoding => :on,
24
- :legacy_keylisting => false,
25
- :mapred_system => :pipe,
26
- :mapred_2i_pipe => true,
27
- :listkeys_backpressure => true,
28
- :add_paths => []
29
- },
30
- :riak_search => {
31
- :enabled => true
32
- },
33
- :luwak => {
34
- :enabled => true
35
- },
36
- :merge_index => {
37
- :buffer_rollover_size => 1048576,
38
- :max_compact_segments => 20
39
- },
40
- :eleveldb => {},
41
- :bitcask => {},
42
- :lager => {
43
- :crash_log_size => 10485760,
44
- :crash_log_msg_size => 65536,
45
- :crash_log_date => "$D0",
46
- :crash_log_count => 5,
47
- :error_logger_redirect => true
48
- },
49
- :riak_sysmon => {
50
- :process_limit => 30,
51
- :port_limit => 30,
52
- :gc_ms_limit => 100,
53
- :heap_word_limit => 40111000,
54
- :busy_port => true,
55
- :busy_dist_port => true
56
- },
57
- :sasl => {
58
- :sasl_error_logger => false
59
- },
60
- :riak_control => {
61
- :enabled => false,
62
- :auth => :userlist,
63
- :userlist => {"user" => "pass"},
64
- :admin => true
65
- }
66
- }.freeze
67
-
68
- # Based on Riak 1.1.
69
- VM_DEFAULTS = {
70
- "+K" => true,
71
- "+A" => 64,
72
- "-smp" => "enable",
73
- "+W" => "w",
74
- "-env ERL_MAX_PORTS" => 4096,
75
- "-env ERL_FULLSWEEP_AFTER" => 0
76
- }.freeze
77
-
78
- protected
79
- # Populates the defaults
80
- def set_defaults
81
- @env = ENV_DEFAULTS.deep_dup
82
- @vm = VM_DEFAULTS.deep_dup
83
- end
84
- end
85
- end
@@ -1,127 +0,0 @@
1
- require 'yaml'
2
-
3
- module Riak
4
- class Node
5
- # Does the node exist on disk?
6
- def exist?
7
- manifest.exist?
8
- end
9
-
10
- # Deletes the node and regenerates it.
11
- def recreate
12
- delete
13
- create
14
- end
15
-
16
- # Generates the node.
17
- def create
18
- unless exist?
19
- touch_ssl_distribution_args
20
- copy_directories
21
- write_scripts
22
- write_vm_args
23
- write_app_config
24
- write_manifest
25
- end
26
- end
27
-
28
- # Clears data from known data directories. Stops the node if it is
29
- # running.
30
- def drop
31
- was_started = started?
32
- stop if was_started
33
- data.children.each do |item|
34
- if item.directory?
35
- item.children.each {|c| c.rmtree }
36
- else
37
- item.delete
38
- end
39
- end
40
- start if was_started
41
- end
42
-
43
- # Removes the node from disk and freezes the object.
44
- def destroy
45
- delete
46
- freeze
47
- end
48
-
49
- protected
50
- def delete
51
- stop unless stopped?
52
- root.rmtree if root.exist?
53
- end
54
-
55
- def copy_directories
56
- root.mkpath
57
- raise 'Source is not a directory!' unless base_dir.directory?
58
-
59
- base_dir.each_child do |dir|
60
- basename = dir.basename.to_s
61
- next if NODE_DIR_SKIP_LIST.include? basename.to_sym
62
- target = Pathname.new("#{root.to_s}")
63
- target.mkpath
64
- FileUtils.cp_r(dir.to_s,target)
65
- end
66
- end
67
-
68
- def write_vm_args
69
- (etc + 'vm.args').open('w') do |f|
70
- vm.each do |k,v|
71
- f.puts "#{k} #{v}"
72
- end
73
- end
74
- end
75
-
76
- def write_app_config
77
- (etc + 'app.config').open('w') do |f|
78
- f.write to_erlang_config(env) + '.'
79
- end
80
- end
81
-
82
- def write_scripts
83
- if version >= '1.4.0'
84
- [env_script].each {|s| write_script(s) }
85
- else
86
- [control_script, admin_script].each {|s| write_script(s) }
87
- end
88
- end
89
-
90
- def write_script(target)
91
- source_script = source.parent + target.relative_path_from(target.parent.parent)
92
- target.open('wb') do |f|
93
- source_script.readlines.each do |line|
94
- line.sub!(/(RUNNER_SCRIPT_DIR=)(.*)/, '\1' + bin.to_s)
95
- line.sub!(/(RUNNER_ETC_DIR=)(.*)/, '\1' + etc.to_s)
96
- line.sub!(/(RUNNER_USER=)(.*)/, '\1')
97
- line.sub!(/(RUNNER_LOG_DIR=)(.*)/, '\1' + log.to_s)
98
- line.sub!(/(PIPE_DIR=)(.*)/, '\1' + pipe.to_s)
99
- line.sub!(/(PLATFORM_DATA_DIR=)(.*)/, '\1' + data.to_s)
100
- line.sub!('grep "$RUNNER_BASE_DIR/.*/[b]eam"', 'grep "$RUNNER_ETC_DIR/app.config"')
101
- if line.strip == "RUNNER_BASE_DIR=${RUNNER_SCRIPT_DIR%/*}"
102
- line = "RUNNER_BASE_DIR=#{source.parent.to_s}\n"
103
- end
104
- f.write line
105
- end
106
- end
107
- target.chmod 0755
108
- end
109
-
110
- def write_manifest
111
- # TODO: For now this only saves the information that was used when
112
- # configuring the node. Later we'll verify/warn if the settings
113
- # used differ on subsequent generations.
114
- @configuration[:env] = @env
115
- @configuration[:vm] = @vm
116
- manifest.open('w') {|f| YAML.dump(@configuration, f) }
117
- end
118
-
119
- def touch_ssl_distribution_args
120
- # To make sure that the ssl_distribution.args file is present,
121
- # the control script in the source node has to have been run at
122
- # least once. Running the `chkconfig` command is innocuous
123
- # enough to accomplish this without other side-effects.
124
- `#{(source + control_script.basename).to_s} chkconfig`
125
- end
126
- end
127
- end
@@ -1,34 +0,0 @@
1
- module Riak
2
- class Node
3
- LAGER_LEVELS = [
4
- :debug,
5
- :info,
6
- :notice,
7
- :warning,
8
- :error,
9
- :critical,
10
- :alert,
11
- :emergency
12
- ]
13
-
14
- def read_console_log(*levels)
15
- console_log = log + 'console.log'
16
- if console_log.exist?
17
- levels = levels.map { |level| expand_log_level(level) }.compact.flatten
18
- pattern = /(#{levels.map { |level| "\\[#{level}\\]" }.join("|")})/
19
- console_log.readlines.grep(pattern)
20
- end
21
- end
22
-
23
- def expand_log_level(level)
24
- case level
25
- when Range
26
- first = LAGER_LEVELS.index(level.begin.to_sym) || 0
27
- last = LAGER_LEVELS.index(level.end.to_sym) || -1
28
- LAGER_LEVELS[first..last]
29
- when Symbol
30
- level
31
- end
32
- end
33
- end
34
- end