ufo 6.1.1 → 6.1.4

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
  SHA256:
3
- metadata.gz: b5020109f777d82ca7e1d2c85acfd6c5fe91b4501a3b78892160a8c9783c129c
4
- data.tar.gz: 0c5868cba614746690366be6512b33c5cc272d16d5a0ac0529933bebf83b28c3
3
+ metadata.gz: 9e704a7fceefa2d38fd24533e23830a0b6dbec732240a8767e407ff127659c32
4
+ data.tar.gz: 43e96f22096772f72ad6c4ef20a9a5f298976b9952f1e05916c536c4f3977889
5
5
  SHA512:
6
- metadata.gz: 98130a5759ba72f0a6ce637607ba4b67814fb8822f735f679de8ea6b82204e17eb2943329e39f33265833373627a36dedb9adb1f555999220eb814e7c28dc3c5
7
- data.tar.gz: 64f93d8b076e60f301b5e848e0e1f860d91bed832ecffedb5c95a93b1df743b2853049ec84d9d9995a16df222a6f9930fdb2026d9d3d24e784d20900b3f06208
6
+ metadata.gz: 5928bdd143446724fbf21b8ccf90e6a8440dfc4f2d2d3c068ae1fc210ad9684018606d8b83525b8d68327e977b9a78f785731980f9d3950a7daa68a3aea6fa87
7
+ data.tar.gz: f29d231ee67c04cb8c3098a55ce11224af36ba373ed5884840c18d1be52a21fdc25e5aad510f5d0a3fdc15e8e1eae793a3578fedc8483e9a2bbd3eb451d053cc
data/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
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
+ ## [6.1.4] - 2022-03-16
7
+ - [#150](https://github.com/tongueroo/ufo/pull/150) ufo central: fix edge case when trying report broken symlink and logger not available
8
+
9
+ ## [6.1.3] - 2022-03-14
10
+ - [#149](https://github.com/tongueroo/ufo/pull/149) stack_output helper improve message when stack not found
11
+
12
+ ## [6.1.2] - 2022-03-14
13
+ - [#148](https://github.com/tongueroo/ufo/pull/148) Acm cert and user messaging improvements with config
14
+ - acm_cert helper improvements: warn when not found and only create ssl listener if cert is found
15
+ - improve squeezer: prevent infinite loop for edge case when data is [nil]
16
+ - messaging improvements: provide exact line of context of the config with the issue
17
+ - update dsl_evaluator dependency to at least 0.3.0
18
+
6
19
  ## [6.1.1] - 2022-03-14
7
20
  - [#146](https://github.com/tongueroo/ufo/pull/146) dont set default vpc explicitly, instead use implicit setting
8
21
  - [#147](https://github.com/tongueroo/ufo/pull/147) explicitly set default vpc when not set cloudformation resources expect it
@@ -27,11 +27,11 @@ class Ufo::Cfn::Stack::Builder::Resources
27
27
  # nil on purpose
28
28
  def certificates
29
29
  ssl = Ufo.config.elb.ssl
30
- normalize(ssl.certificates)
30
+ normalize(ssl.certificates) if ssl.certificates
31
31
  end
32
32
 
33
33
  def normalize(*certs)
34
- certs = certs.flatten
34
+ certs = certs.flatten.compact
35
35
  certs.map do |cert|
36
36
  if cert.is_a?(String)
37
37
  {CertificateArn: cert}
@@ -59,7 +59,8 @@ class Ufo::Cfn::Stack
59
59
 
60
60
  # if the configuration is set to anything then enable it
61
61
  def create_listener_ssl?
62
- Ufo.config.elb.ssl.enabled
62
+ elb = Ufo.config.elb
63
+ elb.ssl.enabled && elb.ssl.certificates
63
64
  end
64
65
 
65
66
  def create_elb?
@@ -1,5 +1,6 @@
1
1
  class Ufo::CLI::Central
2
2
  class Base
3
+ include Ufo::Utils::Logging
3
4
  include Ufo::Utils::Pretty
4
5
  include Ufo::Utils::Sure
5
6
 
data/lib/ufo/core.rb CHANGED
@@ -16,7 +16,6 @@ module Ufo
16
16
  if @@config_loaded
17
17
  config.app
18
18
  else
19
- call_line = caller.find {|l| l.include?('.ufo') }
20
19
  puts "ERROR: Using Ufo.app or :APP expansion very early in the UFO boot process".color(:red)
21
20
  puts <<~EOL.color(:red)
22
21
  The Ufo.app or :APP expansions are not yet available at this point
@@ -25,11 +24,9 @@ module Ufo
25
24
  1. Use the UFO_APP env var to set it, which allows it to be used.
26
25
  2. Hard code your actual app name.
27
26
 
28
- Called from:
29
-
30
- #{call_line}
31
-
32
27
  EOL
28
+ call_line = caller.find {|l| l.include?('.ufo') }
29
+ DslEvaluator.print_code(call_line)
33
30
  exit 1
34
31
  end
35
32
  end
@@ -1,12 +1,23 @@
1
1
  module Ufo::TaskDefinition::Helpers
2
2
  module Acm
3
+ include Ufo::Utils::CallLine
4
+ include Ufo::Utils::Pretty
5
+
3
6
  # returns cert arn
4
7
  def acm_cert(domain)
5
8
  certs = acm_certs
6
9
  cert = certs.find do |c|
7
10
  c.domain_name == domain
8
11
  end
9
- cert.certificate_arn if cert
12
+ if cert
13
+ cert.certificate_arn
14
+ else
15
+ # Logger causes infinite loop when waf helper used in .ufo/
16
+ logger.warn "WARN: ACM cert not found: #{domain}".color(:yellow)
17
+ call_line = ufo_config_call_line
18
+ DslEvaluator.print_code(call_line)
19
+ nil
20
+ end
10
21
  end
11
22
 
12
23
  # TODO: handle when there are lots of certs by paging
@@ -11,14 +11,9 @@ module Ufo::TaskDefinition::Helpers
11
11
  resp = ecr.describe_repositories(repository_names: [name])
12
12
  resp.repositories.first
13
13
  rescue Aws::ECR::Errors::RepositoryNotFoundException => e
14
- call_line = ufo_config_call_line
15
14
  logger.warn "WARN: #{e.class} #{e.message}".color(:yellow)
16
- logger.warn <<~EOL
17
- Called from
18
-
19
- #{call_line}
20
-
21
- EOL
15
+ call_line = ufo_config_call_line
16
+ DslEvaluator.print_code(call_line)
22
17
  nil
23
18
  end
24
19
  end
@@ -6,16 +6,19 @@ module Ufo::TaskDefinition::Helpers
6
6
  def stack_output(name)
7
7
  stack_name, output_key = name.split(".")
8
8
  stack_name = names.expansion(stack_name)
9
- resp = cloudformation.describe_stacks(stack_name: stack_name)
10
- stack = resp.stacks.first
11
- if stack
12
- o = stack.outputs.detect { |h| h.output_key == output_key }
9
+ stack = find_stack(stack_name)
10
+ unless stack
11
+ logger.error "ERROR: Stack not found: #{stack_name}".color(:red)
12
+ call_line = ufo_config_call_line
13
+ DslEvaluator.print_code(call_line)
14
+ return
13
15
  end
14
16
 
17
+ o = stack.outputs.detect { |h| h.output_key == output_key }
15
18
  if o
16
19
  o.output_value
17
20
  else
18
- logger.info "WARN: NOT FOUND: output #{key} for stack #{stack_name}"
21
+ logger.warn "WARN: NOT FOUND: output #{output_key} for stack #{stack_name}".color(:yellow)
19
22
  nil
20
23
  end
21
24
  end
@@ -19,15 +19,9 @@ module Ufo::TaskDefinition::Helpers
19
19
  web_acl.arn
20
20
  else
21
21
  # Logger causes infinite loop when waf helper used in .ufo/
22
- call_line = ufo_config_call_line
23
22
  logger.warn "WARN: Web ACL not found: #{name}".color(:yellow)
24
- logger.info <<~EOL
25
- Called from:
26
-
27
- #{call_line}
28
-
29
- Are you sure it's a regional WAF ACL?
30
- EOL
23
+ call_line = ufo_config_call_line
24
+ DslEvaluator.print_code(call_line)
31
25
  end
32
26
  end
33
27
  end
@@ -3,8 +3,7 @@ module Ufo::Utils
3
3
  include Pretty
4
4
 
5
5
  def ufo_config_call_line
6
- call_line = caller.find { |l| l.include?('.ufo/') }
7
- pretty_path(call_line)
6
+ caller.find { |l| l.include?('.ufo/') }
8
7
  end
9
8
  end
10
9
  end
@@ -9,7 +9,9 @@ module Ufo::Utils
9
9
 
10
10
  case data
11
11
  when Array
12
- data.map! { |v| squeeze(v) }
12
+ # .compact prevents infinite loop when data = [nil] on accident
13
+ # IE: config.elb.ssl.certificates = acm_cert("domain.not.found")
14
+ data.compact.map! { |v| squeeze(v) }
13
15
  when Hash
14
16
  data.each_with_object({}) do |(k,v), squeezed|
15
17
  # only remove nil and empty Array values within Hash structures
data/lib/ufo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ufo
2
- VERSION = "6.1.1"
2
+ VERSION = "6.1.4"
3
3
  end
@@ -0,0 +1,21 @@
1
+ describe Ufo::Utils::Squeezer do
2
+ subject { Ufo::Utils::Squeezer.new(data) }
3
+
4
+ context("Array with nil") do
5
+ let(:data) { [nil] }
6
+ # Prevents infinite loop
7
+ it "remove nil" do
8
+ squeezed = subject.squeeze
9
+ expect(squeezed).to eq []
10
+ end
11
+ end
12
+
13
+ context("Hash with nil value") do
14
+ let(:data) { {a: 1, b: nil } }
15
+ # Prevents infinite loop
16
+ it "remove nil" do
17
+ squeezed = subject.squeeze
18
+ expect(squeezed).to eq(a: 1)
19
+ end
20
+ end
21
+ end
data/ufo.gemspec CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency "cfn-status"
35
35
  spec.add_dependency "cli-format"
36
36
  spec.add_dependency "deep_merge"
37
- spec.add_dependency "dsl_evaluator", ">= 0.2.5" # for DslEvaluator.print_code
37
+ spec.add_dependency "dsl_evaluator", ">= 0.3.0" # for DslEvaluator.print_code
38
38
  spec.add_dependency "memoist"
39
39
  spec.add_dependency "plissken"
40
40
  spec.add_dependency "rainbow"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ufo
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.1
4
+ version: 6.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-14 00:00:00.000000000 Z
11
+ date: 2022-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-logs
@@ -240,14 +240,14 @@ dependencies:
240
240
  requirements:
241
241
  - - ">="
242
242
  - !ruby/object:Gem::Version
243
- version: 0.2.5
243
+ version: 0.3.0
244
244
  type: :runtime
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - ">="
249
249
  - !ruby/object:Gem::Version
250
- version: 0.2.5
250
+ version: 0.3.0
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: memoist
253
253
  requirement: !ruby/object:Gem::Requirement
@@ -653,6 +653,7 @@ files:
653
653
  - spec/ufo/iam_role/builder_spec.rb
654
654
  - spec/ufo/iam_role/dsl_spec.rb
655
655
  - spec/ufo/logs_spec.rb
656
+ - spec/ufo/utils/squeezer_spec.rb
656
657
  - ufo.gemspec
657
658
  homepage: http://ufoships.com
658
659
  licenses:
@@ -699,3 +700,4 @@ test_files:
699
700
  - spec/ufo/iam_role/builder_spec.rb
700
701
  - spec/ufo/iam_role/dsl_spec.rb
701
702
  - spec/ufo/logs_spec.rb
703
+ - spec/ufo/utils/squeezer_spec.rb