cloudstrap 0.29.1.pre → 0.29.5.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.org +1 -1
  3. data/lib/cloudstrap/config.rb +38 -55
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79075784a2e532fa8f708f83ab14d4d2d4f7f262
4
- data.tar.gz: a36f02ccc53bbba3cd7c6985c9dc778a016ebcbf
3
+ metadata.gz: 95dbc2808072ab2167cdc2fa12946a9a84ff7b0d
4
+ data.tar.gz: a83c858dd8c01ca32bd243f5b8cd20c6bece025e
5
5
  SHA512:
6
- metadata.gz: db973e404ee5707cbcb8b5af935815b8aca99df65a77b9f908f362c39cd2a4aa7e389e82227f62321305df04dcdb1f56d93fa2bdcd4be83c7921e3be7fbf925e
7
- data.tar.gz: 68112e361736d5a9912f3638a4706547a1d23c4eb9108a96b7bd8ace7b438a699741ea8f8b04f0edfdd92c3083f4a1108870f711ccaa06f442e6b265bdc05bc3
6
+ metadata.gz: 21b5492b2bf0f2aba315acc8417f5d7cdfc8ed7efcb6ab2528a2e5ad236bd7240b29d13b637820e01b8ad7b056c02fe5727b270e3dcc4bc79b07e1474cfb761b
7
+ data.tar.gz: a8dd214c05c6ab929f97a99cb00eaaaece286b795a2f444afe7e3463563b891a2784f2bb33d909117254a6afc875eb5e6c4bdaa76b04ce26702253078a7bb0f1
data/README.org CHANGED
@@ -61,7 +61,7 @@ The output describes the results, and all settings used in the process.
61
61
  BOOTSTRAP_ROUTE_TABLE_ID=rtb-9d28dcfa
62
62
  BOOTSTRAP_AVAILABILITY_ZONE=us-west-2b
63
63
  BOOTSTRAP_JUMPBOX_ID=i-051c248563a2c3f54
64
- BOOTSTRAP.JUMPBOX_IP=52.89.237.123
64
+ BOOTSTRAP_JUMPBOX_IP=52.89.237.123
65
65
  BOOTSTRAP_WITHOUT_HUMAN_OVERSIGHT=true
66
66
 
67
67
  # Additional Information
@@ -9,86 +9,56 @@ module StackatoLKG
9
9
 
10
10
  Contract None => String
11
11
  def region
12
- @region ||= ENV.fetch('BOOTSTRAP_REGION') do
13
- config.fetch('region') do
14
- 'us-west-2'
15
- end
16
- end
12
+ lookup(:region) { 'us-west-2' }
17
13
  end
18
14
 
19
15
  Contract None => String
20
16
  def cache_path
21
- @cache_path ||= ENV.fetch('BOOTSTRAP_CACHE_PATH') do
22
- config.fetch('cache_path') { [workdir, '.cache'].join('/') }
23
- end
17
+ lookup(:cache_path) { [workdir, '.cache'].join('/') }
24
18
  end
25
19
 
26
20
  Contract None => String
27
21
  def vpc_cidr_block
28
- @vpc_cidr_block ||= ENV.fetch('BOOTSTRAP_VPC_CIDR_BLOCK') do
29
- config.fetch('vpc_cidr_block') { '10.0.0.0/16' }
30
- end
22
+ lookup(:vpc_cidr_block) { '10.0.0.0/16' }
31
23
  end
32
24
 
33
25
  Contract None => String
34
26
  def public_cidr_block
35
- @public_cidr_block ||= ENV.fetch('BOOTSTRAP_PUBLIC_CIDR_BLOCK') do
36
- config.fetch('public_cidr_block') do
37
- vpc_cidr_block.gsub(/([[:digit:]]{1,3}\.?){2,2}\/[[:digit:]]{1,2}$/, '0.0/24')
38
- end
27
+ lookup(:public_cidr_block) do
28
+ vpc_cidr_block.gsub(/([[:digit:]]{1,3}\.?){2,2}\/[[:digit:]]{1,2}$/, '0.0/24')
39
29
  end
40
30
  end
41
31
 
42
32
  Contract None => String
43
33
  def private_cidr_block
44
- @private_cidr_block ||= ENV.fetch('BOOTSTRAP_PRIVATE_CIDR_BLOCK') do
45
- config.fetch('private_cidr_block') do
46
- vpc_cidr_block.gsub(/([[:digit:]]{1,3}\.?){2,2}\/[[:digit:]]{1,2}$/, '1.0/24')
47
- end
34
+ lookup(:private_cidr_block) do
35
+ vpc_cidr_block.gsub(/([[:digit:]]{1,3}\.?){2,2}\/[[:digit:]]{1,2}$/, '1.0/24')
48
36
  end
49
37
  end
50
38
 
51
39
  Contract None => String
52
40
  def ami_owner
53
- @ami_owner ||= ENV.fetch('BOOTSTRAP_AMI_OWNER') do
54
- config.fetch('ami_owner') do
55
- '099720109477'
56
- end
57
- end
41
+ lookup(:ami_owner) { '099720109477' }
58
42
  end
59
43
 
60
44
  Contract None => String
61
45
  def ubuntu_release
62
- @distribution ||= ENV.fetch('BOOTSTRAP_UBUNTU_RELEASE') do
63
- config.fetch('ubuntu_release') do
64
- '14.04'
65
- end
66
- end
46
+ lookup(:ubuntu_release) { '14.04' }
67
47
  end
68
48
 
69
49
  Contract None => String
70
50
  def instance_type
71
- @instance_type ||= ENV.fetch('BOOTSTRAP_INSTANCE_TYPE') do
72
- config.fetch('instance_type') do
73
- 't2.micro'
74
- end
75
- end
51
+ lookup(:instance_type) { 't2.micro' }
76
52
  end
77
53
 
78
54
  Contract None => String
79
55
  def ssh_dir
80
- @ssh_dir ||= File.expand_path(ENV.fetch('BOOTSTRAP_SSH_DIR') do
81
- [workdir, '.ssh'].join('/')
82
- end)
56
+ lookup(:ssh_dir) { [workdir, '.ssh'].join('/') }
83
57
  end
84
58
 
85
59
  Contract None => String
86
60
  def ssh_username
87
- @ssh_username ||= ENV.fetch('BOOTSTRAP_SSH_USERNAME') do
88
- config.fetch('ssh_username') do
89
- 'ubuntu'
90
- end
91
- end
61
+ lookup(:ssh_username) { 'ubuntu' }
92
62
  end
93
63
 
94
64
  Contract None => String
@@ -98,36 +68,49 @@ module StackatoLKG
98
68
 
99
69
  Contract None => String
100
70
  def hdp_origin
101
- @hdp_origin ||= ENV.fetch('BOOTSTRAP_HDP_BOOTSTRAP_ORIGIN') do
102
- config.fetch('hdp_bootstrap_origin')
103
- end
71
+ lookup :hdp_bootstrap_origin
104
72
  end
105
73
 
106
74
  Contract None => String
107
75
  def hdp_version
108
- @hdp_archive ||= ENV.fetch('BOOTSTRAP_HDP_BOOTSTRAP_VERSION') do
109
- config.fetch('hdp_bootstrap_version')
110
- end
76
+ lookup :hdp_bootstrap_version
111
77
  end
112
78
 
113
79
  Contract None => String
114
80
  def hdp_package_url
115
- @hdp_package_url ||= ENV.fetch('BOOTSTRAP_HDP_BOOTSTRAP_PACKAGE_URL') do
116
- config.fetch('hdp_bootstrap_package_url') do
117
- "#{hdp_origin}/hcp-bootstrap_#{hdp_version.gsub('+', '%2B')}_amd64.deb"
118
- end
81
+ lookup(:hdp_bootstrap_package_url) do
82
+ "#{hdp_origin}/hcp-bootstrap_#{hdp_version.gsub('+', '%2B')}_amd64.deb"
119
83
  end
120
84
  end
121
85
 
122
86
  Contract None => String
123
87
  def bootstrap_properties_seed_url
124
- ENV.fetch('BOOTSTRAP_PROPERTIES_SEED_URL') do
125
- config.fetch('bootstrap_properties_seed_url')
126
- end
88
+ lookup :bootstrap_properties_seed_url
127
89
  end
128
90
 
129
91
  private
130
92
 
93
+ StringToString = Func[Maybe[String] => Maybe[String]]
94
+
95
+ Contract RespondTo[:to_s], Maybe[Or[String, StringToString]] => Maybe[String]
96
+ def memoize(key, value = nil)
97
+ key = key.to_s.tap { |k| k.prepend('@') unless k.start_with?('@') }
98
+ return instance_variable_get(key) if instance_variable_defined?(key)
99
+
100
+ instance_variable_set(key, block_given? ? yield(key) : value)
101
+ end
102
+
103
+ Contract RespondTo[:to_s], Maybe[Or[String, StringToString]] => String
104
+ def lookup(key = __callee__, default = nil)
105
+ memoize(key) do
106
+ ENV.fetch("BOOTSTRAP_#{key.to_s.upcase}") do
107
+ config.fetch(key.to_s) do
108
+ block_given? ? yield(key) : default
109
+ end
110
+ end
111
+ end
112
+ end
113
+
131
114
  Contract None => String
132
115
  def workdir
133
116
  @workdir ||= ENV.fetch('BOOTSTRAP_WORKDIR') { Dir.pwd }
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.29.1.pre
4
+ version: 0.29.5.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: 2016-09-14 00:00:00.000000000 Z
11
+ date: 2016-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk