cloudstrap 0.48.15.pre → 0.49.0.pre

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
  SHA1:
3
- metadata.gz: 067523f95e2a069de84b9c7f864fcde63d0f12eb
4
- data.tar.gz: f39b3e3ba879cb0d39a1af94c49ff436d934333e
3
+ metadata.gz: 3a40c0dbcbcd4d1c36beac0f3dbc65c0215a0712
4
+ data.tar.gz: f18335993d1119cc36388d23d8bf5729a24080e7
5
5
  SHA512:
6
- metadata.gz: a4252ecca251956433abe053dd5c485b95400b618c72741bdf4076d21676db3844a0dcb3d7918909686d23e10408c10cc7d222e8c7dfa2dc937fad8eb3991c75
7
- data.tar.gz: 4914b122f9022978e2852a6eb1a52e1a13ba55c58380a5fb6e52ebe28fda6aa703137f4497a48f9bebb73db4bfadf5256204317edf4ea7be1877924958f09eb2
6
+ metadata.gz: 49b8c4a1ff684337421602893fce727ee6b7f60c77e6468a6624ba324a8d94329046fad93ed92deda1acfdcdbadf8043496785bcb84a8bafd18f17bbc56b63d5
7
+ data.tar.gz: 2d2a652d1eed6f569317be9fdd93b74b6fa38de637fa0cbaed034e28c239c803281fb9c7eaa4901be6f637e2857a9416a472bf474a76fbb00daa841466b68447
@@ -21,22 +21,32 @@ module Cloudstrap
21
21
  lookup(:cache_path) { [workdir, '.cache'].join('/') }
22
22
  end
23
23
 
24
+ Contract None => String
25
+ def network_bits
26
+ lookup(:network_bits) { '16' }
27
+ end
28
+
29
+ Contract None => String
30
+ def subnet_bits
31
+ lookup(:subnet_bits) { '24' }
32
+ end
33
+
24
34
  Contract None => String
25
35
  def vpc_cidr_block
26
- lookup(:vpc_cidr_block) { '10.0.0.0/16' }
36
+ lookup(:vpc_cidr_block) { "10.0.0.0/#{network_bits}" }
27
37
  end
28
38
 
29
39
  Contract None => String
30
40
  def public_cidr_block
31
41
  lookup(:public_cidr_block) do
32
- vpc_cidr_block.gsub(/([[:digit:]]{1,3}\.?){2,2}\/[[:digit:]]{1,2}$/, '0.0/24')
42
+ vpc_cidr_block.gsub(/([[:digit:]]{1,3}\.?){2,2}\/[[:digit:]]{1,2}$/, "0.0/#{subnet_bits}")
33
43
  end
34
44
  end
35
45
 
36
46
  Contract None => String
37
47
  def private_cidr_block
38
48
  lookup(:private_cidr_block) do
39
- vpc_cidr_block.gsub(/([[:digit:]]{1,3}\.?){2,2}\/[[:digit:]]{1,2}$/, '1.0/24')
49
+ vpc_cidr_block.gsub(/([[:digit:]]{1,3}\.?){2,2}\/[[:digit:]]{1,2}$/, "1.0/#{subnet_bits}")
40
50
  end
41
51
  end
42
52
 
@@ -1,16 +1,17 @@
1
1
  require 'ipaddress'
2
+ require_relative 'config'
2
3
 
3
4
  module Cloudstrap
4
5
  class Network
5
6
  def initialize(network = '10.0.0.0')
6
- @network = IPAddress(network).tap { |n| n.prefix = 16 }
7
+ @network = IPAddress(network).tap { |n| n.prefix = config.network_bits.to_i }
7
8
  self
8
9
  end
9
10
 
10
11
  attr_reader :network
11
12
 
12
13
  def subnets
13
- @subnets ||= network.subnet 24
14
+ @subnets ||= network.subnet config.subnet_bits.to_i
14
15
  end
15
16
 
16
17
  def public
@@ -41,5 +42,11 @@ module Cloudstrap
41
42
  private: private_layout(*zones)
42
43
  }
43
44
  end
45
+
46
+ private
47
+
48
+ def config
49
+ @config ||= Config.new
50
+ end
44
51
  end
45
52
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.48.15.pre
4
+ version: 0.49.0.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Olstrom
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-01 00:00:00.000000000 Z
11
+ date: 2017-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk