sfn 3.0.22 → 3.0.24

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
  SHA1:
3
- metadata.gz: 279982d00c24881c257eff78a3d14ed604952146
4
- data.tar.gz: 9a093919f17154f3fc20920b933691f0438c0583
3
+ metadata.gz: 4c7a832bd18a4660d0184280dc1818f2fe13aeaa
4
+ data.tar.gz: 6fd33f44b62ac8c3ca7836963e9c22ba355d5e9a
5
5
  SHA512:
6
- metadata.gz: 01741b34e7ef10214fa4f8902d2d35d1f175752d822f632e8f21e20ffdf5721e0a667fdf2f5ed1d5d56c87e87d3c8afb24319622bcbd62af70aa8e4c509b1a45
7
- data.tar.gz: 57220d7bc625e74aa0b7f9f5ecbbc4fc22e77f56d11a3fda68bd1d5583ef4b84bb0084322496f7188b16d061212c51eeaf839c731290bc12e85ec523733a61ec
6
+ metadata.gz: 7a2392c1bbfe0bd9f7a1c5bebf5f1c9ec316a262286757cecbdfd9b56df3c8bc1bb7e79b606f993149f3f5994fa31d8bc4a69644f0f9ab7dcc1d1978da247eec
7
+ data.tar.gz: f66df1b8a616ed132f51a2ec06d7495fc3eb93499d79171b16f38a4346fe7f67900a0e76d70eb99c57ba1e768f070985c9cae112f45020f2a8a7327b0b854d5c
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # v3.0.24
2
+ * [fix] Quieter print only output (#258)
3
+ * [fix] Require all modules for lint (#248)
4
+ * [fix] Fix parameter processing when no template provided
5
+ * [enhancement] Default provider to aws when unset (#251)
6
+ * [enhancement] Only delete remote templates when URL is full string (#250)
7
+ * [enhancement] Support YAML output when printing (#252)
8
+
1
9
  # v3.0.22
2
10
  * [fix] Properly match compile time parameters (#235)
3
11
  * [fix] Remove AWS policy statements for undefined resources (#240)
data/README.md CHANGED
@@ -18,12 +18,15 @@ with orchestration APIs.
18
18
  ## Documentation
19
19
 
20
20
  * [User Documentation](http://www.sparkleformation.io/docs/sfn/)
21
+ * [sfn API Documentation](http://www.sparkleformation.io/docs/sfn/)
21
22
 
22
23
  # Info
23
24
 
24
25
  * Repository: https://github.com/sparkleformation/sfn
25
26
  * Website: http://www.sparkleformation.io/docs/sfn/
26
27
  * Mailing List: https://groups.google.com/forum/#!forum/sparkleformation
27
- * IRC: Freenode @ #sparkleformation
28
+ * IRC: [#sparkleformation @ Freenode](https://webchat.freenode.net/?channels=#sparkleformation)
29
+ * Gitter: [![Join at https://gitter.im/SparkleFormation/sparkleformation](https://badges.gitter.im/SparkleFormation/sparkleformation.svg)](https://gitter.im/SparkleFormation/sparkleformation?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
28
30
 
29
- [miasma]: http://miasma-rb.github.io/miasma/
31
+
32
+ [miasma]: http://miasma-rb.github.io/miasma/
@@ -69,7 +69,7 @@ module Sfn
69
69
  provider.connection.data[:stack_types].include?(resource['Type'])
70
70
  end.each do |resource|
71
71
  url = resource['Properties']['TemplateURL']
72
- if(url)
72
+ if(url && url.is_a?(String))
73
73
  _, bucket_name, path = URI.parse(url).path.split('/', 3)
74
74
  bucket = provider.connection.api_for(:storage).buckets.get(bucket_name)
75
75
  if(bucket)
@@ -15,7 +15,13 @@ module Sfn
15
15
  config[:print_only] = true
16
16
  file = load_template_file
17
17
 
18
- json_content = format_json(parameter_scrub!(template_content(file)))
18
+ output_content = parameter_scrub!(template_content(file))
19
+ if(config[:yaml])
20
+ require 'yaml'
21
+ output_content = YAML.dump(output_content)
22
+ else
23
+ output_content = format_json(output_content)
24
+ end
19
25
 
20
26
  if(config[:write_to_file])
21
27
  unless(File.directory?(File.dirname(config[:write_to_file])))
@@ -25,11 +31,11 @@ module Sfn
25
31
  end
26
32
  end
27
33
  run_action "Writing template to file - #{config[:write_to_file]}" do
28
- File.write(config[:write_to_file], json_content)
34
+ File.write(config[:write_to_file], output_content)
29
35
  nil
30
36
  end
31
37
  else
32
- ui.puts json_content
38
+ ui.puts output_content
33
39
  end
34
40
  end
35
41
 
@@ -58,7 +58,9 @@ module Sfn
58
58
  raise "Failed to locate stack: #{name}"
59
59
  end
60
60
 
61
- ui.info "#{ui.color('SparkleFormation:', :bold)} #{ui.color('update', :green)}"
61
+ unless(config[:print_only])
62
+ ui.info "#{ui.color('SparkleFormation:', :bold)} #{ui.color('update', :green)}"
63
+ end
62
64
 
63
65
  unless(file)
64
66
  if(config[:template])
@@ -68,7 +70,9 @@ module Sfn
68
70
  stack_info << " #{ui.color('(no template update)', :yellow)}"
69
71
  end
70
72
  end
71
- ui.info " -> #{stack_info}"
73
+ unless(config[:print_only])
74
+ ui.info " -> #{stack_info}"
75
+ end
72
76
  if(file)
73
77
  if(config[:print_only])
74
78
  ui.puts format_json(parameter_scrub!(template_content(file)))
@@ -32,6 +32,7 @@ module Sfn
32
32
  callbacks_for(c_type)
33
33
  end.flatten(1).compact.uniq.each do |item|
34
34
  callback_name, callback, quiet = item
35
+ quiet = true if config[:print_only]
35
36
  ui.info "Callback #{ui.color(type.to_s, :bold)} #{callback_name}: #{ui.color('starting', :yellow)}" unless quiet
36
37
  if(args.empty?)
37
38
  callback.call
@@ -109,17 +109,21 @@ module Sfn
109
109
  # @param sparkle [SparkleFormation, Hash] template instance
110
110
  # @return [Array<Array<String>, Smash>] prefix value, parameters
111
111
  def prefix_parameters_setup(sparkle)
112
- if(sparkle.is_a?(SparkleFormation))
112
+ case sparkle
113
+ when SparkleFormation
113
114
  parameter_prefix = sparkle.root? ? [] : (sparkle.root_path - [sparkle.root]).map do |s|
114
115
  Bogo::Utility.camel(s.name)
115
116
  end
116
117
  stack_parameters = sparkle.compile.parameters
117
118
  stack_parameters = stack_parameters.nil? ? Smash.new : stack_parameters._dump
118
- else
119
+ when Hash
119
120
  parameter_prefix = []
120
121
  stack_parameters = TEMPLATE_PARAMETER_LOCATIONS.map do |loc_key|
121
122
  sparkle[loc_key]
122
123
  end.compact.first || Smash.new
124
+ else
125
+ parameter_prefix = []
126
+ stack_parameters = Smash.new
123
127
  end
124
128
  [parameter_prefix, stack_parameters]
125
129
  end
@@ -236,11 +240,12 @@ module Sfn
236
240
  current_parameters = opts[:current_parameters] || {}
237
241
  current_stack = opts[:stack]
238
242
  parameter_prefix, stack_parameters = prefix_parameters_setup(sparkle)
243
+ sparkle_root_name = sparkle.is_a?(SparkleFormation) ? sparkle.root.name : nil
239
244
  unless(stack_parameters.empty?)
240
245
  format_config_parameters!
241
246
  param_banner = false
242
247
  stack_parameters.each do |param_name, param_value|
243
- ns_key = locate_config_parameter_key(parameter_prefix, param_name, sparkle.root.name)
248
+ ns_key = locate_config_parameter_key(parameter_prefix, param_name, sparkle_root_name)
244
249
  # When parameter is a hash type, it is being set via
245
250
  # intrinsic function and we don't modify
246
251
  if(function_set_parameter?(current_parameters[param_name]))
@@ -12,6 +12,8 @@ module Sfn
12
12
  TEMPLATE_IGNORE_DIRECTORIES = %w(components dynamics registry)
13
13
  # maximum number of attempts to get valid parameter value
14
14
  MAX_PARAMETER_ATTEMPTS = 5
15
+ # default provider used when credentials are unset
16
+ DEFAULT_PROVIDER_NAME = :aws
15
17
 
16
18
  module InstanceMethods
17
19
 
@@ -123,17 +125,17 @@ module Sfn
123
125
  def sparkle_collection
124
126
  memoize(:sparkle_collection) do
125
127
  collection = SparkleFormation::SparkleCollection.new(
126
- :provider => config.get(:credentials, :provider)
128
+ :provider => config.fetch(:credentials, :provider, DEFAULT_PROVIDER_NAME)
127
129
  )
128
130
  begin
129
131
  if(config[:base_directory])
130
132
  root_pack = SparkleFormation::SparklePack.new(
131
133
  :root => config[:base_directory],
132
- :provider => config.get(:credentials, :provider)
134
+ :provider => config.fetch(:credentials, :provider, DEFAULT_PROVIDER_NAME)
133
135
  )
134
136
  else
135
137
  root_pack = SparkleFormation::SparklePack.new(
136
- :provider => config.get(:credentials, :provider)
138
+ :provider => config.fetch(:credentials, :provider, DEFAULT_PROVIDER_NAME)
137
139
  )
138
140
  end
139
141
  collection.set_root(root_pack)
@@ -599,7 +601,8 @@ module Sfn
599
601
  include Sfn::CommandModule::Template::InstanceMethods
600
602
  include Sfn::Utils::PathSelector
601
603
  include Sfn::Utils::StackParameterScrubber
602
- end
604
+ include Sfn::Utils::StackParameterValidator
605
+ end
603
606
  end
604
607
 
605
608
  end
@@ -16,6 +16,11 @@ module Sfn
16
16
  :description => 'Do not use provider customized dump behavior'
17
17
  )
18
18
 
19
+ attribute(
20
+ :yaml, [TrueClass, FalseClass],
21
+ :description => 'Output template content in YAML format'
22
+ )
23
+
19
24
  end
20
25
  end
21
26
  end
data/lib/sfn/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Sfn
2
2
  # Current library version
3
- VERSION = Gem::Version.new('3.0.22')
3
+ VERSION = Gem::Version.new('3.0.24')
4
4
  end
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.0.22
4
+ version: 3.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-04 00:00:00.000000000 Z
11
+ date: 2017-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo-cli