mobilize-ssh 1.0.25 → 1.0.55

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.
data/README.md CHANGED
@@ -81,7 +81,7 @@ The Ssh configuration consists of:
81
81
  over to the nodes. They will be deleted afterwards, unless the job
82
82
  fails in mid-copy. By default this is tmp/file/.
83
83
  * nodes, identified by aliases, such as `test_node`. This alias is what you should
84
- pass into the "node_alias" param over in the ssh.run task.
84
+ pass into the "node" param over in the ssh.run task.
85
85
 
86
86
  Each node has a host, and optionally has a gateway. If you don't need a
87
87
  gateway, remove that row from the configuration file.
@@ -125,10 +125,12 @@ Start
125
125
  ### Create Job
126
126
 
127
127
  * For mobilize-ssh, the following task is available:
128
- * ssh.run `<node_alias>,<command>,*<gsheet_full_paths>`, which reads
128
+ * ssh.run `node: <node_alias>, cmd: <command>, su_user: su_user, sources:[*<gsheet_full_paths>]`, which reads
129
129
  all gsheets, copies them to a temporary folder on the selected node, and
130
130
  runs the command inside that folder.
131
- * The test uses `ssh.run "test_node", "ruby code.rb", "Runner_mobilize(test)/code.rb", "Runner_mobilize(test)/code.sh"`
131
+ * su_user and sources are optional; node and cmd are required. su_user
132
+ will cause the command to be prefixed with sudo su <su_user> -c.
133
+ * The test uses `ssh.run node:"test_node", cmd:"ruby code.rb", su_user: "root", sources:["Runner_mobilize(test)/code.rb","Runner_mobilize(test)/code.sh"]`
132
134
 
133
135
  <a name='section_Start_Run_Test'></a>
134
136
  ### Run Test
@@ -141,13 +141,15 @@ module Mobilize
141
141
  def Ssh.run_by_task_path(task_path)
142
142
  t = Task.where(:path=>task_path).first
143
143
  params = t.params
144
- node, command = [params[0],params[1]]
145
- file_hash = if params[2]
146
- gsheet_paths = params[2..-1] if params[2]
144
+ node, command = [params['node'],params['cmd']]
145
+ file_hash = if params['sources']
147
146
  gdrive_slot = Gdrive.slot_worker_by_path(task_path)
148
- Ssh.get_file_hash(gsheet_paths,gdrive_slot)
147
+ result = Ssh.get_file_hash(params['sources'],gdrive_slot)
148
+ Gdrive.unslot_worker_by_path(task_path)
149
+ result
149
150
  end
150
- Ssh.run(node,command,file_hash)
151
+ su_user = t.params['su_user']
152
+ Ssh.run(node,command,file_hash,su_user)
151
153
  end
152
154
  end
153
155
  end
@@ -1,5 +1,5 @@
1
1
  module Mobilize
2
2
  module Ssh
3
- VERSION = "1.0.25"
3
+ VERSION = "1.0.55"
4
4
  end
5
5
  end
data/mobilize-ssh.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
- gem.add_runtime_dependency "mobilize-base","~>1.0.55"
19
+ gem.add_runtime_dependency "mobilize-base","1.0.75"
20
20
  gem.add_runtime_dependency "net-ssh"
21
21
  gem.add_runtime_dependency "net-scp"
22
22
  gem.add_runtime_dependency "net-ssh-gateway"
@@ -2,5 +2,5 @@
2
2
  active: true
3
3
  trigger: once
4
4
  status: ""
5
- task1: 'ssh.run "test_node", "ruby code.rb", "Runner_mobilize(test)/code.rb", "Runner_mobilize(test)/code.sh"'
6
- task2: 'gsheet.write "task1", "Runner_mobilize(test)/test_ssh.out"'
5
+ task1: 'ssh.run node:"test_node", cmd:"ruby code.rb", su_user:"root", sources:["Runner_mobilize(test)/code.rb", "Runner_mobilize(test)/code.sh"]'
6
+ task2: 'gsheet.write source:"task1", target:"Runner_mobilize(test)/test_ssh.out"'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobilize-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.25
4
+ version: 1.0.55
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-13 00:00:00.000000000 Z
12
+ date: 2012-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mobilize-base
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.0.55
21
+ version: 1.0.75
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.0.55
29
+ version: 1.0.75
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: net-ssh
32
32
  requirement: !ruby/object:Gem::Requirement