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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fa8e3c0220e5ddfff94bb9944e6f3aa07f409c3579811943524da1de45783bd
4
- data.tar.gz: 8ebbe115e81746cfd98b4d4293a8df4301dd598c5c3977a0d2de9129bd4cdd3d
3
+ metadata.gz: c887b6e9b5f504590d3a89b77630d76fa1bc39823e25b74e0bece76ff74a94b7
4
+ data.tar.gz: 1147b48bbaf1cdc375ce946c312f14010fc75ba89c4fd610d3c1f6c4a001cfcb
5
5
  SHA512:
6
- metadata.gz: 45b84acb77370f21318ca8eefb9d8d84279f16b13229181d36fb2119f0247ad84c11205e8a591898ec41771f12e93173a8026c2210c8b5370adf35c312a93b32
7
- data.tar.gz: '079d3f94c94d18fd9b17bf0809704ac1eff8992bc17c1de72c5eac1304a6a60d3b4a2cbe9780b0bbb55bae55e7f502dc9d134e909362c1a78e7ca38737b30d95'
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, in_process: options["concurrent"]) do |n|
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, in_process: options["concurrent"]) do |n|
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
- Parallel.each(hosts, in_process: options["concurrent"]) do |host|
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
- docker.alerady_run? || docker.run
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
@@ -1,3 +1,3 @@
1
1
  module Pero
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
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.1
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-13 00:00:00.000000000 Z
11
+ date: 2021-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor