rundock 1.0.5 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa664318ebae9c57a378f4e5ccef806395eb2fbc
4
- data.tar.gz: 45d2618d0d9b0e76180ca754d5f4d39d3009abe2
3
+ metadata.gz: e0a18e2fe745300ae9f65c19888268983681a74b
4
+ data.tar.gz: f9683ce81d50dad93028198bd475608078fefdab
5
5
  SHA512:
6
- metadata.gz: 2f9114c8b24850151732f713e4d9311d90d75b0597032af5c402a427aa7d1de4b2bce37e3c9de0e76fb86ef58472f7fd606bc82faeb37bd82780f9ed5458ae59
7
- data.tar.gz: 70295a6126b533ed8863bef489f2483d9269f006a7984bb46b22cb1d9271ae7daf9249a443a68f96b00b37d47455c402416450f6b26cd5d5e7ea3f571f155bc3
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 172.17.42.1 -p 22222 -u tester" \
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 22222 -u tester" \
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
@@ -57,7 +57,7 @@ module Rundock
57
57
 
58
58
  Logger.debug(%(Start executing: "#{command}"))
59
59
 
60
- return nil if options[:dry_run]
60
+ return nil if exec_options[:dry_run]
61
61
 
62
62
  result = @backend.run_command(command)
63
63
  exit_status = result.exit_status
@@ -126,7 +126,7 @@ module Rundock
126
126
  else
127
127
  !cli_options[:run_anyway]
128
128
  end
129
- node_attributes.dry_run = (cli_options && cli_options[:dry_run]) ? true : false
129
+ node_attributes.dry_run = cli_options && cli_options[:dry_run]
130
130
  end
131
131
 
132
132
  # override by scenario
@@ -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)
@@ -29,13 +29,11 @@ module Rundock
29
29
 
30
30
  def build(options)
31
31
  if options[:scenario] || options[:targetgroup]
32
- raise ScenarioNotFoundError,
33
- "'#{options[:scenario]}' scenario file is not found." if options[:scenario] &&
34
- !FileTest.exist?(options[:scenario])
35
- raise ScenarioNotFoundError,
36
- "'#{options[:targetgroup]}' targetgroup file is not found." if options[:command] &&
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
 
@@ -1,3 +1,3 @@
1
1
  module Rundock
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.6'
3
3
  end
@@ -5,8 +5,8 @@
5
5
  ---
6
6
  anyhost-01:
7
7
  target_type: host
8
- host: 172.17.42.1
8
+ host: <replaced_by_platforms_host>
9
9
  ssh_opts:
10
- port: 22222
10
+ port: <replaced_by_platforms_port>
11
11
  user: tester
12
- key: "<replaced_by_platforms>"
12
+ key: "<replaced_by_platforms_key>"
@@ -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
- DOCKER_ADDRESS="172.17.42.1"
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: ${DOCKER_SSH_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#<replaced_by_platforms>#${DOCKER_SSH_KEY_PRIVATE}#g"
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#<replaced_by_platforms>#${DOCKER_SSH_KEY_PRIVATE}#g"
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#<replaced_by_platforms>#${DOCKER_SSH_KEY_PRIVATE}#g"
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 ${DOCKER_ADDRESS}:${DOCKER_SSH_PORT}:22 "${DOCKER_IMAGE_NAME}"
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 ${DOCKER_ADDRESS}" >> $DOCKER_SSH_CONFIG
103
+ echo " HostName ${DOCKER_BRIDGE_ADDRESS}" >> $DOCKER_SSH_CONFIG
92
104
  echo " User ${DOCKER_SSH_USER}" >> $DOCKER_SSH_CONFIG
93
- echo " Port ${DOCKER_SSH_PORT}" >> $DOCKER_SSH_CONFIG
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
@@ -7,8 +7,8 @@
7
7
  hook: all
8
8
  ---
9
9
  anyhost-01:
10
- host: 172.17.42.1
10
+ host: <replaced_by_platforms_host>
11
11
  ssh_opts:
12
- port: 22222
12
+ port: <replaced_by_platforms_port>
13
13
  user: tester
14
- key: "<replaced_by_platforms>"
14
+ key: "<replaced_by_platforms_key>"
@@ -6,11 +6,11 @@
6
6
  - pwd_echo
7
7
  ---
8
8
  anyhost-01:
9
- host: 172.17.42.1
9
+ host: <replaced_by_platforms_host>
10
10
  ssh_opts:
11
- port: 22222
11
+ port: <replaced_by_platforms_port>
12
12
  user: tester
13
- key: "<replaced_by_platforms>"
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: 172.17.42.1
11
+ host: <replaced_by_platforms_host>
12
12
  ssh_opts:
13
- port: 22222
13
+ port: <replaced_by_platforms_port>
14
14
  user: tester
15
- key: "<replaced_by_platforms>"
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: 172.17.42.1
15
+ host: <replaced_by_platforms_host>
16
16
  ssh_opts:
17
- port: 22222
17
+ port: <replaced_by_platforms_port>
18
18
  user: tester
19
- key: "<replaced_by_platforms>"
19
+ key: "<replaced_by_platforms_key>"
20
20
  ---
21
21
  deploy_task:
22
22
  deploy:
@@ -14,8 +14,8 @@
14
14
  - file_array_2
15
15
  ---
16
16
  anyhost-01:
17
- host: 172.17.42.1
17
+ host: <replaced_by_platforms_host>
18
18
  ssh_opts:
19
- port: 22222
19
+ port: <replaced_by_platforms_port>
20
20
  user: tester
21
- key: "<replaced_by_platforms>"
21
+ key: "<replaced_by_platforms_key>"
@@ -9,11 +9,11 @@
9
9
  - file_hook_two
10
10
  ---
11
11
  anyhost-01:
12
- host: 172.17.42.1
12
+ host: <replaced_by_platforms_host>
13
13
  ssh_opts:
14
- port: 22222
14
+ port: <replaced_by_platforms_port>
15
15
  user: tester
16
- key: "<replaced_by_platforms>"
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: 172.17.42.1
18
+ host: <replaced_by_platforms_host>
19
19
  ssh_opts:
20
- port: 22222
20
+ port: <replaced_by_platforms_port>
21
21
  user: tester
22
- key: "<replaced_by_platforms>"
22
+ key: "<replaced_by_platforms_key>"
23
23
  anyhost-02:
24
24
  target_type: host
25
- host: "172.17.42.1"
25
+ host: "<replaced_by_platforms_host>"
26
26
  ssh_opts:
27
- port: 22222
27
+ port: <replaced_by_platforms_port>
28
28
  user: tester
29
- keys: ["<replaced_by_platforms>"]
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: 172.17.42.1
6
+ host: <replaced_by_platforms_host>
7
7
  ssh_opts:
8
- port: 22222
8
+ port: <replaced_by_platforms_port>
9
9
  user: tester
10
- key: "<replaced_by_platforms>"
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: 172.17.42.1
9
+ host: <replaced_by_platforms_host>
10
10
  ssh_opts:
11
- port: 22222
11
+ port: <replaced_by_platforms_port>
12
12
  user: tester
13
- key: "<replaced_by_platforms>"
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: 172.17.42.1
22
+ host: <replaced_by_platforms_host>
23
23
  ssh_opts:
24
- port: 22222
24
+ port: <replaced_by_platforms_port>
25
25
  user: tester
26
- key: "<replaced_by_platforms>"
26
+ key: "<replaced_by_platforms_key>"
27
27
  anyhost-02:
28
28
  target_type: host
29
- host: "172.17.42.1"
29
+ host: "<replaced_by_platforms_host>"
30
30
  ssh_opts:
31
- port: 22222
31
+ port: <replaced_by_platforms_port>
32
32
  user: tester
33
- keys: ["<replaced_by_platforms>"]
33
+ keys: ["<replaced_by_platforms_key>"]
34
34
  ---
35
35
  write_echo_01:
36
36
  command:
@@ -9,8 +9,8 @@
9
9
  ---
10
10
  anyhost-01:
11
11
  target_type: host
12
- host: 172.17.42.1
12
+ host: <replaced_by_platforms_host>
13
13
  ssh_opts:
14
- port: 22222
14
+ port: <replaced_by_platforms_port>
15
15
  user: tester
16
- key: "<replaced_by_platforms>"
16
+ key: "<replaced_by_platforms_key>"
@@ -6,11 +6,11 @@
6
6
  ---
7
7
  anyhost-01:
8
8
  target_type: host
9
- host: 172.17.42.1
9
+ host: <replaced_by_platforms_host>
10
10
  ssh_opts:
11
- port: 22222
11
+ port: <replaced_by_platforms_port>
12
12
  user: tester
13
- key: "<replaced_by_platforms>"
13
+ key: "<replaced_by_platforms_key>"
14
14
  ---
15
15
  write_echo:
16
16
  command:
@@ -1,8 +1,8 @@
1
1
  anyhost-01:
2
2
  target_type: host
3
- host: 172.17.42.1
3
+ host: <replaced_by_platforms_host>
4
4
  ssh_opts:
5
- port: 22222
5
+ port: <replaced_by_platforms_port>
6
6
  user: tester
7
- key: "<replaced_by_platforms>"
7
+ key: "<replaced_by_platforms_key>"
8
8
 
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.5
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: 2016-07-27 00:00:00.000000000 Z
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.6.3
261
+ rubygems_version: 2.5.1
262
262
  signing_key:
263
263
  specification_version: 4
264
264
  summary: Simple and extensible server orchestration framework