etcds 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/etcds/version.rb +1 -1
  3. data/lib/etcds.rb +12 -10
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9d26abf546465719f7072a91a3745578f4d0612
4
- data.tar.gz: 382ff2fb4b05bb372481b053e530a559ec20c0b4
3
+ metadata.gz: 354d9bb8e06d2f23e2e36b721a9340b99e12f730
4
+ data.tar.gz: 521dfaa11926d4f9104b053ecdbf1773254ffb55
5
5
  SHA512:
6
- metadata.gz: e0d2baec698ba7c53945167c88a369963577cb58e9ca6e48fb58008be079761049b56be44a6c87e5bf5de576b93b96eabdb564d7f49adf6c163a979f9ffd86c5
7
- data.tar.gz: 11ab07e43b73faf2aa6330221ea9a26b25ae14c917c6ff090bd3d85a84e3c1852052a74b215600bc3d30d9fbc403c2f96a804aa6dce1aa7edbe2d9b9305ad355
6
+ metadata.gz: c9e977d14f4586a66f02c061bfd4e95556c3bd5d7c290dc7cfa3156fe1c7515e4e66917ee1623d6f55aacd7c93b7523f107790736a0958b39ad0852368958233
7
+ data.tar.gz: 3a6fef3d543269357902ee897c2bc6988b3d4cf01bd3c0ae00ef8074bc21612efb0f711bc2b1029be2aa04944718c1f9d522735453fa87ed401b6055f0e4c201
data/lib/etcds/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Etcds
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/etcds.rb CHANGED
@@ -38,12 +38,12 @@ class Etcds
38
38
  end
39
39
 
40
40
  H[:init] = 'prepare ca files for all nodes'
41
- def init
41
+ def init(domain = 'etcd')
42
42
  etcd_ca "init --passphrase ''"
43
43
  @nodes.each do |k, v|
44
44
  ip = v['ip']
45
45
  name = k
46
- etcd_ca "new-cert --passphrase '' --ip #{ip} #{name}"
46
+ etcd_ca "new-cert --passphrase '' --ip #{ip} --domain #{domain} #{name}"
47
47
  etcd_ca "sign --passphrase '' #{name}"
48
48
  etcd_ca "export --insecure --passphrase '' #{name}" +
49
49
  " | tar -C ./certs -xvf -"
@@ -57,11 +57,13 @@ class Etcds
57
57
  H[:install] = "[names...]\tinstall ca files to the host"
58
58
  def install(*hosts)
59
59
  hosts.each do |to|
60
- %w[ca.crt crt key.insecure].each do |what|
61
- name = "#{to}.#{what}"
62
- scp "./certs/#{name} #{to}:/tmp/"
63
- ssh to, "mv /tmp/#{name} /etc/docker/certs.d"
64
- ssh to, "chown root:root /etc/docker/certs.d/#{name}"
60
+ %W[
61
+ #{to}.ca.crt #{to}.crt #{to}.key.insecure
62
+ ca.crt client.crt client.key.insecure
63
+ ].each do |what|
64
+ scp "./certs/#{what} #{to}:/tmp/"
65
+ ssh to, "mv /tmp/#{what} /etc/docker/certs.d"
66
+ ssh to, "chown root:root /etc/docker/certs.d/#{what}"
65
67
  end
66
68
  end
67
69
  end
@@ -131,10 +133,10 @@ class Etcds
131
133
  end
132
134
 
133
135
  H[:health] = 'show cluster health for all nodes'
134
- def health; for_all_run{|n| ctl n, 'cluster-health'} end
136
+ def health; for_all{|n| ctl n, 'cluster-health'} end
135
137
 
136
138
  H[:member] = 'show member list for all nodes'
137
- def member; for_all_run{|n| ctl n, 'member list'} end
139
+ def member; for_all{|n| ctl n, 'member list'} end
138
140
 
139
141
  H[:ctl] = "[name] commands\tpass commands to etcdctl"
140
142
  def ctl(n, *args)
@@ -160,7 +162,7 @@ private
160
162
  IO.popen({'DOCKER_HOST' => "tcp://#{ip}:2376"}, "docker #{cmd}").read
161
163
  end
162
164
 
163
- def for_all_run(&block)
165
+ def for_all(&block)
164
166
  @nodes.keys.each do |n|
165
167
  if run?(n)
166
168
  puts "Node #{n}:".on_blue
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etcds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Takiuchi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-16 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize