sfn 3.1.4 → 3.1.6

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: 6547ff820746c65b4c40508197419dcae12faca99daebcfc94deead2aa26f840
4
- data.tar.gz: 8c6b5e8fc5376a833a4795f03975c6e4f3413b769c0eefc30483df204925929d
3
+ metadata.gz: 970e23327f10a5779f02b8f39168b1345a17ece34b108facde5c046a9d68637d
4
+ data.tar.gz: f7ef6ddea26b4f3a60c499092b9aed690d6a1c73c569ff8e72638a4c1f7a7c77
5
5
  SHA512:
6
- metadata.gz: dbcb90988b563a83958fb68fa000e9d400143733b80e4e505974539f397e8115c3b670f3d617896df6b79c13a32f89a31e821555bc72a65413b786d821eaa423
7
- data.tar.gz: 5449abde150d5fc85c419671f12792ee6e1640cac4340df67f01dd60c2da765011024e51e94b1786171ecae05f1f6cd37c3e93f3d22edabc0a4f3a3fb0280196
6
+ metadata.gz: 944b96fbf6832a33295feca36cc603cb9b581493b015627284c62c19e0b89f5bf2450a3219258897ed42d58f54b3e2ee06c17e498751d28fdafce394c8d1002a
7
+ data.tar.gz: 764508bb435d2da04dd49384e3c049061828bd64dc00a8b082119de8f41da3f650662d00019828cd660ad9772659e91ac4ed213a07078976cd920f3ba6517159
@@ -1,3 +1,8 @@
1
+ # v3.1.6
2
+ * [enhancement] Add `all` and `group` validate options (#299)
3
+ * [enhancement] Add timing information to template tracing (#296)
4
+ * [fix] Provide useful error when `nesting_bucket` option is unset
5
+
1
6
  # v3.1.4
2
7
  * [fix] Fix apply mapping implementation (#295)
3
8
 
@@ -35,9 +35,17 @@ module Sfn
35
35
  else
36
36
  origin << ui.color(record.caller.path, :yellow)
37
37
  end
38
+ duration = "#{indent} | duration: "
39
+ if record.compile_duration
40
+ duration << Kernel.sprintf("%0.4f", record.compile_duration)
41
+ duration << "s"
42
+ else
43
+ duration < "N/A"
44
+ end
38
45
  ui.info header
39
46
  ui.info source
40
47
  ui.info origin
48
+ ui.info duration
41
49
  if record.audit_log.count > 0
42
50
  writer.call(record.audit_log, indent + " |")
43
51
  end
@@ -10,25 +10,42 @@ module Sfn
10
10
  include Sfn::CommandModule::Stack
11
11
 
12
12
  def execute!
13
- print_only_original = config[:print_only]
14
- config[:print_only] = true
15
- file = load_template_file
16
- ui.info "#{ui.color("Template Validation (#{provider.connection.provider}): ", :bold)} #{config[:file].sub(Dir.pwd, "").sub(%r{^/}, "")}"
17
- config[:print_only] = print_only_original
13
+ if config[:all]
14
+ validate_templates = sparkle_collection.templates[sparkle_collection.provider].keys
15
+ elsif config[:group]
16
+ validate_templates = sparkle_collection.templates[sparkle_collection.provider].keys.select do |template|
17
+ template.split("__").first == config[:group]
18
+ end
19
+ else
20
+ validate_templates = [config[:file]]
21
+ end
18
22
 
19
- raw_template = _format_json(parameter_scrub!(template_content(file)))
23
+ if validate_templates.empty?
24
+ load_template_file
25
+ validate_templates.push(config[:file])
26
+ end
20
27
 
21
- if config[:print_only]
22
- ui.puts raw_template
23
- else
24
- validate_stack(
25
- file.respond_to?(:dump) ? file.dump : file,
26
- if config[:processing]
27
- sparkle_collection.get(:template, config[:file])[:name]
28
- else
29
- config[:file]
30
- end
31
- )
28
+ validate_templates.each do |template|
29
+ config[:file] = template
30
+ print_only_original = config[:print_only]
31
+ config[:print_only] = true
32
+ ui.info "#{ui.color("Template Validation (#{provider.connection.provider}): ", :bold)} #{config[:file].sub(Dir.pwd, "").sub(%r{^/}, "")}"
33
+ file = load_template_file
34
+ config[:print_only] = print_only_original
35
+ raw_template = _format_json(parameter_scrub!(template_content(file)))
36
+
37
+ if config[:print_only]
38
+ ui.puts raw_template
39
+ else
40
+ validate_stack(
41
+ file.respond_to?(:dump) ? file.dump : file,
42
+ if config[:processing]
43
+ sparkle_collection.get(:template, config[:file])[:name]
44
+ else
45
+ config[:file]
46
+ end
47
+ )
48
+ end
32
49
  end
33
50
  end
34
51
 
@@ -71,6 +88,8 @@ module Sfn
71
88
  ui.fatal e.message
72
89
  raise e
73
90
  end
91
+ # Clear Compile Time Parameters from Config
92
+ config[:compile_parameters] = {}
74
93
  end
75
94
  end
76
95
  end
@@ -387,6 +387,9 @@ module Sfn
387
387
  # @return [Hash]
388
388
  def store_template(full_stack_name, template, result)
389
389
  stack_definition = template.is_a?(SparkleFormation) ? dump_stack_for_storage(template) : template
390
+ if config[:nesting_bucket].to_s.empty?
391
+ raise "Missing required value for option `nesting_bucket`."
392
+ end
390
393
  bucket = provider.connection.api_for(:storage).buckets.get(
391
394
  config[:nesting_bucket]
392
395
  )
@@ -113,6 +113,14 @@ module Sfn
113
113
  :upload_root_template, [TrueClass, FalseClass],
114
114
  :description => "Upload root template to storage bucket",
115
115
  )
116
+ attribute(
117
+ :all, [TrueClass, FalseClass],
118
+ :description => "Validate all templates",
119
+ )
120
+ attribute(
121
+ :group, String,
122
+ :description => "Validate templates with the specified group prefix",
123
+ )
116
124
  end
117
125
  end
118
126
  end
@@ -1,4 +1,4 @@
1
1
  module Sfn
2
2
  # Current library version
3
- VERSION = Gem::Version.new("3.1.4")
3
+ VERSION = Gem::Version.new("3.1.6")
4
4
  end
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_runtime_dependency "miasma-terraform", ">= 0.1.0", "< 0.2.0"
22
22
  s.add_runtime_dependency "jmespath"
23
23
  s.add_runtime_dependency "net-ssh"
24
- s.add_runtime_dependency "sparkle_formation", ">= 3.0.35", "< 4"
24
+ s.add_runtime_dependency "sparkle_formation", ">= 3.0.39", "< 4"
25
25
  s.add_runtime_dependency "hashdiff", "~> 0.2.2"
26
26
  s.add_runtime_dependency "graph", "~> 2.8.1"
27
27
  s.add_development_dependency "rake", "~> 10"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sfn
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-11 00:00:00.000000000 Z
11
+ date: 2019-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo-cli
@@ -224,7 +224,7 @@ dependencies:
224
224
  requirements:
225
225
  - - ">="
226
226
  - !ruby/object:Gem::Version
227
- version: 3.0.35
227
+ version: 3.0.39
228
228
  - - "<"
229
229
  - !ruby/object:Gem::Version
230
230
  version: '4'
@@ -234,7 +234,7 @@ dependencies:
234
234
  requirements:
235
235
  - - ">="
236
236
  - !ruby/object:Gem::Version
237
- version: 3.0.35
237
+ version: 3.0.39
238
238
  - - "<"
239
239
  - !ruby/object:Gem::Version
240
240
  version: '4'