lono 7.4.8 → 7.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/lono/registration/temp.rb +7 -9
- data/lib/lono/template/strategy/dsl/builder/helpers.rb +8 -6
- data/lib/lono/template/strategy/dsl/builder/helpers/stack_helper.rb +50 -0
- data/lib/lono/version.rb +1 -1
- metadata +3 -3
- data/lib/lono/template/strategy/dsl/builder/helpers/lookup_helper.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e552e98666394b4573d02131de0e2e8e31707b9a2eab4f0d5abee72cc166bb4
|
4
|
+
data.tar.gz: d8471da49ad51dfe39698e551d20f43f627d98b8c7661bc41484adeb60f598ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 383c2617d88b1ffb08dbe6f755616534ae872bf901b59a2a1412fc97161d955cd0ed3ce87679f5a8e4945d056c7b3aa5021684b6ef7dfcc366f67b569b8d2b7a
|
7
|
+
data.tar.gz: '09f12a84287cbdcb76ea14d4ed7151bb87947d8503b4ed1f2b1fd26954aa49fd539813ec297ad8dc41fc574b41788195f8cdcb7d648f788ac94b7f083c9b3d53'
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [7.4.9]
|
7
|
+
- #69 `stack_output` and `stack_resource` helpers
|
8
|
+
|
6
9
|
## [7.4.8]
|
7
10
|
- #68 squeezer: auto clean empty array values
|
8
11
|
- add version numbers to extension gemspec template to remove deprecations
|
@@ -21,13 +21,6 @@ class Lono::Registration
|
|
21
21
|
def prompt
|
22
22
|
return if ENV['LONO_TEST']
|
23
23
|
|
24
|
-
# We get the api first before the prompt to check if api is up
|
25
|
-
resp = get_temp_key
|
26
|
-
# resp nil means non-200 http response. Failsafe behavior is to continue.
|
27
|
-
if resp.nil?
|
28
|
-
return true
|
29
|
-
end
|
30
|
-
|
31
24
|
puts <<~EOL
|
32
25
|
|
33
26
|
Looks like lono is not registered. Lono registration is optional and free.
|
@@ -35,12 +28,17 @@ class Lono::Registration
|
|
35
28
|
|
36
29
|
https://register.lono.cloud
|
37
30
|
|
38
|
-
|
39
|
-
updates and special offers,
|
31
|
+
This prompt appears every 24 hours when lono is not registered. Registration removes
|
32
|
+
this message. Registered users can also optionally receive updates and special offers,
|
33
|
+
including discounts to BoltOps Pro:
|
40
34
|
|
41
35
|
https://lono.cloud/docs/boltops-pro/
|
42
36
|
|
43
37
|
EOL
|
38
|
+
|
39
|
+
# resp nil means non-200 http response
|
40
|
+
resp = get_temp_key
|
41
|
+
save_temp_key(resp) unless resp.nil? # save temp key so prompt only happens periodically
|
44
42
|
end
|
45
43
|
|
46
44
|
def save_temp_key(info)
|
@@ -2,12 +2,14 @@
|
|
2
2
|
class Lono::Template::Strategy::Dsl::Builder
|
3
3
|
module Helpers
|
4
4
|
extend Memoist
|
5
|
-
|
6
|
-
include
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
|
6
|
+
# Auto include all modules in helpers folder
|
7
|
+
helpers_dir = File.expand_path("helpers", __dir__)
|
8
|
+
Dir.glob("#{helpers_dir}/**/*").each do |path|
|
9
|
+
next unless File.file?(path)
|
10
|
+
klass = path.gsub(%r{.*/lib/},'').sub(".rb",'').camelize
|
11
|
+
include klass.constantize
|
12
|
+
end
|
11
13
|
|
12
14
|
include Lono::Template::Strategy::Common::Helpers
|
13
15
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Lono::Template::Strategy::Dsl::Builder::Helpers
|
2
|
+
module StackHelper
|
3
|
+
extend Memoist
|
4
|
+
include Lono::AwsServices
|
5
|
+
|
6
|
+
def stack_output(name)
|
7
|
+
stack_name, key = name.split(".")
|
8
|
+
resp = describe_stacks(stack_name: stack_name)
|
9
|
+
stack = resp.stacks.first
|
10
|
+
if stack
|
11
|
+
o = stack.outputs.detect { |h| h.output_key == key }
|
12
|
+
end
|
13
|
+
|
14
|
+
if o
|
15
|
+
o.output_value
|
16
|
+
else
|
17
|
+
"NOT FOUND: output #{key} for stack #{stack_name}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def stack_resource(name)
|
22
|
+
stack_name, logical_id = name.split(".")
|
23
|
+
resp = describe_stack_resources(stack_name: stack_name)
|
24
|
+
resources = resp.stack_resources
|
25
|
+
resource = resources.find { |r| r.logical_resource_id == logical_id }
|
26
|
+
if resource
|
27
|
+
resource.physical_resource_id
|
28
|
+
else
|
29
|
+
"NOT FOUND: logical_id #{logical_id} for stack #{stack_name}"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def lookup_output(name)
|
34
|
+
stack_output(name)
|
35
|
+
return unless ENV['LONO_DEPRECATION_SOFT']
|
36
|
+
puts "DEPRECATION WARNING: lookup_output is deprecated. Please use stack_output instead".color(:yellow)
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
def describe_stacks(options={})
|
41
|
+
cfn.describe_stacks(options)
|
42
|
+
end
|
43
|
+
memoize :describe_stacks
|
44
|
+
|
45
|
+
def describe_stack_resources(options={})
|
46
|
+
cfn.describe_stack_resources(options)
|
47
|
+
end
|
48
|
+
memoize :describe_stack_resources
|
49
|
+
end
|
50
|
+
end
|
data/lib/lono/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lono
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.4.
|
4
|
+
version: 7.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -688,8 +688,8 @@ files:
|
|
688
688
|
- lib/lono/template/strategy/dsl/builder/helpers/core_helper.rb
|
689
689
|
- lib/lono/template/strategy/dsl/builder/helpers/ec2_helper.rb
|
690
690
|
- lib/lono/template/strategy/dsl/builder/helpers/file_helper.rb
|
691
|
-
- lib/lono/template/strategy/dsl/builder/helpers/lookup_helper.rb
|
692
691
|
- lib/lono/template/strategy/dsl/builder/helpers/s3_helper.rb
|
692
|
+
- lib/lono/template/strategy/dsl/builder/helpers/stack_helper.rb
|
693
693
|
- lib/lono/template/strategy/dsl/builder/helpers/tags_helper.rb
|
694
694
|
- lib/lono/template/strategy/dsl/builder/section/base.rb
|
695
695
|
- lib/lono/template/strategy/dsl/builder/section/condition.rb
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Lono::Template::Strategy::Dsl::Builder::Helpers
|
2
|
-
module LookupHelper
|
3
|
-
extend Memoist
|
4
|
-
include Lono::AwsServices
|
5
|
-
|
6
|
-
def lookup_output(name)
|
7
|
-
stack_name, key = name.split(".")
|
8
|
-
resp = describe_stacks(stack_name: stack_name)
|
9
|
-
stack = resp.stacks.first
|
10
|
-
if stack
|
11
|
-
o = stack.outputs.detect { |h| h.output_key == key }
|
12
|
-
end
|
13
|
-
|
14
|
-
if o
|
15
|
-
o.output_value
|
16
|
-
else
|
17
|
-
"NOT FOUND: Did not lookup_output #{name} for stack #{stack}"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
def describe_stacks(options={})
|
23
|
-
cfn.describe_stacks(options)
|
24
|
-
end
|
25
|
-
memoize :describe_stacks
|
26
|
-
end
|
27
|
-
end
|