task-orchestrator 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ orchestrator:
2
+ statedir: states
3
+ conditionals:
4
+ description: conditionals test
5
+ save: true
6
+ defaults:
7
+ envs:
8
+ ANSWER: "no"
9
+ steps:
10
+ - type: sequential
11
+ scripts:
12
+ - command: "echo The answer is :::ENV.ANSWER:::"
13
+ - command: "echo OK"
14
+ condition: "test X:::ENV.ANSWER::: == Xyes"
15
+ - command: "ecxho THE END"
@@ -164,7 +164,7 @@ module Orchestrator
164
164
  command = { 'command' => interpolate_command(command) }
165
165
  elsif command.is_a?(Hash)
166
166
  invalid(error_prefix + " is missing command attribute") unless command.has_key?('command')
167
- ['command', 'ok_handler', 'failure_handler'].each do |attribute|
167
+ ['command', 'ok_handler', 'failure_handler', 'condition'].each do |attribute|
168
168
  if command.has_key?(attribute)
169
169
  invalid(error_prefix + " #{attribute} attribute is invalid") unless command[attribute].is_a?(String)
170
170
  command[attribute] = interpolate_command(command[attribute])
@@ -393,6 +393,11 @@ EOF
393
393
 
394
394
  step['scripts'].each_index do |index|
395
395
  next if step['scripts'][index].has_key?('status') and step['scripts'][index]['status'] == 'OK'
396
+ if step['scripts'][index].has_key?('condition') and 'OK' != run_command(step['scripts'][index]['condition'], 0)
397
+ step['scripts'][index]['status'] = "SKIPED"
398
+ save_state
399
+ next
400
+ end
396
401
  loop do
397
402
  @mutex.synchronize do
398
403
  running_threads = @threads.length
@@ -421,6 +426,11 @@ EOF
421
426
  step['scripts'].each_index do |index|
422
427
  failures = 0
423
428
  next if step['scripts'][index].has_key?('status') and step['scripts'][index]['status'] == 'OK'
429
+ if step['scripts'][index].has_key?('condition') and 'OK' != run_command(step['scripts'][index]['condition'], 0)
430
+ step['scripts'][index]['status'] = "SKIPED"
431
+ save_state
432
+ next
433
+ end
424
434
  loop do
425
435
  @statuses[index] = run_script(step['scripts'][index])
426
436
  break if @statuses[index]
@@ -1,3 +1,3 @@
1
1
  module Orchestrator
2
- VERSION ||= '0.0.14'
2
+ VERSION ||= '0.0.15'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: task-orchestrator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-28 00:00:00.000000000 Z
12
+ date: 2013-11-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pony
@@ -85,17 +85,18 @@ extra_rdoc_files: []
85
85
  files:
86
86
  - bin/orchestrator
87
87
  - lib/orchestrator.rb
88
- - lib/orchestrator/task.rb
89
88
  - lib/orchestrator/version.rb
90
89
  - lib/orchestrator/cli.rb
90
+ - lib/orchestrator/task.rb
91
+ - examples/timeouts
92
+ - examples/conditionals
93
+ - examples/interpolation
94
+ - examples/dependencies
91
95
  - examples/sequential
92
96
  - examples/failure_handler
93
- - examples/multistep
94
97
  - examples/parallel
95
- - examples/interpolation
96
- - examples/timeouts
97
98
  - examples/flock
98
- - examples/dependencies
99
+ - examples/multistep
99
100
  - task-orchestrator.gemspec
100
101
  - LICENSE
101
102
  - README.md