rundock 1.1.5 → 1.1.6
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 +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +12 -0
- data/default_ssh.yml +1 -1
- data/lib/rundock/attribute/node_attribute.rb +1 -0
- data/lib/rundock/backend.rb +8 -1
- data/lib/rundock/builder/hook_builder.rb +1 -1
- data/lib/rundock/builder/operation_builder.rb +8 -2
- data/lib/rundock/builder/task_builder.rb +21 -10
- data/lib/rundock/cli.rb +6 -4
- data/lib/rundock/node.rb +1 -0
- data/lib/rundock/operation/task.rb +2 -0
- data/lib/rundock/version.rb +1 -1
- data/rundock.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87276a62d3a318643a6fd4e1db23ef2bc8734406
|
4
|
+
data.tar.gz: 41189493f366d574722b6342fa5b325c33e4e8ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62eb6c047d635fdd4af13f00cec08f776c254f0a260c9da20ddae46a5debdea17ba9be90928b207e29560d67cf12e4a501bbd0d297980c3020326f94664b3222
|
7
|
+
data.tar.gz: 972d42c65730a9e5ba759135603e4c5ff56dda98d724540903de8122bdbf4892297816ba57f62bfa2be29304e711e8b62f4c3faa71f6e1df5e2b64119e948881
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/default_ssh.yml
CHANGED
data/lib/rundock/backend.rb
CHANGED
@@ -59,7 +59,14 @@ module Rundock
|
|
59
59
|
|
60
60
|
return nil if exec_options[:dry_run]
|
61
61
|
|
62
|
-
|
62
|
+
begin
|
63
|
+
result = @backend.run_command(command)
|
64
|
+
rescue StandardError => e
|
65
|
+
Logger.error(e.to_s)
|
66
|
+
raise CommandResultStatusError if exec_options[:errexit]
|
67
|
+
return nil
|
68
|
+
end
|
69
|
+
|
63
70
|
exit_status = result.exit_status
|
64
71
|
|
65
72
|
Logger.formatter.indent do
|
@@ -29,7 +29,7 @@ module Rundock
|
|
29
29
|
return []
|
30
30
|
end
|
31
31
|
elsif hook_attributes.nil?
|
32
|
-
Logger.
|
32
|
+
Logger.info("Hook source is not found. (enables:#{enables.join(',')})") unless enables.empty?
|
33
33
|
return []
|
34
34
|
end
|
35
35
|
|
@@ -72,7 +72,9 @@ module Rundock
|
|
72
72
|
def build_cli
|
73
73
|
scen = Scenario.new
|
74
74
|
|
75
|
-
@options[:host].split(',')
|
75
|
+
hosts = @options[:host].split(',')
|
76
|
+
hosts.each do |host|
|
77
|
+
@options[:host] = host
|
76
78
|
backend = BackendBuilder.new(@options, host, nil).build
|
77
79
|
node = Node.new(host, backend)
|
78
80
|
node.hooks = HookBuilder.new(@options).build(['all'], nil)
|
@@ -109,6 +111,8 @@ module Rundock
|
|
109
111
|
node_attributes.nodename = @options[:host] unless node_attributes.nodename
|
110
112
|
node_attributes.errexit = !cli_options[:run_anyway]
|
111
113
|
node_attributes.dry_run = cli_options[:dry_run] ? true : false
|
114
|
+
node_attributes.filtered_tasks = cli_options[:filtered_tasks] &&
|
115
|
+
cli_options[:filtered_tasks].split(',')
|
112
116
|
Rundock::OperationFactory.instance(:command).create(Array(command), node_attributes.list)
|
113
117
|
end
|
114
118
|
|
@@ -128,7 +132,9 @@ module Rundock
|
|
128
132
|
else
|
129
133
|
!cli_options[:run_anyway]
|
130
134
|
end
|
131
|
-
node_attributes.dry_run = cli_options
|
135
|
+
node_attributes.dry_run = cli_options[:dry_run]
|
136
|
+
node_attributes.filtered_tasks = cli_options[:filtered_tasks] &&
|
137
|
+
cli_options[:filtered_tasks].split(',')
|
132
138
|
end
|
133
139
|
|
134
140
|
# override by scenario
|
@@ -6,17 +6,28 @@ module Rundock
|
|
6
6
|
DEFAULT_TASKS_FILE_PATH = './tasks.yml'
|
7
7
|
|
8
8
|
def build(scenario_tasks)
|
9
|
-
tasks =
|
10
|
-
|
9
|
+
tasks = if scenario_tasks.nil?
|
10
|
+
{}
|
11
|
+
else
|
12
|
+
scenario_tasks
|
13
|
+
end
|
11
14
|
return scenario_tasks unless @options[:tasks]
|
12
|
-
if
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
return tasks if @options[:tasks].nil?
|
16
|
+
|
17
|
+
task_files = @options[:tasks].split(',')
|
18
|
+
|
19
|
+
task_files.each do |tk|
|
20
|
+
tk.gsub!(/~/, Dir.home)
|
21
|
+
|
22
|
+
if FileTest.exist?(tk)
|
23
|
+
tasks.merge!(YAML.load_file(tk).deep_symbolize_keys)
|
24
|
+
Logger.info("merged tasks file #{tk}")
|
25
|
+
elsif FileTest.exist?(DEFAULT_TASKS_FILE_PATH)
|
26
|
+
Logger.warn("tasks file is not found. use #{DEFAULT_TASKS_FILE_PATH}")
|
27
|
+
tasks.merge!(YAML.load_file(DEFAULT_TASKS_FILE_PATH).deep_symbolize_keys)
|
28
|
+
else
|
29
|
+
Logger.warn("Task path is not available. (#{tk})")
|
30
|
+
end
|
20
31
|
end
|
21
32
|
|
22
33
|
tasks
|
data/lib/rundock/cli.rb
CHANGED
@@ -32,9 +32,10 @@ module Rundock
|
|
32
32
|
option :sudo, type: :boolean, default: false
|
33
33
|
option :default_ssh_opts, type: :string, aliases: ['-d'], default: DEFAULT_SSH_OPTIONS_DEFAULT_FILE_PATH
|
34
34
|
option :targetgroup, type: :string, aliases: ['-g']
|
35
|
-
option :tasks, type: :string, aliases: ['-t']
|
35
|
+
option :tasks, type: :string, aliases: ['-t'], banner: 'You can specify comma separated task file paths.[ex: task_file1,task_file2,..]'
|
36
|
+
option :filtered_tasks, type: :string, aliases: ['-T'], banner: 'You can specify comma separated tasks.[ex: task1,task2,..]'
|
36
37
|
option :hooks, type: :string, aliases: ['-k']
|
37
|
-
option :run_anyway, type: :boolean, default: false
|
38
|
+
option :run_anyway, type: :boolean, aliases: ['-r'], default: false
|
38
39
|
option :dry_run, type: :boolean, aliases: ['-n']
|
39
40
|
def do(*scenario_file_path)
|
40
41
|
scenario_file_path = [DEFAULT_SCENARIO_FILE_PATH] if scenario_file_path.empty?
|
@@ -46,7 +47,8 @@ module Rundock
|
|
46
47
|
desc 'ssh [options]', 'Run rundock ssh with various options'
|
47
48
|
option :command, type: :string, aliases: ['-c']
|
48
49
|
option :default_ssh_opts, type: :string, aliases: ['-d'], default: DEFAULT_SSH_OPTIONS_DEFAULT_FILE_PATH
|
49
|
-
option :tasks, type: :string, aliases: ['-t']
|
50
|
+
option :tasks, type: :string, aliases: ['-t'], banner: 'You can specify comma separated task file paths.[ex: task_file1,task_file2,..]'
|
51
|
+
option :filtered_tasks, type: :string, aliases: ['-T'], banner: 'You can specify comma separated tasks.[ex: task1,task2,..]'
|
50
52
|
option :hooks, type: :string, aliases: ['-k']
|
51
53
|
option :host, type: :string, aliases: ['-h'], banner: 'You can specify comma separated hosts.[ex: host1,host2,..]'
|
52
54
|
option :targetgroup, type: :string, aliases: ['-g']
|
@@ -56,7 +58,7 @@ module Rundock
|
|
56
58
|
option :ssh_config, type: :string, aliases: ['-F']
|
57
59
|
option :ask_password, type: :boolean, default: false
|
58
60
|
option :sudo, type: :boolean, default: false
|
59
|
-
option :run_anyway, type: :boolean, default: false
|
61
|
+
option :run_anyway, type: :boolean, aliases: ['-r'], default: false
|
60
62
|
option :dry_run, type: :boolean, aliases: ['-n']
|
61
63
|
def ssh
|
62
64
|
opts = {}
|
data/lib/rundock/node.rb
CHANGED
@@ -17,6 +17,8 @@ module Rundock
|
|
17
17
|
next
|
18
18
|
end
|
19
19
|
|
20
|
+
next if !attributes[:filtered_tasks].nil? && !attributes[:filtered_tasks].include?(task_name)
|
21
|
+
|
20
22
|
scenario = Rundock::Builder::ScenarioBuilder.new(nil, nil).build_task(
|
21
23
|
attributes[:task_info][task_name.to_sym], backend, Rundock::Attribute::NodeAttribute.new(attributes)
|
22
24
|
)
|
data/lib/rundock/version.rb
CHANGED
data/rundock.gemspec
CHANGED
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: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hiracy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|