ufo 6.1.0 → 6.1.3

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: 4394550f855c4e125e7bbcd6e62d4eee7fe5720c48037201cc66fcba19013d36
4
- data.tar.gz: 1b3d1f7ef2b040bc3bbe2ec7815b7da0a5d5e366b8906bf8d997d57cd8193ad5
3
+ metadata.gz: 881d674019c976e4c8cae9030f69bd2125e59c7af970a1fa2005dcbfb77a4887
4
+ data.tar.gz: 5c3e8f73e200390396c99aa292f949f5c0a7b0e457bab47e2b88dbc583adc0fa
5
5
  SHA512:
6
- metadata.gz: 5ca6d18a47212fbfd9beba2dcdc130d1341f5c3f50bd9a27396150828217ed61e44d885e9fd83904b5029822a89585e089288567fb931e1497765c9a74b443cc
7
- data.tar.gz: 85afc2fb866da1a8de2aab7d10f942248706088adc10fda04cd23b537dc5d2fe21779ee11337b4f324cc4c57b41a8d6ce6996dc070d3a9508028f7525c4bf1e4
6
+ metadata.gz: 7eaca7eaa3999ce52dd4087dd2bd7862156f34c59443fcf06140f50356beb50237c4dea35d2dc68a1171576e17529c18144e5c97bc6aa4da4ea1edfa3b9411ef
7
+ data.tar.gz: 820645713455edf1d3e7fd242c68c21f32267f6eb031c67dd9236578d93c56e0a616750170f202ab27f32c86a0093a673fa5e7321c800b3d82121f38f156b29f
data/CHANGELOG.md CHANGED
@@ -3,6 +3,21 @@
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.3] - 2022-03-14
7
+ - [#149](https://github.com/tongueroo/ufo/pull/149) stack_output helper improve message when stack not found
8
+
9
+ ## [6.1.2] - 2022-03-14
10
+ - [#148](https://github.com/tongueroo/ufo/pull/148) Acm cert and user messaging improvements with config
11
+ - acm_cert helper improvements: warn when not found and only create ssl listener if cert is found
12
+ - improve squeezer: prevent infinite loop for edge case when data is [nil]
13
+ - messaging improvements: provide exact line of context of the config with the issue
14
+ - update dsl_evaluator dependency to at least 0.3.0
15
+
16
+ ## [6.1.1] - 2022-03-14
17
+ - [#146](https://github.com/tongueroo/ufo/pull/146) dont set default vpc explicitly, instead use implicit setting
18
+ - [#147](https://github.com/tongueroo/ufo/pull/147) explicitly set default vpc when not set cloudformation resources expect it
19
+ - clean up debugging puts in cli help
20
+
6
21
  ## [6.1.0] - 2022-03-11
7
22
  - [#136](https://github.com/tongueroo/ufo/pull/136) ufo central: dont load config
8
23
  - [#137](https://github.com/tongueroo/ufo/pull/137) ufo new boot_hook generator
@@ -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?
data/lib/ufo/cli/help.rb CHANGED
@@ -18,13 +18,10 @@ class Ufo::CLI
18
18
  list.sort! { |a, b| a[0] <=> b[0] }
19
19
  filter = Proc.new do |command, desc|
20
20
  command = command.sub(/ --.*/,'')
21
- puts "command #{command.inspect}".color(:yellow)
22
21
  detected = main_commands.detect do |c|
23
22
  expr = "^ufo #{c}$"
24
- puts "expr #{expr}"
25
23
  command =~ Regexp.new(expr)
26
24
  end
27
- puts "detected #{detected.inspect}"
28
25
  detected
29
26
  end
30
27
  main = list.select(&filter)
data/lib/ufo/config.rb CHANGED
@@ -187,14 +187,12 @@ module Ufo
187
187
  add_ext!(paths)
188
188
  end
189
189
 
190
- def add_ext!(paths)
191
- ext = "rb"
190
+ def add_ext!(paths)
192
191
  paths.map! do |path|
193
192
  path = path.sub(/\/$/,'') if path.ends_with?('/')
194
193
  "#{path}.rb"
195
194
  end
196
195
  paths
197
196
  end
198
-
199
- end
197
+ end
200
198
  end
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.0"
2
+ VERSION = "6.1.3"
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.0
4
+ version: 6.1.3
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-11 00:00:00.000000000 Z
11
+ date: 2022-03-14 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