pero 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80cef5729ae09df0448c266e6e5367f846bf2d9c1b335e0f35bf02b7437924fd
4
- data.tar.gz: 51f5b3b7dd9630bede9fa570832d2a4825a9e959b69128cc5369480cd796447a
3
+ metadata.gz: 208ce0604ff4e559eecfa0452a556a17a61a0ea4f2084857f9e336a10dbe16ef
4
+ data.tar.gz: 5a99444148e96ff2eef5605eb699c781fc4508de74994c2ccc8f1fbb1a890b9e
5
5
  SHA512:
6
- metadata.gz: 22104b9d4f8d1a8b3a594c93d8aaf352cc147bae97f988f44e6e4cd6fc7af899097c7ff6827c474afa520d2fc0af268b86131eecbacf2bf362885d5380b3ca52
7
- data.tar.gz: 158cd30a1ce205662ca59a3d2676bc587d5da64b0ffc26ffc25bd860e60aeba2d24e6561469a6fbdd21cbe5e8469949df9b6790e3e5f269868839597730cc3a5
6
+ metadata.gz: 7fe6677270fa6df8285522185a25d3907622e932a273559e3960bc36c2e373120d144f488933203fb8c5a25a67cef0c4dafcb4b6b689c6da6d810beb24f9f90d
7
+ data.tar.gz: 3b7939123640c8b468713db68ae1f1aa5f21e847bceef42f6b4daf77f23c3871ccbe68a2072542081d192acc9b53e4589be1fe40acfb7add47dc387cbb298239
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ reports
5
5
  run
6
6
  yaml
7
7
  log
8
+ pkg
@@ -50,11 +50,11 @@ module Pero
50
50
  end
51
51
  end
52
52
 
53
- desc "install", "install puppet"
53
+ desc "bootstrap", "bootstrap pero"
54
54
  shared_options
55
- option "agent-version", default: "6.17.0", type: :string
55
+ option "agent-version", type: :string
56
56
  option "node-name", aliases: '-N', default: "", type: :string, desc: "json node name(default hostname)"
57
- def install(*hosts)
57
+ def bootstrap(*hosts)
58
58
  Parallel.each(hosts, in_process: options["concurrent"]) do |host|
59
59
  next if host =~ /^-/
60
60
  puppet = Pero::Puppet.new(host, options)
@@ -73,7 +73,7 @@ module Pero
73
73
  end
74
74
 
75
75
  def install
76
- Pero.log.info "bootstrap puppet"
76
+ Pero.log.info "bootstrap pero"
77
77
  osi = specinfra.os_info
78
78
  os = case osi[:family]
79
79
  when "redhat"
@@ -81,7 +81,7 @@ module Pero
81
81
  else
82
82
  raise "sorry unsupport os, please pull request!!!"
83
83
  end
84
- os.install(@options["agent-version"])
84
+ os.install(@options["agent-version"]) unless @options["agent-version"].empty?
85
85
  Pero::History::Attribute.new(specinfra, @options).save
86
86
  end
87
87
 
@@ -94,8 +94,10 @@ module Pero
94
94
  Pero.log.error e.inspect
95
95
  raise e
96
96
  ensure
97
- Pero.log.info "stop puppet master container"
98
- container.kill if @options["one-shot"]
97
+ if @options["one-shot"]
98
+ Pero.log.info "stop puppet master container"
99
+ container.kill
100
+ end
99
101
  end
100
102
  end
101
103
 
@@ -108,20 +110,20 @@ module Pero
108
110
  serve_master do |container|
109
111
  port = container.info["Ports"].first["PublicPort"]
110
112
  begin
111
- tmpdir=(0...8).map{ (65 + rand(26)).chr }.join
113
+ tmpdir=container.info["id"][0..5]
112
114
  Pero.log.info "start forwarding port:#{port}"
113
115
 
114
116
  in_ssh_forwarding(port) do |host, ssh|
115
117
  Pero.log.info "#{host}:puppet cmd[#{puppet_cmd}]"
116
- cmd = "unshare -m -- /bin/bash -c 'export PATH=$PATH:/opt/puppetlabs/bin/ && mkdir -p /tmp/puppet/#{tmpdir} && \
117
- mkdir -p `puppet config print ssldir` && mount --bind /tmp/puppet/#{tmpdir} `puppet config print ssldir` && \
118
+ cmd = "mkdir -p /tmp/puppet/#{tmpdir} && unshare -m -- /bin/bash -c 'export PATH=$PATH:/opt/puppetlabs/bin/ && \
119
+ mkdir -p `puppet config print ssldir` && mount --bind /tmp/puppet/#{tmpdir} `puppet config print ssldir` && \
118
120
  #{puppet_cmd}'"
119
121
  Pero.log.debug "run cmd:#{cmd}"
120
122
  ssh.exec!(specinfra.build_command(cmd)) do |channel, stream, data|
121
123
  Pero.log.info "#{host}:#{data.chomp}" if stream == :stdout && data.chomp != ""
122
124
  Pero.log.warn "#{host}:#{data.chomp}" if stream == :stderr && data.chomp != ""
123
125
  end
124
- ssh.exec!(specinfra.build_command("rm -rf /tmp/puppet/#{tmpdir}"))
126
+ ssh.exec!(specinfra.build_command("rm -rf /tmp/puppet/#{tmpdir}")) if @options["one-shot"]
125
127
  ssh.loop {true} if ENV['PERO_DEBUG']
126
128
  end
127
129
  rescue => e
@@ -1,3 +1,3 @@
1
1
  module Pero
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyama86