rundock 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fe1522d58ced441b963285f6d4cd963c2ca5632
4
- data.tar.gz: e1a65a4ede4cff83bcd8a474838da3483a07027f
3
+ metadata.gz: f19b1b0d72897240ff3c158f0b88fa87aef2dd09
4
+ data.tar.gz: 91196ecf20088a5cebb57fbb179e90d96c50c9bf
5
5
  SHA512:
6
- metadata.gz: 44e7cb01074e66f7ffab9a083c2050084ea9ed89d70b54ddad58f16614406123a293fb7b8c5583f35db3b3fa94395f801b7e2efd3be8fbbe9bcb3566414d3576
7
- data.tar.gz: 893c456e09ed5b6e0152067437e7f1e6934ab76d25fa0a4f4ae9b42522cb7a12d6a2b9239e99efea8dc8f2046bf1585b661f019291b35ae08d35718eb2ba4dfe
6
+ metadata.gz: a93435634ab5972e631988d490bb86f8e3994f85b743adb4e0a0e0013a2aeb3f00156677af5c266d09bc0662e5fbdb6f6637b60ac7f5ac2186a5b81f6e0f1f2c
7
+ data.tar.gz: 3d71104a81a804218047e349044c9b622256aaf038c40dccb04f27a9320e281ad58ae123b030be354a288b3debe5c72c0da8c8d54db7094947e325f19d6178da
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## v0.2.10
2
+
3
+ Improvements
4
+
5
+ - Add running operation to other node infomation
6
+
7
+ Fix
8
+
9
+ - Fix command in task have been excuted though cli command option was specified
10
+ - Fix unavail cli --run-anyway option if -g options specified
11
+
1
12
  ## v0.2.9
2
13
 
3
14
  Improvements
@@ -11,6 +11,7 @@ module Rundock
11
11
  node_attribute = Rundock::Attribute::NodeAttribute.new(task_info: {})
12
12
  tasks.each { |k, v| node_attribute.task_info[k] = v } if tasks
13
13
  scen.node_info = node_info
14
+ scen.node_info = {} unless node_info
14
15
  scen.tasks = tasks
15
16
 
16
17
  # use scenario file
@@ -25,27 +26,23 @@ module Rundock
25
26
 
26
27
  node = Node.new(v, backend)
27
28
  node_attribute.nodename = v
28
- node_attribute.nodeinfo = builder.parsed_options
29
+ scen.node_info[v.to_sym] = node_attribute.nodeinfo = builder.parsed_options
29
30
 
30
31
  if @options[:command]
31
32
  node.add_operation(build_cli_command_operation(@options[:command], @options))
32
33
  end
33
34
  else
34
- if @options[:command] && (k == :command || k == :task)
35
- Logger.debug(%("--command or -c" option is specified and ignore scenario file.))
36
- next
37
- end
38
35
 
39
36
  next unless node
40
37
 
41
38
  ope = build_operations(k, Array(v), node_attribute, @options)
42
- node.add_operation(ope)
39
+ node.add_operation(ope) if ope
43
40
  end
44
41
  end
45
42
  end
46
43
 
47
44
  scen.nodes.push(node) if node
48
- scen
45
+ scen.complete
49
46
  end
50
47
 
51
48
  def build_task(tasks, backend, node_attribute)
@@ -54,7 +51,7 @@ module Rundock
54
51
 
55
52
  tasks.each do |k, v|
56
53
  ope = build_operations(k, Array(v), node_attribute, nil)
57
- node.add_operation(ope)
54
+ node.add_operation(ope) if ope
58
55
  end
59
56
 
60
57
  scen.nodes.push(node) if node
@@ -77,12 +74,19 @@ module Rundock
77
74
  private
78
75
 
79
76
  def build_cli_command_operation(command, cli_options)
80
- node_attribute = Rundock::Attribute::NodeAttribute.new
81
- node_attribute.errexit = !cli_options[:run_anyway]
82
- Rundock::OperationFactory.instance(:command).create(Array(command), nil)
77
+ node_attributes = Rundock::Attribute::NodeAttribute.new
78
+ node_attributes.errexit = !cli_options[:run_anyway]
79
+ Rundock::OperationFactory.instance(:command).create(Array(command), node_attributes.list)
83
80
  end
84
81
 
85
82
  def build_operations(ope_type, ope_content, node_attributes, cli_options)
83
+ if cli_options &&
84
+ cli_options[:command] &&
85
+ (ope_type == :command || ope_type == :task)
86
+ Logger.debug(%("--command or -c" option is specified and ignore scenario file.))
87
+ return
88
+ end
89
+
86
90
  node_attributes.errexit = !cli_options[:run_anyway] if cli_options
87
91
  node_attributes.errexit = true if cli_options.nil?
88
92
  node_attributes.define_attr(ope_type, ope_content)
data/lib/rundock/node.rb CHANGED
@@ -9,6 +9,7 @@ module Rundock
9
9
  def initialize(name, backend)
10
10
  @name = name
11
11
  @backend = backend
12
+ @operations = []
12
13
  end
13
14
 
14
15
  def add_operation(ope)
@@ -16,6 +17,12 @@ module Rundock
16
17
  @operations << ope
17
18
  end
18
19
 
20
+ def complete(scenario)
21
+ @operations.each do |ope|
22
+ ope.attributes[:nodeinfo] = scenario.node_info
23
+ end
24
+ end
25
+
19
26
  def run
20
27
  Logger.debug("run name: #{@name}")
21
28
  if @operations.blank?
@@ -11,5 +11,10 @@ module Rundock
11
11
  def run
12
12
  @nodes.each(&:run)
13
13
  end
14
+
15
+ def complete
16
+ @nodes.each { |n| n.complete(self) }
17
+ self
18
+ end
14
19
  end
15
20
  end
@@ -1,3 +1,3 @@
1
1
  module Rundock
2
- VERSION = '0.2.9'
2
+ VERSION = '0.2.10'
3
3
  end
@@ -7,4 +7,4 @@
7
7
  ---
8
8
  write_echo:
9
9
  command:
10
- - "echo 'Hello Rundock from Scenario.' > /var/tmp/hello_rundock_from_scenario"
10
+ - "echo 'Hello Rundock from Scenario.' | tee /var/tmp/hello_rundock_from_scenario"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rundock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - hiracy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-07 00:00:00.000000000 Z
11
+ date: 2015-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler