rundeck-ruby-client 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 52206825af75c0e173b4a4c728547910e43cbff3
4
- data.tar.gz: 538fbdf0c5874662c2728f2d74cd7423d5b0874f
3
+ metadata.gz: 9fc318f02f505fd0b7274b5e1e5b33e5a9d26390
4
+ data.tar.gz: fd12d89dd888462463537ed41b8b8747bc25a27d
5
5
  SHA512:
6
- metadata.gz: a02b3685ae270491c8785795d7e56acbe35b675ec8c116d0283f9db4a35b79826d0ad8df9df31c37741690fe3a360a88cabb9c22ae113c02477ca78f5f889102
7
- data.tar.gz: bcd2949483d65d8b74085ea2b47467a038a51f11dcd1f2fbb558113707531cdebf1b0605f8fe0793b4090d4a6507bb1c1d13d76abeb13145a254cf8fe06f30d6
6
+ metadata.gz: 246ff2c0aa1f650011271dcaaf292ae387d77f18f8d2bae7efd7c6e806310383b3bb1a37c52c1d00d1f91d7044bbe68479eb5bb724fbd7dd426aca7f730050c0
7
+ data.tar.gz: e2aa7bfdd46f8da936594247f5d8750eb1e0504fe0baf4fc02453a3ce7acfba23e3f41dbcbb108f9682cba89312a22fbdc5ec2859b6f38ddbfc2fc15cb218eba
@@ -1,4 +1,5 @@
1
1
  require 'timeout'
2
+ require 'pp'
2
3
 
3
4
  module Rundeck
4
5
  class Execution
@@ -46,17 +47,24 @@ module Rundeck
46
47
  ret = session.get("api/9/execution/#{id}/output")
47
48
  result = ret['result']
48
49
  raise "API call not successful" unless result && result['success']=='true'
49
-
50
- #sort the output by node
51
50
  ret = result['output'].slice(*%w(id completed hasFailedNodes))
52
- ret['log'] = result['output']['entries']['entry'].group_by{|e| e['node']}
51
+ logs = result['output']['entries']['entry']
52
+ if logs.class == Array
53
+ logs = logs.group_by{|e| e['node']}
54
+ else
55
+ logs = {"localhost" => [logs]}
56
+ end
57
+ ret['log'] = logs
58
+ ret = [ret] if ret.class != Array
53
59
  ret
54
60
  end
55
61
 
56
62
  # http request are done at each loop so, be nice with interval :)
57
63
  def wait_end interval, timeout
58
64
  Timeout.timeout(timeout) do
59
- until Execution::find(@session, @id).status != :running do
65
+ exec = Execution::find(@session, @id)
66
+ until exec.status != :running do
67
+ exec = Execution::find(@session, @id)
60
68
  sleep interval
61
69
  end
62
70
  end
@@ -35,7 +35,7 @@ module Rundeck
35
35
 
36
36
  def execute!(args_hash)
37
37
  argstr=""
38
- args_hash.map {|param, value| argstr += "-#{param} #{value} "}
38
+ args_hash.map {|param, value| argstr += "-#{param} \"#{value}\" "}
39
39
  encoded_args = URI::encode(argstr)
40
40
  query = "api/1/job/#{id}/run?argString=#{encoded_args}"
41
41
  hash = session.get(query, 'result', 'executions', 'execution') || {}
@@ -1,3 +1,3 @@
1
1
  module Rundeck
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rundeck-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Phillips
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2014-10-15 00:00:00.000000000 Z
12
+ date: 2014-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client