pero 0.5.1 → 0.5.2
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/lib/pero/cli.rb +9 -6
- data/lib/pero/puppet.rb +8 -2
- data/lib/pero/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c887b6e9b5f504590d3a89b77630d76fa1bc39823e25b74e0bece76ff74a94b7
|
4
|
+
data.tar.gz: 1147b48bbaf1cdc375ce946c312f14010fc75ba89c4fd610d3c1f6c4a001cfcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0acb6080d4ecfb1499f12628667ad952346bf4a16d97d777b9492bfcf798a86d03ba7d95788a8c84be47c811cf4880de4d03e6d7dedcec298b494fb83a53ed20
|
7
|
+
data.tar.gz: 25ffa99fc93c113cff3e29daa77c369daee6972c4ed1752bd6fa55ea14cf723beca64cbaea9a7b032da5100c7b2aa9d7a04536fbbf45e6ef4031d86efe05a168
|
data/lib/pero/cli.rb
CHANGED
@@ -58,10 +58,12 @@ module Pero
|
|
58
58
|
prepare
|
59
59
|
nodes = Pero::History.search(name_regexp)
|
60
60
|
return unless nodes
|
61
|
+
m = Mutex.new
|
62
|
+
|
61
63
|
begin
|
62
|
-
Parallel.each(nodes,
|
64
|
+
Parallel.each(nodes, in_threads: options["concurrent"]) do |n|
|
63
65
|
opt = merge_options(n, options)
|
64
|
-
puppet = Pero::Puppet.new(opt["host"], opt)
|
66
|
+
puppet = Pero::Puppet.new(opt["host"], opt, m)
|
65
67
|
puppet.apply
|
66
68
|
end
|
67
69
|
rescue => e
|
@@ -71,9 +73,9 @@ module Pero
|
|
71
73
|
ensure
|
72
74
|
if options["one-shot"]
|
73
75
|
Pero.log.info "stop puppet master container"
|
74
|
-
Parallel.each(nodes,
|
76
|
+
Parallel.each(nodes, in_threads: options["concurrent"]) do |n|
|
75
77
|
opt = merge_options(n, options)
|
76
|
-
Pero::Puppet.new(opt["host"], opt).stop_master
|
78
|
+
Pero::Puppet.new(opt["host"], opt, m).stop_master
|
77
79
|
end
|
78
80
|
else
|
79
81
|
Pero.log.info "puppet master container keep running"
|
@@ -88,9 +90,10 @@ module Pero
|
|
88
90
|
def bootstrap(*hosts)
|
89
91
|
begin
|
90
92
|
options["environment"] = "production" if options["environment"].nil? || options["environment"].empty?
|
91
|
-
|
93
|
+
m = Mutex.new
|
94
|
+
Parallel.each(hosts, in_threads: options["concurrent"]) do |host|
|
92
95
|
raise "unknown option #{host}" if host =~ /^-/
|
93
|
-
puppet = Pero::Puppet.new(host, options)
|
96
|
+
puppet = Pero::Puppet.new(host, options, m)
|
94
97
|
|
95
98
|
Pero.log.info "bootstrap pero #{host}"
|
96
99
|
puppet.install
|
data/lib/pero/puppet.rb
CHANGED
@@ -23,8 +23,9 @@ module Pero
|
|
23
23
|
class Puppet
|
24
24
|
extend Pero::SshExecutable
|
25
25
|
attr_reader :specinfra
|
26
|
-
def initialize(host, options)
|
26
|
+
def initialize(host, options, mutex)
|
27
27
|
@options = options.dup
|
28
|
+
@mutex = mutex
|
28
29
|
|
29
30
|
@options[:host] = host
|
30
31
|
so = ssh_options
|
@@ -109,7 +110,12 @@ module Pero
|
|
109
110
|
end
|
110
111
|
|
111
112
|
def run_container
|
112
|
-
|
113
|
+
begin
|
114
|
+
@mutex.lock
|
115
|
+
docker.alerady_run? || docker.run
|
116
|
+
ensure
|
117
|
+
@mutex.unlock
|
118
|
+
end
|
113
119
|
end
|
114
120
|
|
115
121
|
def apply
|
data/lib/pero/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pyama86
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|