rundock 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -0
- data/Rakefile +5 -2
- data/lib/rundock/backend.rb +1 -1
- data/lib/rundock/builder/operation_builder.rb +1 -1
- data/lib/rundock/builder/target_builder.rb +2 -2
- data/lib/rundock/runner.rb +5 -7
- data/lib/rundock/version.rb +1 -1
- data/spec/integration/groups/simple_host_group.yml +3 -3
- data/spec/integration/platforms/centos6/setup.sh +21 -9
- data/spec/integration/scenarios/all_file_hooks_by_option_scenario.yml +3 -3
- data/spec/integration/scenarios/cwd_scenario.yml +3 -3
- data/spec/integration/scenarios/deploy_erb_scenario.yml +3 -3
- data/spec/integration/scenarios/deploy_scenario.yml +3 -3
- data/spec/integration/scenarios/file_hooks_by_option_scenario.yml +3 -3
- data/spec/integration/scenarios/file_hooks_scenario.yml +3 -3
- data/spec/integration/scenarios/simple_echo_scenario.yml +6 -6
- data/spec/integration/scenarios/simple_plugin_scenario.yml +3 -3
- data/spec/integration/scenarios/sudo_scenario.yml +3 -3
- data/spec/integration/scenarios/target_group_scenario.yml +6 -6
- data/spec/integration/scenarios/task_by_option_scenario.yml +3 -3
- data/spec/integration/scenarios/task_with_args_scenario.yml +3 -3
- data/spec/integration/targets/target_by_option.yml +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0a18e2fe745300ae9f65c19888268983681a74b
|
4
|
+
data.tar.gz: f9683ce81d50dad93028198bd475608078fefdab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7f65308868d53438a140fe859ee387f5f8578215a3cedd554bd9d9183514eb3403438da8280bf7baf6b65c09a62ea975a03f80079b3f8be7305535d66b4838e
|
7
|
+
data.tar.gz: 4aba11b47b26ed6bbfd819cc91d72aa61873c7fbbdc5b0e0eae50806ab4a3502ca7f1cf1b36c5070db6e59219230a18630927f391eea900fe0bb42a36f3cfd1a
|
data/.rubocop.yml
CHANGED
@@ -17,6 +17,9 @@ Metrics/MethodLength:
|
|
17
17
|
CountComments: false # count full line comments?
|
18
18
|
Max: 50
|
19
19
|
|
20
|
+
Metrics/BlockLength:
|
21
|
+
Max: 50
|
22
|
+
|
20
23
|
Metrics/AbcSize:
|
21
24
|
Enabled: true
|
22
25
|
Max: 100
|
@@ -57,5 +60,11 @@ Style/Alias:
|
|
57
60
|
Style/MutableConstant:
|
58
61
|
Enabled: false
|
59
62
|
|
63
|
+
Style/NumericPredicate:
|
64
|
+
Enabled: false
|
65
|
+
|
66
|
+
Style/MethodMissing:
|
67
|
+
Enabled: false
|
68
|
+
|
60
69
|
Lint/UnusedMethodArgument:
|
61
70
|
Enabled: false
|
data/Rakefile
CHANGED
@@ -44,13 +44,16 @@ def do_rundock_ssh(commands, platform)
|
|
44
44
|
execute("bundle exec exe/rundock ssh -c \"#{cmd}\" -h localhost -l debug", true, true)
|
45
45
|
end
|
46
46
|
else
|
47
|
+
host = `cat #{ENV['HOME']}/.ssh/config_rundock_spec_#{platform} | grep 'HostName ' | awk '{print $2}' | tr -d '\n'`
|
48
|
+
port = `cat #{ENV['HOME']}/.ssh/config_rundock_spec_#{platform} | grep 'Port ' | awk '{print $2}' | tr -d '\n'`
|
49
|
+
|
47
50
|
commands.each do |cmd|
|
48
51
|
execute('bundle exec exe/rundock' \
|
49
|
-
" ssh -c \"#{cmd}\" -h
|
52
|
+
" ssh -c \"#{cmd}\" -h #{host} -p #{port} -u tester" \
|
50
53
|
" -i #{ENV['HOME']}/.ssh/id_rsa_rundock_spec_#{platform}_tmp -l debug", true, true)
|
51
54
|
Dir.glob(groups_files_pattern).each do |g|
|
52
55
|
execute('bundle exec exe/rundock' \
|
53
|
-
" ssh -c \"#{cmd}\" -g #{g} -p
|
56
|
+
" ssh -c \"#{cmd}\" -g #{g} -p #{port} -u tester" \
|
54
57
|
" -i #{ENV['HOME']}/.ssh/id_rsa_rundock_spec_#{platform}_tmp -l debug", true, true)
|
55
58
|
end
|
56
59
|
end
|
data/lib/rundock/backend.rb
CHANGED
@@ -16,11 +16,11 @@ module Rundock
|
|
16
16
|
backend_builder = BackendBuilder.new(@options, target_name, target_info)
|
17
17
|
backend = backend_builder.build
|
18
18
|
@parsed_node_options = { target_name.to_sym => backend_builder.parsed_options }
|
19
|
-
|
20
|
-
return Node.new(target_name, backend)
|
21
19
|
else
|
22
20
|
raise TargetNoSupportError
|
23
21
|
end
|
22
|
+
|
23
|
+
Node.new(target_name, backend)
|
24
24
|
end
|
25
25
|
|
26
26
|
def build_group(target_group_name, target_info)
|
data/lib/rundock/runner.rb
CHANGED
@@ -29,13 +29,11 @@ module Rundock
|
|
29
29
|
|
30
30
|
def build(options)
|
31
31
|
if options[:scenario] || options[:targetgroup]
|
32
|
-
raise ScenarioNotFoundError,
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
options[:targetgroup] &&
|
38
|
-
!FileTest.exist?(options[:targetgroup])
|
32
|
+
raise ScenarioNotFoundError, "'#{options[:scenario]}' scenario file is not found." if options[:scenario] &&
|
33
|
+
!FileTest.exist?(options[:scenario])
|
34
|
+
raise ScenarioNotFoundError, "'#{options[:targetgroup]}' targetgroup file is not found." if options[:command] &&
|
35
|
+
options[:targetgroup] &&
|
36
|
+
!FileTest.exist?(options[:targetgroup])
|
39
37
|
|
40
38
|
options[:scenario] = options[:targetgroup] if options[:command] && options[:targetgroup]
|
41
39
|
|
data/lib/rundock/version.rb
CHANGED
@@ -6,10 +6,10 @@ PROJECT_NAME=rundock_spec
|
|
6
6
|
PLATFORM_NAME=centos6
|
7
7
|
PLATFORM_DIR="${PROJECT_ROOT}/platforms/${PLATFORM_NAME}"
|
8
8
|
DOCKER_IMAGE_NAME="${PROJECT_NAME}/${PLATFORM_NAME}"
|
9
|
-
|
9
|
+
DOCKER_BRIDGE_ADDRESS=`ip addr show | grep "global docker0" | awk '{print $2}' | cut -d'/' -f1`
|
10
|
+
DOCKER_BRIDGE_SSH_PORT=22222
|
10
11
|
DOCKER_CACHE_DIR="${HOME}/docker"
|
11
12
|
DOCKER_CACHE_IMAGE_PATH="${DOCKER_CACHE_DIR}/${PLATFORM_NAME}.tar"
|
12
|
-
DOCKER_SSH_PORT=22222
|
13
13
|
DOCKER_SSH_USER=tester
|
14
14
|
DOCKER_SSH_KEY_PRIVATE="${HOME}/.ssh/id_rsa_${PROJECT_NAME}_${PLATFORM_NAME}_tmp"
|
15
15
|
DOCKER_SSH_KEY_PUBLIC_LOCAL="${HOME}/.ssh/id_rsa_${PROJECT_NAME}_${PLATFORM_NAME}_tmp.pub"
|
@@ -49,7 +49,7 @@ mkdir -p "${RUNDOCK_TARGET_CACHE_DIR}"
|
|
49
49
|
if [ ! -f ${RUNDOCK_DEFAULT_SSH_YML} ]; then
|
50
50
|
(
|
51
51
|
cat << EOP
|
52
|
-
:port: ${
|
52
|
+
:port: ${DOCKER_BRIDGE_SSH_PORT}
|
53
53
|
:paranoid: false
|
54
54
|
:user: "${DOCKER_SSH_USER}"
|
55
55
|
:keys: ["${DOCKER_SSH_KEY_PRIVATE}"]
|
@@ -62,11 +62,23 @@ cp ${RUNDOCK_GROUP_DIR}/* ${RUNDOCK_GROUP_CACHE_DIR}
|
|
62
62
|
cp ${RUNDOCK_TARGET_DIR}/* ${RUNDOCK_TARGET_CACHE_DIR}
|
63
63
|
|
64
64
|
find ${RUNDOCK_SCENARIO_CACHE_DIR} -type f -name "*_scenario.yml" | \
|
65
|
-
xargs sed -i -e "s#<
|
65
|
+
xargs sed -i -e "s#<replaced_by_platforms_key>#${DOCKER_SSH_KEY_PRIVATE}#g"
|
66
66
|
find ${RUNDOCK_GROUP_CACHE_DIR} -type f -name "*_group.yml" | \
|
67
|
-
xargs sed -i -e "s#<
|
67
|
+
xargs sed -i -e "s#<replaced_by_platforms_key>#${DOCKER_SSH_KEY_PRIVATE}#g"
|
68
68
|
find ${RUNDOCK_TARGET_CACHE_DIR} -type f -name "*.yml" | \
|
69
|
-
xargs sed -i -e "s#<
|
69
|
+
xargs sed -i -e "s#<replaced_by_platforms_key>#${DOCKER_SSH_KEY_PRIVATE}#g"
|
70
|
+
find ${RUNDOCK_SCENARIO_CACHE_DIR} -type f -name "*_scenario.yml" | \
|
71
|
+
xargs sed -i -e "s#<replaced_by_platforms_host>#${DOCKER_BRIDGE_ADDRESS}#g"
|
72
|
+
find ${RUNDOCK_GROUP_CACHE_DIR} -type f -name "*_group.yml" | \
|
73
|
+
xargs sed -i -e "s#<replaced_by_platforms_host>#${DOCKER_BRIDGE_ADDRESS}#g"
|
74
|
+
find ${RUNDOCK_TARGET_CACHE_DIR} -type f -name "*.yml" | \
|
75
|
+
xargs sed -i -e "s#<replaced_by_platforms_host>#${DOCKER_BRIDGE_ADDRESS}#g"
|
76
|
+
find ${RUNDOCK_SCENARIO_CACHE_DIR} -type f -name "*_scenario.yml" | \
|
77
|
+
xargs sed -i -e "s#<replaced_by_platforms_port>#${DOCKER_BRIDGE_SSH_PORT}#g"
|
78
|
+
find ${RUNDOCK_GROUP_CACHE_DIR} -type f -name "*_group.yml" | \
|
79
|
+
xargs sed -i -e "s#<replaced_by_platforms_port>#${DOCKER_BRIDGE_SSH_PORT}#g"
|
80
|
+
find ${RUNDOCK_TARGET_CACHE_DIR} -type f -name "*.yml" | \
|
81
|
+
xargs sed -i -e "s#<replaced_by_platforms_port>#${DOCKER_BRIDGE_SSH_PORT}#g"
|
70
82
|
|
71
83
|
sudo docker ps | grep "${DOCKER_IMAGE_NAME}" && { echo "docker image is already standing."; exit 0; }
|
72
84
|
|
@@ -85,11 +97,11 @@ sudo docker build -t "${DOCKER_IMAGE_NAME}" ${PLATFORM_DIR}
|
|
85
97
|
rm -f ${DOCKER_SSH_KEY_PUBLIC_REMOTE}
|
86
98
|
mkdir -p ${DOCKER_CACHE_DIR}
|
87
99
|
sudo docker save "${DOCKER_IMAGE_NAME}" > ${DOCKER_CACHE_IMAGE_PATH}
|
88
|
-
sudo docker run -d --privileged -p ${
|
100
|
+
sudo docker run -d --privileged -p ${DOCKER_BRIDGE_ADDRESS}:${DOCKER_BRIDGE_SSH_PORT}:22 "${DOCKER_IMAGE_NAME}"
|
89
101
|
|
90
102
|
echo "Host ${PLATFORM_NAME}" > $DOCKER_SSH_CONFIG
|
91
|
-
echo " HostName ${
|
103
|
+
echo " HostName ${DOCKER_BRIDGE_ADDRESS}" >> $DOCKER_SSH_CONFIG
|
92
104
|
echo " User ${DOCKER_SSH_USER}" >> $DOCKER_SSH_CONFIG
|
93
|
-
echo " Port ${
|
105
|
+
echo " Port ${DOCKER_BRIDGE_SSH_PORT}" >> $DOCKER_SSH_CONFIG
|
94
106
|
echo " IdentityFile ${DOCKER_SSH_KEY_PRIVATE}" >> $DOCKER_SSH_CONFIG
|
95
107
|
echo " StrictHostKeyChecking no" >> $DOCKER_SSH_CONFIG
|
@@ -6,11 +6,11 @@
|
|
6
6
|
- pwd_echo
|
7
7
|
---
|
8
8
|
anyhost-01:
|
9
|
-
host:
|
9
|
+
host: <replaced_by_platforms_host>
|
10
10
|
ssh_opts:
|
11
|
-
port:
|
11
|
+
port: <replaced_by_platforms_port>
|
12
12
|
user: tester
|
13
|
-
key: "<
|
13
|
+
key: "<replaced_by_platforms_key>"
|
14
14
|
---
|
15
15
|
pwd_echo:
|
16
16
|
command:
|
@@ -8,11 +8,11 @@
|
|
8
8
|
- deploy_task
|
9
9
|
---
|
10
10
|
anyhost-01:
|
11
|
-
host:
|
11
|
+
host: <replaced_by_platforms_host>
|
12
12
|
ssh_opts:
|
13
|
-
port:
|
13
|
+
port: <replaced_by_platforms_port>
|
14
14
|
user: tester
|
15
|
-
key: "<
|
15
|
+
key: "<replaced_by_platforms_key>"
|
16
16
|
---
|
17
17
|
deploy_task:
|
18
18
|
command:
|
@@ -12,11 +12,11 @@
|
|
12
12
|
- deploy_task
|
13
13
|
---
|
14
14
|
anyhost-01:
|
15
|
-
host:
|
15
|
+
host: <replaced_by_platforms_host>
|
16
16
|
ssh_opts:
|
17
|
-
port:
|
17
|
+
port: <replaced_by_platforms_port>
|
18
18
|
user: tester
|
19
|
-
key: "<
|
19
|
+
key: "<replaced_by_platforms_key>"
|
20
20
|
---
|
21
21
|
deploy_task:
|
22
22
|
deploy:
|
@@ -9,11 +9,11 @@
|
|
9
9
|
- file_hook_two
|
10
10
|
---
|
11
11
|
anyhost-01:
|
12
|
-
host:
|
12
|
+
host: <replaced_by_platforms_host>
|
13
13
|
ssh_opts:
|
14
|
-
port:
|
14
|
+
port: <replaced_by_platforms_port>
|
15
15
|
user: tester
|
16
|
-
key: "<
|
16
|
+
key: "<replaced_by_platforms_key>"
|
17
17
|
---
|
18
18
|
---
|
19
19
|
file_hook_one:
|
@@ -15,18 +15,18 @@
|
|
15
15
|
---
|
16
16
|
anyhost-01:
|
17
17
|
target_type: host
|
18
|
-
host:
|
18
|
+
host: <replaced_by_platforms_host>
|
19
19
|
ssh_opts:
|
20
|
-
port:
|
20
|
+
port: <replaced_by_platforms_port>
|
21
21
|
user: tester
|
22
|
-
key: "<
|
22
|
+
key: "<replaced_by_platforms_key>"
|
23
23
|
anyhost-02:
|
24
24
|
target_type: host
|
25
|
-
host: "
|
25
|
+
host: "<replaced_by_platforms_host>"
|
26
26
|
ssh_opts:
|
27
|
-
port:
|
27
|
+
port: <replaced_by_platforms_port>
|
28
28
|
user: tester
|
29
|
-
keys: ["<
|
29
|
+
keys: ["<replaced_by_platforms_key>"]
|
30
30
|
---
|
31
31
|
echo_platform:
|
32
32
|
command:
|
@@ -3,11 +3,11 @@
|
|
3
3
|
- write_echo
|
4
4
|
---
|
5
5
|
anyhost-01:
|
6
|
-
host:
|
6
|
+
host: <replaced_by_platforms_host>
|
7
7
|
ssh_opts:
|
8
|
-
port:
|
8
|
+
port: <replaced_by_platforms_port>
|
9
9
|
user: tester
|
10
|
-
key: "<
|
10
|
+
key: "<replaced_by_platforms_key>"
|
11
11
|
---
|
12
12
|
write_echo:
|
13
13
|
sample_operation:
|
@@ -6,11 +6,11 @@
|
|
6
6
|
- sudo_touch
|
7
7
|
---
|
8
8
|
anyhost-01:
|
9
|
-
host:
|
9
|
+
host: <replaced_by_platforms_host>
|
10
10
|
ssh_opts:
|
11
|
-
port:
|
11
|
+
port: <replaced_by_platforms_port>
|
12
12
|
user: tester
|
13
|
-
key: "<
|
13
|
+
key: "<replaced_by_platforms_key>"
|
14
14
|
---
|
15
15
|
sudo_touch:
|
16
16
|
command:
|
@@ -19,18 +19,18 @@ target_group_02:
|
|
19
19
|
- anyhost-02
|
20
20
|
anyhost-01:
|
21
21
|
target_type: host
|
22
|
-
host:
|
22
|
+
host: <replaced_by_platforms_host>
|
23
23
|
ssh_opts:
|
24
|
-
port:
|
24
|
+
port: <replaced_by_platforms_port>
|
25
25
|
user: tester
|
26
|
-
key: "<
|
26
|
+
key: "<replaced_by_platforms_key>"
|
27
27
|
anyhost-02:
|
28
28
|
target_type: host
|
29
|
-
host: "
|
29
|
+
host: "<replaced_by_platforms_host>"
|
30
30
|
ssh_opts:
|
31
|
-
port:
|
31
|
+
port: <replaced_by_platforms_port>
|
32
32
|
user: tester
|
33
|
-
keys: ["<
|
33
|
+
keys: ["<replaced_by_platforms_key>"]
|
34
34
|
---
|
35
35
|
write_echo_01:
|
36
36
|
command:
|
@@ -6,11 +6,11 @@
|
|
6
6
|
---
|
7
7
|
anyhost-01:
|
8
8
|
target_type: host
|
9
|
-
host:
|
9
|
+
host: <replaced_by_platforms_host>
|
10
10
|
ssh_opts:
|
11
|
-
port:
|
11
|
+
port: <replaced_by_platforms_port>
|
12
12
|
user: tester
|
13
|
-
key: "<
|
13
|
+
key: "<replaced_by_platforms_key>"
|
14
14
|
---
|
15
15
|
write_echo:
|
16
16
|
command:
|
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.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hiracy
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -258,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
258
258
|
version: '0'
|
259
259
|
requirements: []
|
260
260
|
rubyforge_project:
|
261
|
-
rubygems_version: 2.
|
261
|
+
rubygems_version: 2.5.1
|
262
262
|
signing_key:
|
263
263
|
specification_version: 4
|
264
264
|
summary: Simple and extensible server orchestration framework
|