drbqs 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. data/Gemfile +10 -7
  2. data/README.md +52 -11
  3. data/Rakefile +32 -10
  4. data/VERSION +1 -1
  5. data/bin/drbqs-manage +3 -93
  6. data/bin/drbqs-node +3 -89
  7. data/bin/drbqs-server +3 -117
  8. data/bin/drbqs-ssh +6 -0
  9. data/drbqs.gemspec +118 -97
  10. data/example/README.md +2 -2
  11. data/lib/drbqs/config/config.rb +88 -0
  12. data/lib/drbqs/config/process_list.rb +194 -0
  13. data/lib/drbqs/config/ssh_host.rb +41 -0
  14. data/lib/drbqs/{execute_node.rb → manage/execute_node.rb} +6 -4
  15. data/lib/drbqs/manage/manage.rb +100 -0
  16. data/lib/drbqs/manage/send_signal.rb +45 -0
  17. data/lib/drbqs/manage/ssh_execute.rb +23 -0
  18. data/lib/drbqs/manage/ssh_shell.rb +143 -0
  19. data/lib/drbqs/node/connection.rb +69 -0
  20. data/lib/drbqs/{client.rb → node/node.rb} +48 -18
  21. data/lib/drbqs/node/task_client.rb +94 -0
  22. data/lib/drbqs/server/acl_file.rb +15 -0
  23. data/lib/drbqs/server/check_alive.rb +23 -0
  24. data/lib/drbqs/server/history.rb +49 -0
  25. data/lib/drbqs/server/message.rb +142 -0
  26. data/lib/drbqs/server/node_list.rb +59 -0
  27. data/lib/drbqs/server/queue.rb +128 -0
  28. data/lib/drbqs/{server.rb → server/server.rb} +66 -74
  29. data/lib/drbqs/server/server_hook.rb +72 -0
  30. data/lib/drbqs/server/transfer_setting.rb +30 -0
  31. data/lib/drbqs/task/command_task.rb +43 -0
  32. data/lib/drbqs/{task.rb → task/task.rb} +18 -39
  33. data/lib/drbqs/{task_generator.rb → task/task_generator.rb} +2 -0
  34. data/lib/drbqs/utility/argument.rb +27 -0
  35. data/lib/drbqs/utility/command_line/command_base.rb +27 -0
  36. data/lib/drbqs/utility/command_line/command_manage.rb +121 -0
  37. data/lib/drbqs/utility/command_line/command_node.rb +103 -0
  38. data/lib/drbqs/utility/command_line/command_server.rb +165 -0
  39. data/lib/drbqs/utility/command_line/command_ssh.rb +126 -0
  40. data/lib/drbqs/utility/command_line.rb +15 -0
  41. data/lib/drbqs/utility/misc.rb +72 -0
  42. data/lib/drbqs/{server_define.rb → utility/server_define.rb} +23 -8
  43. data/lib/drbqs/utility/temporary.rb +49 -0
  44. data/lib/drbqs/{ssh/transfer.rb → utility/transfer/file_transfer.rb} +18 -58
  45. data/lib/drbqs/utility/transfer/transfer_client.rb +90 -0
  46. data/lib/drbqs.rb +10 -22
  47. data/spec/config/config_spec.rb +84 -0
  48. data/spec/config/process_list_spec.rb +149 -0
  49. data/spec/config/ssh_host_spec.rb +81 -0
  50. data/spec/integration_test/01_basic_usage_spec.rb +54 -0
  51. data/spec/integration_test/02_use_generator_spec.rb +53 -0
  52. data/spec/integration_test/03_use_temporary_file_spec.rb +26 -0
  53. data/spec/integration_test/04_use_unix_domain_spec.rb +34 -0
  54. data/spec/integration_test/05_server_exit_signal_spec.rb +23 -0
  55. data/spec/integration_test/06_node_exit_after_task_spec.rb +42 -0
  56. data/spec/integration_test/07_command_server_with_node_spec.rb +44 -0
  57. data/spec/integration_test/definition/server01.rb +20 -0
  58. data/spec/integration_test/definition/server02.rb +16 -0
  59. data/spec/integration_test/definition/task_obj_definition.rb +49 -0
  60. data/spec/manage/manage_spec.rb +33 -0
  61. data/spec/manage/send_signal_spec.rb +39 -0
  62. data/spec/{ssh_shell_spec.rb → manage/ssh_shell_spec.rb} +8 -8
  63. data/spec/node/connection_spec.rb +66 -0
  64. data/spec/node/task_client_spec.rb +212 -0
  65. data/spec/server/acl_file_spec.rb +9 -0
  66. data/spec/{server_check_alive_spec.rb → server/check_alive_spec.rb} +15 -11
  67. data/spec/{data → server/data}/acl.txt +0 -0
  68. data/spec/{history_spec.rb → server/history_spec.rb} +9 -5
  69. data/spec/server/message_spec.rb +195 -0
  70. data/spec/server/node_list_spec.rb +111 -0
  71. data/spec/server/queue_spec.rb +239 -0
  72. data/spec/{server_hook_spec.rb → server/server_hook_spec.rb} +23 -17
  73. data/spec/server/server_spec.rb +89 -0
  74. data/spec/server/transfer_setting_spec.rb +37 -0
  75. data/spec/spec_helper.rb +65 -0
  76. data/spec/task/file_transfer_spec.rb +107 -0
  77. data/spec/{task_generator_spec.rb → task/task_generator_spec.rb} +2 -2
  78. data/spec/{task_spec.rb → task/task_spec.rb} +3 -1
  79. data/spec/utility/argument_spec.rb +39 -0
  80. data/spec/utility/command_line/command_base_spec.rb +33 -0
  81. data/spec/utility/command_line/commands_spec.rb +15 -0
  82. data/spec/utility/misc_spec.rb +77 -0
  83. data/spec/utility/server_define_spec.rb +59 -0
  84. data/spec/utility/temporary_spec.rb +39 -0
  85. metadata +158 -93
  86. data/example/drbqs-manage-test.rb +0 -3
  87. data/example/drbqs-node-test.rb +0 -3
  88. data/example/drbqs-server-test.rb +0 -3
  89. data/lib/drbqs/acl_file.rb +0 -13
  90. data/lib/drbqs/config.rb +0 -98
  91. data/lib/drbqs/connection.rb +0 -67
  92. data/lib/drbqs/history.rb +0 -34
  93. data/lib/drbqs/manage.rb +0 -84
  94. data/lib/drbqs/message.rb +0 -119
  95. data/lib/drbqs/node_list.rb +0 -52
  96. data/lib/drbqs/queue.rb +0 -138
  97. data/lib/drbqs/server_hook.rb +0 -67
  98. data/lib/drbqs/ssh/host.rb +0 -26
  99. data/lib/drbqs/ssh/shell.rb +0 -139
  100. data/lib/drbqs/task_client.rb +0 -86
  101. data/lib/drbqs/utils.rb +0 -19
  102. data/spec/acl_file_spec.rb +0 -9
  103. data/spec/config_spec.rb +0 -14
  104. data/spec/connection_spec.rb +0 -49
  105. data/spec/manage_spec.rb +0 -57
  106. data/spec/message_spec.rb +0 -81
  107. data/spec/node_list_spec.rb +0 -68
  108. data/spec/queue_spec.rb +0 -59
  109. data/spec/server_define_spec.rb +0 -45
  110. data/spec/server_spec.rb +0 -56
  111. data/spec/task_client_spec.rb +0 -53
  112. data/spec/test/test1.rb +0 -13
  113. data/spec/test1_spec.rb +0 -80
  114. data/spec/test2_spec.rb +0 -69
  115. data/spec/transfer_spec.rb +0 -13
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: drbqs
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.13
5
+ version: 0.0.14
6
6
  platform: ruby
7
7
  authors:
8
8
  - Takayuki YAMAGUCHI
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-23 00:00:00 +09:00
13
+ date: 2011-07-19 00:00:00 +09:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -20,7 +20,7 @@ dependencies:
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 2.5.0
23
+ version: 2.6.0
24
24
  type: :development
25
25
  prerelease: false
26
26
  version_requirements: *id001
@@ -29,9 +29,9 @@ dependencies:
29
29
  requirement: &id002 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
- - - ~>
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 0.6.0
34
+ version: 0.7.2
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: *id002
@@ -40,9 +40,9 @@ dependencies:
40
40
  requirement: &id003 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ~>
43
+ - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 1.0.0
45
+ version: 1.0.15
46
46
  type: :development
47
47
  prerelease: false
48
48
  version_requirements: *id003
@@ -51,9 +51,9 @@ dependencies:
51
51
  requirement: &id004 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
- - - ~>
54
+ - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 1.5.2
56
+ version: 1.6.2
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: *id004
@@ -75,82 +75,138 @@ dependencies:
75
75
  requirements:
76
76
  - - ">="
77
77
  - !ruby/object:Gem::Version
78
- version: 0.0.5
78
+ version: 0.1.0
79
79
  type: :development
80
80
  prerelease: false
81
81
  version_requirements: *id006
82
82
  - !ruby/object:Gem::Dependency
83
- name: net-ssh
83
+ name: user_config
84
84
  requirement: &id007 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 2.1.3
89
+ version: 0.0.1
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: *id007
93
93
  - !ruby/object:Gem::Dependency
94
- name: net-ssh-shell
94
+ name: net-ssh
95
95
  requirement: &id008 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ">="
99
99
  - !ruby/object:Gem::Version
100
- version: 0.1.0
100
+ version: 2.1.4
101
101
  type: :development
102
102
  prerelease: false
103
103
  version_requirements: *id008
104
104
  - !ruby/object:Gem::Dependency
105
- name: net-ssh
105
+ name: net-ssh-shell
106
106
  requirement: &id009 !ruby/object:Gem::Requirement
107
107
  none: false
108
108
  requirements:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
- version: 2.1.3
112
- type: :runtime
111
+ version: 0.2.0
112
+ type: :development
113
113
  prerelease: false
114
114
  version_requirements: *id009
115
115
  - !ruby/object:Gem::Dependency
116
- name: net-ssh-shell
116
+ name: net-sftp
117
117
  requirement: &id010 !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
120
120
  - - ">="
121
121
  - !ruby/object:Gem::Version
122
- version: 0.1.0
123
- type: :runtime
122
+ version: 2.0.5
123
+ type: :development
124
124
  prerelease: false
125
125
  version_requirements: *id010
126
126
  - !ruby/object:Gem::Dependency
127
- name: filename
127
+ name: sys-proctable
128
128
  requirement: &id011 !ruby/object:Gem::Requirement
129
129
  none: false
130
130
  requirements:
131
131
  - - ">="
132
132
  - !ruby/object:Gem::Version
133
- version: 0.0.5
134
- type: :runtime
133
+ version: "0"
134
+ type: :development
135
135
  prerelease: false
136
136
  version_requirements: *id011
137
137
  - !ruby/object:Gem::Dependency
138
- name: rspec
138
+ name: filename
139
139
  requirement: &id012 !ruby/object:Gem::Requirement
140
140
  none: false
141
141
  requirements:
142
142
  - - ">="
143
143
  - !ruby/object:Gem::Version
144
- version: 2.5.0
145
- type: :development
144
+ version: 0.1.0
145
+ type: :runtime
146
146
  prerelease: false
147
147
  version_requirements: *id012
148
+ - !ruby/object:Gem::Dependency
149
+ name: user_config
150
+ requirement: &id013 !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ">="
154
+ - !ruby/object:Gem::Version
155
+ version: 0.0.2
156
+ type: :runtime
157
+ prerelease: false
158
+ version_requirements: *id013
159
+ - !ruby/object:Gem::Dependency
160
+ name: net-ssh
161
+ requirement: &id014 !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: 2.1.3
167
+ type: :runtime
168
+ prerelease: false
169
+ version_requirements: *id014
170
+ - !ruby/object:Gem::Dependency
171
+ name: net-ssh-shell
172
+ requirement: &id015 !ruby/object:Gem::Requirement
173
+ none: false
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: 0.1.0
178
+ type: :runtime
179
+ prerelease: false
180
+ version_requirements: *id015
181
+ - !ruby/object:Gem::Dependency
182
+ name: net-sftp
183
+ requirement: &id016 !ruby/object:Gem::Requirement
184
+ none: false
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: 2.0.5
189
+ type: :runtime
190
+ prerelease: false
191
+ version_requirements: *id016
192
+ - !ruby/object:Gem::Dependency
193
+ name: sys-proctable
194
+ requirement: &id017 !ruby/object:Gem::Requirement
195
+ none: false
196
+ requirements:
197
+ - - ">="
198
+ - !ruby/object:Gem::Version
199
+ version: "0"
200
+ type: :runtime
201
+ prerelease: false
202
+ version_requirements: *id017
148
203
  description: Task queuing system over network that is implemented by dRuby.
149
204
  email: d@ytak.info
150
205
  executables:
151
206
  - drbqs-manage
152
207
  - drbqs-node
153
208
  - drbqs-server
209
+ - drbqs-ssh
154
210
  extensions: []
155
211
 
156
212
  extra_rdoc_files:
@@ -167,12 +223,10 @@ files:
167
223
  - bin/drbqs-manage
168
224
  - bin/drbqs-node
169
225
  - bin/drbqs-server
226
+ - bin/drbqs-ssh
170
227
  - drbqs.gemspec
171
228
  - example/README.md
172
229
  - example/command/server_def.rb
173
- - example/drbqs-manage-test.rb
174
- - example/drbqs-node-test.rb
175
- - example/drbqs-server-test.rb
176
230
  - example/error/error.rb
177
231
  - example/error/server_def.rb
178
232
  - example/server/server.rb
@@ -183,48 +237,79 @@ files:
183
237
  - example/transfer/file.rb
184
238
  - example/transfer/server_def.rb
185
239
  - lib/drbqs.rb
186
- - lib/drbqs/acl_file.rb
187
- - lib/drbqs/client.rb
188
- - lib/drbqs/config.rb
189
- - lib/drbqs/connection.rb
190
- - lib/drbqs/execute_node.rb
191
- - lib/drbqs/history.rb
192
- - lib/drbqs/manage.rb
193
- - lib/drbqs/message.rb
194
- - lib/drbqs/node_list.rb
195
- - lib/drbqs/queue.rb
196
- - lib/drbqs/server.rb
197
- - lib/drbqs/server_define.rb
198
- - lib/drbqs/server_hook.rb
199
- - lib/drbqs/ssh/host.rb
200
- - lib/drbqs/ssh/shell.rb
201
- - lib/drbqs/ssh/transfer.rb
202
- - lib/drbqs/task.rb
203
- - lib/drbqs/task_client.rb
204
- - lib/drbqs/task_generator.rb
205
- - lib/drbqs/utils.rb
206
- - spec/acl_file_spec.rb
207
- - spec/config_spec.rb
208
- - spec/connection_spec.rb
209
- - spec/data/acl.txt
210
- - spec/history_spec.rb
211
- - spec/manage_spec.rb
212
- - spec/message_spec.rb
213
- - spec/node_list_spec.rb
214
- - spec/queue_spec.rb
215
- - spec/server_check_alive_spec.rb
216
- - spec/server_define_spec.rb
217
- - spec/server_hook_spec.rb
218
- - spec/server_spec.rb
240
+ - lib/drbqs/config/config.rb
241
+ - lib/drbqs/config/process_list.rb
242
+ - lib/drbqs/config/ssh_host.rb
243
+ - lib/drbqs/manage/execute_node.rb
244
+ - lib/drbqs/manage/manage.rb
245
+ - lib/drbqs/manage/send_signal.rb
246
+ - lib/drbqs/manage/ssh_execute.rb
247
+ - lib/drbqs/manage/ssh_shell.rb
248
+ - lib/drbqs/node/connection.rb
249
+ - lib/drbqs/node/node.rb
250
+ - lib/drbqs/node/task_client.rb
251
+ - lib/drbqs/server/acl_file.rb
252
+ - lib/drbqs/server/check_alive.rb
253
+ - lib/drbqs/server/history.rb
254
+ - lib/drbqs/server/message.rb
255
+ - lib/drbqs/server/node_list.rb
256
+ - lib/drbqs/server/queue.rb
257
+ - lib/drbqs/server/server.rb
258
+ - lib/drbqs/server/server_hook.rb
259
+ - lib/drbqs/server/transfer_setting.rb
260
+ - lib/drbqs/task/command_task.rb
261
+ - lib/drbqs/task/task.rb
262
+ - lib/drbqs/task/task_generator.rb
263
+ - lib/drbqs/utility/argument.rb
264
+ - lib/drbqs/utility/command_line.rb
265
+ - lib/drbqs/utility/command_line/command_base.rb
266
+ - lib/drbqs/utility/command_line/command_manage.rb
267
+ - lib/drbqs/utility/command_line/command_node.rb
268
+ - lib/drbqs/utility/command_line/command_server.rb
269
+ - lib/drbqs/utility/command_line/command_ssh.rb
270
+ - lib/drbqs/utility/misc.rb
271
+ - lib/drbqs/utility/server_define.rb
272
+ - lib/drbqs/utility/temporary.rb
273
+ - lib/drbqs/utility/transfer/file_transfer.rb
274
+ - lib/drbqs/utility/transfer/transfer_client.rb
275
+ - spec/config/config_spec.rb
276
+ - spec/config/process_list_spec.rb
277
+ - spec/config/ssh_host_spec.rb
278
+ - spec/integration_test/01_basic_usage_spec.rb
279
+ - spec/integration_test/02_use_generator_spec.rb
280
+ - spec/integration_test/03_use_temporary_file_spec.rb
281
+ - spec/integration_test/04_use_unix_domain_spec.rb
282
+ - spec/integration_test/05_server_exit_signal_spec.rb
283
+ - spec/integration_test/06_node_exit_after_task_spec.rb
284
+ - spec/integration_test/07_command_server_with_node_spec.rb
285
+ - spec/integration_test/definition/server01.rb
286
+ - spec/integration_test/definition/server02.rb
287
+ - spec/integration_test/definition/task_obj_definition.rb
288
+ - spec/manage/manage_spec.rb
289
+ - spec/manage/send_signal_spec.rb
290
+ - spec/manage/ssh_shell_spec.rb
291
+ - spec/node/connection_spec.rb
292
+ - spec/node/task_client_spec.rb
293
+ - spec/server/acl_file_spec.rb
294
+ - spec/server/check_alive_spec.rb
295
+ - spec/server/data/acl.txt
296
+ - spec/server/history_spec.rb
297
+ - spec/server/message_spec.rb
298
+ - spec/server/node_list_spec.rb
299
+ - spec/server/queue_spec.rb
300
+ - spec/server/server_hook_spec.rb
301
+ - spec/server/server_spec.rb
302
+ - spec/server/transfer_setting_spec.rb
219
303
  - spec/spec_helper.rb
220
- - spec/ssh_shell_spec.rb
221
- - spec/task_client_spec.rb
222
- - spec/task_generator_spec.rb
223
- - spec/task_spec.rb
224
- - spec/test/test1.rb
225
- - spec/test1_spec.rb
226
- - spec/test2_spec.rb
227
- - spec/transfer_spec.rb
304
+ - spec/task/file_transfer_spec.rb
305
+ - spec/task/task_generator_spec.rb
306
+ - spec/task/task_spec.rb
307
+ - spec/utility/argument_spec.rb
308
+ - spec/utility/command_line/command_base_spec.rb
309
+ - spec/utility/command_line/commands_spec.rb
310
+ - spec/utility/misc_spec.rb
311
+ - spec/utility/server_define_spec.rb
312
+ - spec/utility/temporary_spec.rb
228
313
  has_rdoc: true
229
314
  homepage: http://github.com/ytaka/drbqs
230
315
  licenses:
@@ -239,7 +324,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
324
  requirements:
240
325
  - - ">="
241
326
  - !ruby/object:Gem::Version
242
- hash: -2841221240559713212
327
+ hash: 1769617287248487551
243
328
  segments:
244
329
  - 0
245
330
  version: "0"
@@ -256,25 +341,5 @@ rubygems_version: 1.6.2
256
341
  signing_key:
257
342
  specification_version: 3
258
343
  summary: dRuby Queueing System
259
- test_files:
260
- - spec/acl_file_spec.rb
261
- - spec/config_spec.rb
262
- - spec/connection_spec.rb
263
- - spec/history_spec.rb
264
- - spec/manage_spec.rb
265
- - spec/message_spec.rb
266
- - spec/node_list_spec.rb
267
- - spec/queue_spec.rb
268
- - spec/server_check_alive_spec.rb
269
- - spec/server_define_spec.rb
270
- - spec/server_hook_spec.rb
271
- - spec/server_spec.rb
272
- - spec/spec_helper.rb
273
- - spec/ssh_shell_spec.rb
274
- - spec/task_client_spec.rb
275
- - spec/task_generator_spec.rb
276
- - spec/task_spec.rb
277
- - spec/test/test1.rb
278
- - spec/test1_spec.rb
279
- - spec/test2_spec.rb
280
- - spec/transfer_spec.rb
344
+ test_files: []
345
+
@@ -1,3 +0,0 @@
1
- $: << File.expand_path(File.dirname(__FILE__) + '/../lib/')
2
-
3
- load(File.dirname(__FILE__) + '/../bin/drbqs-manage')
@@ -1,3 +0,0 @@
1
- $: << File.expand_path(File.dirname(__FILE__) + '/../lib/')
2
-
3
- load(File.dirname(__FILE__) + '/../bin/drbqs-node')
@@ -1,3 +0,0 @@
1
- $: << File.expand_path(File.dirname(__FILE__) + '/../lib/')
2
-
3
- load(File.dirname(__FILE__) + '/../bin/drbqs-server')
@@ -1,13 +0,0 @@
1
- module DRbQS
2
- module ACLFile
3
-
4
- # Create ACL object from file.
5
- # The example of file is the following:
6
- # deny all
7
- # allow localhost
8
- # allow 127.0.0.1
9
- def self.load(path)
10
- ACL.new(File.read(path).split)
11
- end
12
- end
13
- end
data/lib/drbqs/config.rb DELETED
@@ -1,98 +0,0 @@
1
- require 'singleton'
2
-
3
- module DRbQS
4
-
5
- ACL_DEFAULT_PATH = 'acl.txt'
6
- ACL_SAMPLE_PATH = 'acl.txt.sample'
7
- HOST_FILE_DIRECTORY = 'host'
8
- HOST_FILE_SAMPLE_PATH = 'host.yaml.sample'
9
- SHELL_FILE_DIRECTORY = 'shell'
10
- SHELL_BASHRC = 'bashrc'
11
-
12
- class Config
13
-
14
- @@data = {
15
- :dir => ENV['HOME'] + '/.drbqs/',
16
- }
17
-
18
- ACL_SAMPLE =<<SAMPLE
19
- deny all
20
- allow localhost
21
- allow 127.0.0.1
22
- SAMPLE
23
-
24
- HOST_YAML_SAMPLE =<<SAMPLE
25
- ---
26
- :dest: user@example.com
27
- :dir:
28
- :shell: bash --noprofile --init-file ~/.drbqs/shell/bashrc
29
- :rvm:
30
- :rvm_init: ~/.rvm/scripts/rvm
31
- :output:
32
- SAMPLE
33
-
34
- BASHRC_SAMPLE = <<SAMPLE
35
- HISTFILE=$HOME/.drbqs/shell/bash_history
36
- HISTSIZE=10000
37
- HISTFILESIZE=20000
38
- SAMPLE
39
-
40
- class << self
41
- def get_path(name)
42
- File.join(@@data[:dir], name)
43
- end
44
- private :get_path
45
-
46
- def set_directory(dir)
47
- @@data[:dir] = dir
48
- end
49
-
50
- def get_host_file_directory
51
- get_path(HOST_FILE_DIRECTORY)
52
- end
53
-
54
- def get_shell_file_directory
55
- get_path(SHELL_FILE_DIRECTORY)
56
- end
57
-
58
- def make_directory(dir)
59
- unless File.exist?(dir)
60
- FileUtils.mkdir_p(dir)
61
- end
62
- end
63
- private :make_directory
64
-
65
- def check_directory_create
66
- unless File.exist?(@@data[:dir])
67
- FileUtils.mkdir_p(@@data[:dir])
68
- FileUtils.chmod(0700, @@data[:dir])
69
- end
70
- [get_host_file_directory, get_shell_file_directory].each do |dir|
71
- make_directory(dir)
72
- end
73
- end
74
-
75
- def output_to_file(path, content)
76
- unless File.exist?(path)
77
- open(path, 'w') { |f| f.print content }
78
- end
79
- end
80
- private :output_to_file
81
-
82
- def save_sample
83
- output_to_file(get_path(ACL_SAMPLE_PATH), ACL_SAMPLE)
84
- output_to_file("#{get_host_file_directory}/#{HOST_FILE_SAMPLE_PATH}", HOST_YAML_SAMPLE)
85
- output_to_file("#{get_shell_file_directory}/#{SHELL_BASHRC}", BASHRC_SAMPLE)
86
- end
87
-
88
- def get_acl_file
89
- path = File.join(@@data[:dir], ACL_DEFAULT_PATH)
90
- if File.exist?(path)
91
- return path
92
- end
93
- return nil
94
- end
95
- end
96
- end
97
-
98
- end
@@ -1,67 +0,0 @@
1
- require 'socket'
2
-
3
- module DRbQS
4
- # The class of connection to s.erver.
5
- class ConnectionClient
6
- def initialize(message, logger = nil)
7
- @message = message
8
- @logger = logger
9
- @id_number = nil
10
- @id_string = create_id_string
11
- end
12
-
13
- def create_id_string
14
- t = Time.now
15
- sprintf("#{Socket.gethostname}:%d", Process.pid)
16
- end
17
- private :create_id_string
18
-
19
- def get_id
20
- unless @id_number
21
- @message.write([:server, :connect, @id_string])
22
- @id_number = @message.take([@id_string, Fixnum])[1]
23
- @logger.info("Get node id: #{@id_number}") if @logger
24
- end
25
- @id_number
26
- end
27
-
28
- def get_special_task(label)
29
- begin
30
- ary = @message.read([label, nil, Symbol, nil], 0)
31
- ary[1..-1]
32
- rescue Rinda::RequestExpiredError
33
- nil
34
- end
35
- end
36
- private :get_special_task
37
-
38
- def get_initialization
39
- get_special_task(:initialize)
40
- end
41
-
42
- def get_finalization
43
- get_special_task(:finalize)
44
- end
45
-
46
- def respond_signal
47
- begin
48
- node_id, sym = @message.take([@id_number, Symbol], 0)
49
- @logger.info("Get signal: #{sym.inspect}") if @logger
50
- case sym
51
- when :alive_p
52
- @message.write([:server, :alive, @id_number])
53
- @logger.info("Send alive signal of node id #{@id_number}") if @logger
54
- when :exit, :finalize
55
- return sym
56
- else
57
- raise "Get invalid signal: #{sym.inspect}"
58
- end
59
- rescue Rinda::RequestExpiredError
60
- end
61
- end
62
-
63
- def send_node_error(error_message)
64
- @message.write([:server, :node_error, [@id_number, error_message]])
65
- end
66
- end
67
- end
data/lib/drbqs/history.rb DELETED
@@ -1,34 +0,0 @@
1
- module DRbQS
2
- module HistoryUtils
3
- def time_to_string(t)
4
- t.strftime("%Y-%m-%d %H:%M:%S")
5
- end
6
- module_function :time_to_string
7
- end
8
-
9
- class History
10
- def initialize
11
- @data = Hash.new { |h, k| h[k] = Array.new }
12
- end
13
-
14
- def set(id, *args)
15
- @data[id] << [Time.now] + args
16
- end
17
-
18
- def size
19
- @data.size
20
- end
21
-
22
- def events(id)
23
- @data[id]
24
- end
25
-
26
- def number_of_events(id)
27
- @data[id].size
28
- end
29
-
30
- def each(&block)
31
- @data.each(&block)
32
- end
33
- end
34
- end
data/lib/drbqs/manage.rb DELETED
@@ -1,84 +0,0 @@
1
- require 'socket'
2
-
3
- module DRbQS
4
-
5
- class SendCommand
6
- MAX_WAIT_TIME = 10
7
-
8
- def initialize(message)
9
- @message = message
10
- end
11
-
12
- def get_hostname
13
- "Command of #{Socket.gethostname}"
14
- end
15
- private :get_hostname
16
-
17
- def send_exit_signal
18
- @message.write([:server, :exit_server, get_hostname])
19
- end
20
-
21
- def get_status
22
- @message.write([:server, :request_status, get_hostname])
23
- i = 0
24
- loop do
25
- begin
26
- mes = @message.take([:status, String], 0)
27
- return mes[1]
28
- rescue Rinda::RequestExpiredError
29
- i += 1
30
- if i > MAX_WAIT_TIME
31
- return nil
32
- end
33
- sleep(1)
34
- end
35
- end
36
- end
37
- end
38
-
39
- class Manage
40
- def self.split_arguments(argv, split = '--')
41
- if n = argv.index(split)
42
- [argv[0..(n - 1)], argv[(n + 1)..-1]]
43
- else
44
- [argv, []]
45
- end
46
- end
47
-
48
- def create_config
49
- Config.check_directory_create
50
- Config.save_sample
51
- end
52
-
53
- def command_client(access_uri)
54
- obj = DRbObject.new_with_uri(access_uri)
55
- DRbQS::SendCommand.new(obj[:message])
56
- rescue DRb::DRbConnError
57
- $stderr.puts "Can not access #{access_uri}"
58
- nil
59
- end
60
- private :command_client
61
-
62
- def send_exit_signal(access_uri)
63
- if client = command_client(access_uri)
64
- client.send_exit_signal
65
- end
66
- end
67
-
68
- def get_status(access_uri)
69
- if client = command_client(access_uri)
70
- client.get_status
71
- end
72
- end
73
-
74
- def execute_over_ssh(dest, opts, command)
75
- ssh = DRbQS::SSHShell.new(dest, opts)
76
- ssh.start(command)
77
- end
78
-
79
- def get_ssh_environment(dest, opts)
80
- ssh = DRbQS::SSHShell.new(dest, opts)
81
- ssh.get_environment
82
- end
83
- end
84
- end