joyent-provisioner 0.3.1 → 0.3.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
  SHA1:
3
- metadata.gz: fa248d1cf9f18ede6e0ad3e8485fe325ba1fc95f
4
- data.tar.gz: 40f04cc5329317d54febf9ff74317c5dbd26b5ef
3
+ metadata.gz: 374a06e6f9a44bb73cd79c65803d13bf58fb4974
4
+ data.tar.gz: c2c9cca5a9df5c16d712091e91620a80b3d500e5
5
5
  SHA512:
6
- metadata.gz: a444c2695fdfd38d8af205800c07f49329f10e8daeceef49ca0d127cf8051a41ed2802981fe4615224cf255cafb06a5c0559ea6119d7c54bb4370e04d422be97
7
- data.tar.gz: 70f817b1523020ed4650f698be20513a65b61371a11549e9b789b7d6773f05aa339b74f5458b3e15640011cca6919fa601e74e41be7a7fc1c374bd77ac7effa2
6
+ metadata.gz: dd46f84e49cae55bcb6977b0fae1050a77333a632a5a0a3489f9b37e8075900dfa0dc7654643bb9e86b04718a12c8c7e584411b3ebb7bdded5f965770fc70cc9
7
+ data.tar.gz: 0bca1f8ffe0470dc9049ab5955a1f4700b0ab88ab65bfda824beee1060b40896b83127fd9600b941ed4a6cf8de5f8c747e90b33608750a30117620d30e2f4423
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Joyent Cloud Provisioner
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/joyent-provisioner.png)](http://badge.fury.io/rb/joyent-provisioner)
3
4
  [![Build status](https://secure.travis-ci.org/wanelo/joyent-provisioner.png)](http://travis-ci.org/wanelo/joyent-provisioner)
4
5
 
5
6
  This gem provides a ruby class and a command line tool to simplify provisioning of clusters of hosts in the
@@ -12,14 +12,16 @@ module Provisioner
12
12
  def self.ips
13
13
  @ips = {}
14
14
  server_list.each do |server|
15
- hostname, ip = server.split(' ').compact
16
- @ips[hostname] = ip
15
+ # example line
16
+ # 4330e738-2bca-ee10-f9a6-e9a1b3fcfdec vpn001.prod running virtualmachine sdc:jpc:ubuntu-12.04:2.4. g3-highcpu-1.75-kvm 9.12.42.172,10.100.114.217 1.75 GB 75 GB
17
+ zone, hostname, status, type, image, flavor, ips = server.split(/\s+/).compact
18
+ @ips[hostname] = (ips.split(',') || []).first
17
19
  end
18
20
  @ips
19
21
  end
20
22
 
21
23
  def self.server_list
22
- @server_list ||= `knife joyent server list | awk '{print $2 " " $7}' | tail +2`.split("\n")
24
+ @server_list ||= `knife joyent server list | tail +2`.split("\n")
23
25
  end
24
26
  end
25
27
  end
@@ -1,3 +1,3 @@
1
1
  module Provisioner
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -3,9 +3,10 @@ require 'spec_helper'
3
3
  describe Provisioner::HostIP do
4
4
  describe '.ip_for' do
5
5
  let(:header) { "ID Name State Type Image Flavor IPs RAM Disk Tags\n" }
6
- let(:server001) { "a67c6340-4bf4-11e3-8f96-0800200c9a66 app001.stage running smartmachine sdc:sdc:base64:13.1.0 g3-highmemory-17.125-smartos 1.1.1.1 17.12 GB 420 GB\n" }
7
- let(:server002) { "eb332d70-4bf4-11e3-8f96-0800200c9a66 app002.stage running smartmachine sdc:sdc:base64:13.1.0 g3-highmemory-17.125-smartos 1.1.1.2 17.12 GB 420 GB\n" }
8
- let(:servers) { [header, server001, server002].join }
6
+ let(:server001) { "a67c6340-4bf4-11e3-8f96-0800200c9a66 app001.stage running smartmachine sdc:sdc:base64:13.1.0 g3-highmemory-17.125-smartos 1.1.1.1 17.12 GB 420 GB\n" }
7
+ let(:server002) { "eb332d70-4bf4-11e3-8f96-0800200c9a66 app002.stage running smartmachine sdc:sdc:base64:13.1.0 g3-highmemory-17.125-smartos 1.1.1.2 17.12 GB 420 GB\n" }
8
+ let(:server003) { "eb332d70-4bf4-11e3-8f96-0800200c9a66 app003.stage running smartmachine sdc:sdc:base64:13.1.0 g3-highmemory-17.125-smartos 1.1.1.3,1.1.1.4 17.12 GB 420 GB\n" }
9
+ let(:servers) { [header, server001, server002, server003].join }
9
10
 
10
11
  before do
11
12
  double_cmd('knife joyent server list', puts: servers)
@@ -15,5 +16,11 @@ describe Provisioner::HostIP do
15
16
  expect(Provisioner::HostIP.ip_for('app001.stage')).to eq('1.1.1.1')
16
17
  expect(Provisioner::HostIP.ip_for('app002.stage')).to eq('1.1.1.2')
17
18
  end
19
+
20
+ context 'server has multiple IPs' do
21
+ it 'returns the first IP' do
22
+ expect(Provisioner::HostIP.ip_for('app003.stage')).to eq('1.1.1.3')
23
+ end
24
+ end
18
25
  end
19
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joyent-provisioner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
@@ -216,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  version: '0'
217
217
  requirements: []
218
218
  rubyforge_project:
219
- rubygems_version: 2.0.3
219
+ rubygems_version: 2.0.7
220
220
  signing_key:
221
221
  specification_version: 4
222
222
  summary: Wrapper gem around provisioning clusters of servers on Joyent cloud