rundock 0.2.11 → 0.3.0
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 +1 -1
- data/CHANGELOG.md +10 -0
- data/Rakefile +1 -1
- data/lib/rundock/backend.rb +11 -0
- data/lib/rundock/builder/operation_builder.rb +4 -4
- data/lib/rundock/plugin/operation/deploy.rb +40 -0
- data/lib/rundock/version.rb +1 -1
- data/spec/integration/platforms/centos6/setup.sh +7 -7
- data/spec/integration/platforms/localhost/scenarios/deploy_scenario.yml +13 -0
- data/spec/integration/recipes/deploy_spec.rb +10 -0
- data/spec/integration/scenarios/deploy_scenario.yml +26 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee97ce7e9fab113c27e6782b3dc5a541b77fd6d7
|
4
|
+
data.tar.gz: c449097d5bb33e5fa09be5d00b69bf9e37a74d01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c096af8d1d925c6902ec72358b22d821e216dbb410981cb5d6fcacd363dbdd0730b543c6fcb0eb68a75c6bcd1636157f44fbb71687fdfe82883d35da62f2273d
|
7
|
+
data.tar.gz: 9b9cab0135ffc8b2d710a3fdbd6b8a39d479d7339c28f3a14780256066ecda90e7346b3274d6a681dbac8fcfc208d4c6251a01428c1f80d0526a79fa325c5609
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
@@ -81,7 +81,7 @@ end
|
|
81
81
|
desc 'Cleaning environments'
|
82
82
|
|
83
83
|
task :clean do
|
84
|
-
execute('rm -
|
84
|
+
execute('rm -fr /var/tmp/hello_rundock*', false)
|
85
85
|
Dir.glob('./spec/integration/platforms/*').each do |platform|
|
86
86
|
next if platform =~ /localhost$/
|
87
87
|
execute("#{platform}/setup.sh --clean", false)
|
data/lib/rundock/backend.rb
CHANGED
@@ -32,6 +32,17 @@ module Rundock
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
+
def send_file(from, to)
|
36
|
+
system("test -d #{from}")
|
37
|
+
recursive = $?.to_i == 0
|
38
|
+
|
39
|
+
if !recursive
|
40
|
+
@backend.send_file(from, to)
|
41
|
+
else
|
42
|
+
@backend.send_directory(from, to)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
35
46
|
private
|
36
47
|
|
37
48
|
def run_command(cmd, exec_options = {})
|
@@ -29,7 +29,7 @@ module Rundock
|
|
29
29
|
scen.node_info[v.to_sym] = node_attribute.nodeinfo = builder.parsed_options
|
30
30
|
|
31
31
|
if @options[:command]
|
32
|
-
node.add_operation(build_cli_command_operation(@options[:command], @options))
|
32
|
+
node.add_operation(build_cli_command_operation(@options[:command], node_attribute, @options))
|
33
33
|
end
|
34
34
|
else
|
35
35
|
|
@@ -64,7 +64,8 @@ module Rundock
|
|
64
64
|
@options[:host].split(',').each do |host|
|
65
65
|
backend = BackendBuilder.new(@options, host, nil).build
|
66
66
|
node = Node.new(host, backend)
|
67
|
-
node.add_operation(
|
67
|
+
node.add_operation(
|
68
|
+
build_cli_command_operation(@options[:command], Rundock::Attribute::NodeAttribute.new, @options))
|
68
69
|
scen.nodes.push(node)
|
69
70
|
end
|
70
71
|
|
@@ -73,8 +74,7 @@ module Rundock
|
|
73
74
|
|
74
75
|
private
|
75
76
|
|
76
|
-
def build_cli_command_operation(command, cli_options)
|
77
|
-
node_attributes = Rundock::Attribute::NodeAttribute.new
|
77
|
+
def build_cli_command_operation(command, node_attributes, cli_options)
|
78
78
|
node_attributes.errexit = !cli_options[:run_anyway]
|
79
79
|
Rundock::OperationFactory.instance(:command).create(Array(command), node_attributes.list)
|
80
80
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rundock/operation/base'
|
2
|
+
|
3
|
+
module Rundock
|
4
|
+
module Operation
|
5
|
+
# You can use this as following scenario.yml for example.
|
6
|
+
#
|
7
|
+
# - node: localhost
|
8
|
+
# deploy:
|
9
|
+
# - src: /tmp/deploy_from_local_file
|
10
|
+
# dst: /tmp/deploy_dest_local_file
|
11
|
+
# - src: /tmp/deploy_from_local_dir
|
12
|
+
# dst: /tmp/deploy_dest_local_dir
|
13
|
+
# - node: anyhost-01
|
14
|
+
# deploy:
|
15
|
+
# - src: /tmp/deploy_from_local_file
|
16
|
+
# dst: /tmp/deploy_dest_remote_file
|
17
|
+
# - src: /tmp/deploy_from_local_dir
|
18
|
+
# dst: /tmp/deploy_dest_remote_dir
|
19
|
+
# ---
|
20
|
+
# anyhost-01:
|
21
|
+
# host: 192.168.1.11
|
22
|
+
# ssh_opts:
|
23
|
+
# port: 22
|
24
|
+
# user: anyuser
|
25
|
+
# key: ~/.ssh/id_rsa
|
26
|
+
# ---
|
27
|
+
class Deploy < Base
|
28
|
+
def run(backend, attributes)
|
29
|
+
options = attributes[:deploy]
|
30
|
+
|
31
|
+
options.each do |path|
|
32
|
+
Logger.error('src: options not found.') if !path[:src] || path[:src].blank?
|
33
|
+
Logger.error('dst: options not found.') if !path[:dst] || path[:dst].blank?
|
34
|
+
Logger.info("deploy localhost:#{path[:src]} remote:#{attributes[:nodeinfo][:host]}:#{path[:dst]}")
|
35
|
+
backend.send_file(path[:src], path[:dst])
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
data/lib/rundock/version.rb
CHANGED
@@ -23,14 +23,14 @@ RUNDOCK_SCENARIO_CACHE_DIR="${RUNDOCK_CACHE_DIR}/scenarios"
|
|
23
23
|
RUNDOCK_GROUP_CACHE_DIR="${RUNDOCK_CACHE_DIR}/groups"
|
24
24
|
|
25
25
|
if [ "${1}x" = "--cleanx" ];then
|
26
|
+
rm -f ${RUNDOCK_DEFAULT_SSH_YML}
|
27
|
+
rm -f ${RUNDOCK_SCENARIO_CACHE_DIR}/*.yml
|
28
|
+
rm -f ${RUNDOCK_GROUP_CACHE_DIR}/*.yml
|
26
29
|
if sudo docker ps | grep "${DOCKER_IMAGE_NAME}" > /dev/null; then
|
27
|
-
rm -f
|
28
|
-
rm -f
|
29
|
-
rm -f
|
30
|
-
rm -f
|
31
|
-
rm -f "${DOCKER_SSH_KEY_PRIVATE}"
|
32
|
-
rm -f "${DOCKER_SSH_KEY_PUBLIC_LOCAL}"
|
33
|
-
rm -f "${DOCKER_SSH_CONFIG}"
|
30
|
+
rm -f ${DOCKER_CACHE_IMAGE_PATH}
|
31
|
+
rm -f ${DOCKER_SSH_KEY_PRIVATE}
|
32
|
+
rm -f ${DOCKER_SSH_KEY_PUBLIC_LOCAL}
|
33
|
+
rm -f ${DOCKER_SSH_CONFIG}
|
34
34
|
rm -f ${DOCKER_SSH_KEY_PUBLIC_REMOTE}
|
35
35
|
set +x
|
36
36
|
sudo docker ps -q | xargs sudo docker rm -f
|
@@ -0,0 +1,13 @@
|
|
1
|
+
- node: localhost
|
2
|
+
command:
|
3
|
+
- "rm -f /var/tmp/hello_rundock_from_deploy_src_file_scenario"
|
4
|
+
- "rm -f /var/tmp/hello_rundock_from_deploy_dst_file_scenario"
|
5
|
+
- "rm -fr /var/tmp/hello_rundock_from_deploy_src_dir_scenario"
|
6
|
+
- "rm -fr /var/tmp/hello_rundock_from_deploy_dst_dir_scenario"
|
7
|
+
- "echo 'Hello Rundock from deploy Scenario.' > /var/tmp/hello_rundock_from_deploy_src_file_scenario"
|
8
|
+
- "mkdir /var/tmp/hello_rundock_from_deploy_src_dir_scenario"
|
9
|
+
deploy:
|
10
|
+
- src: /var/tmp/hello_rundock_from_deploy_src_file_scenario
|
11
|
+
dst: /var/tmp/hello_rundock_from_deploy_dst_file_scenario
|
12
|
+
- src: /var/tmp/hello_rundock_from_deploy_src_dir_scenario
|
13
|
+
dst: /var/tmp/hello_rundock_from_deploy_dst_dir_scenario
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe file('/var/tmp/hello_rundock_from_deploy_dst_file_scenario') do
|
4
|
+
it { should be_file }
|
5
|
+
its(:content) { should match(/Hello Rundock from deploy Scenario./) }
|
6
|
+
end
|
7
|
+
|
8
|
+
describe file('/var/tmp/hello_rundock_from_deploy_dst_dir_scenario') do
|
9
|
+
it { should be_directory }
|
10
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
- node: localhost
|
2
|
+
command:
|
3
|
+
- "rm -f /var/tmp/hello_rundock_from_deploy_src_file_scenario"
|
4
|
+
- "rm -fr /var/tmp/hello_rundock_from_deploy_src_dir_scenario"
|
5
|
+
- "echo 'Hello Rundock from deploy Scenario.' > /var/tmp/hello_rundock_from_deploy_src_file_scenario"
|
6
|
+
- "mkdir /var/tmp/hello_rundock_from_deploy_src_dir_scenario"
|
7
|
+
- node: anyhost-01
|
8
|
+
command:
|
9
|
+
- "rm -f /var/tmp/hello_rundock_from_deploy_dst_file_scenario"
|
10
|
+
- "rm -fr /var/tmp/hello_rundock_from_deploy_dst_dir_scenario"
|
11
|
+
task:
|
12
|
+
- deploy_task
|
13
|
+
---
|
14
|
+
anyhost-01:
|
15
|
+
host: 172.17.42.1
|
16
|
+
ssh_opts:
|
17
|
+
port: 22222
|
18
|
+
user: tester
|
19
|
+
key: "<replaced_by_platforms>"
|
20
|
+
---
|
21
|
+
deploy_task:
|
22
|
+
deploy:
|
23
|
+
- src: /var/tmp/hello_rundock_from_deploy_src_file_scenario
|
24
|
+
dst: /var/tmp/hello_rundock_from_deploy_dst_file_scenario
|
25
|
+
- src: /var/tmp/hello_rundock_from_deploy_src_dir_scenario
|
26
|
+
dst: /var/tmp/hello_rundock_from_deploy_dst_dir_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.
|
4
|
+
version: 0.3.0
|
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-
|
11
|
+
date: 2015-08-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- lib/rundock/operation/command.rb
|
169
169
|
- lib/rundock/operation/task.rb
|
170
170
|
- lib/rundock/operation_factory.rb
|
171
|
+
- lib/rundock/plugin/operation/deploy.rb
|
171
172
|
- lib/rundock/plugin/operation/host_inventory.rb
|
172
173
|
- lib/rundock/plugin/operation/sample_operation.rb
|
173
174
|
- lib/rundock/runner.rb
|
@@ -178,13 +179,16 @@ files:
|
|
178
179
|
- spec/integration/groups/simple_host_group.yml
|
179
180
|
- spec/integration/platforms/centos6/Dockerfile
|
180
181
|
- spec/integration/platforms/centos6/setup.sh
|
182
|
+
- spec/integration/platforms/localhost/scenarios/deploy_scenario.yml
|
181
183
|
- spec/integration/platforms/localhost/scenarios/run_anyway_scenario.yml
|
182
184
|
- spec/integration/platforms/localhost/scenarios/simple_echo_scenario.yml
|
183
185
|
- spec/integration/platforms/localhost/scenarios/simple_plugin_scenario.yml
|
184
186
|
- spec/integration/platforms/localhost/scenarios/use_default_ssh_scenario.yml
|
187
|
+
- spec/integration/recipes/deploy_spec.rb
|
185
188
|
- spec/integration/recipes/simple_echo_scenario_spec.rb
|
186
189
|
- spec/integration/recipes/simple_echo_spec.rb
|
187
190
|
- spec/integration/recipes/simple_plugin_scenario_spec.rb
|
191
|
+
- spec/integration/scenarios/deploy_scenario.yml
|
188
192
|
- spec/integration/scenarios/simple_echo_scenario.yml
|
189
193
|
- spec/integration/scenarios/simple_plugin_scenario.yml
|
190
194
|
- spec/integration/scenarios/use_default_ssh_scenario.yml
|