sfn 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 503fe5b1c6c2b1fd9620fa4031e4f922e7432739
4
- data.tar.gz: ce03c4291a2edfb660e7614b7202835f062ee965
3
+ metadata.gz: 69dfa18182936f431c28d80ce5fa6fbbc356b006
4
+ data.tar.gz: 5f7cff254502ffaef0a89e3fa0dc005f68a6aa93
5
5
  SHA512:
6
- metadata.gz: 3ebf8bfb6f17238c53cf49b295e938bacaa04298fa79f9f2b694d8c8fd927ead75c1acf005fd7ebd63f870039bb890e98659395cd6451b83f934800b3a459ded
7
- data.tar.gz: bf7061df664df0cec57c29627f57262effe53652f1bd49dc439fe4157983730adacb4831fbfe10750f30764517db8d90716a16410ce383e2f14f045a32ac5bf7
6
+ metadata.gz: 34e785122c57f3e05bd498a533dec705026556159c52077967f49cb3058da52cf62f793f10e72d1e202b70ffad7b510154b56f6bb8adf0190bd1a0f558a8b5f7
7
+ data.tar.gz: 96ec84db44330109ef9b046e0dcd9afa25a5dc9c291e93bad36257b191aed6b6c6a26099c73a0b62061f11d203621e7fab26f4e5f9f99b07be12d381e12e0004
@@ -1,3 +1,8 @@
1
+ ## v0.3.2
2
+ * Validate stack name prior to discovery on apply
3
+ * Update configuration usage to allow runtime modification
4
+ * Allow `create` command to print-only without requiring API credentials
5
+
1
6
  ## v0.3.0
2
7
  * Conversion from `knife-cloudformation` to `sfn`
3
8
  * Add knife subcommand alias `sparkleformation`
@@ -17,12 +17,19 @@ module Sfn
17
17
  autoload :Validate, 'sfn/command/validate'
18
18
 
19
19
  # Override to provide config file searching
20
- def initialize(opts, args)
21
- unless(opts[:config])
22
- opts = opts.to_hash.to_smash(:snake)
23
- discover_config(opts)
20
+ def initialize(cli_opts, args)
21
+ unless(cli_opts[:config])
22
+ cli_opts = cli_opts.to_hash.to_smash(:snake)
23
+ discover_config(cli_opts)
24
+ end
25
+ super(cli_opts, args)
26
+ end
27
+
28
+ # @return [Smash]
29
+ def config
30
+ memoize(:config) do
31
+ super
24
32
  end
25
- super
26
33
  end
27
34
 
28
35
  protected
@@ -38,6 +38,15 @@ module Sfn
38
38
  unpack_nesting(name, file, :create)
39
39
  else
40
40
 
41
+ if(config[:print_only] && !config[:apply_stacks])
42
+ ui.info _format_json(
43
+ translate_template(
44
+ Sfn::Utils::StackParameterScrubber.scrub!(file)
45
+ )
46
+ )
47
+ return
48
+ end
49
+
41
50
  stack = provider.connection.stacks.build(
42
51
  config[:options].dup.merge(
43
52
  :name => name,
@@ -70,12 +70,17 @@ module Sfn
70
70
  end
71
71
  end
72
72
 
73
+ # Discover stacks defined within the resources of given stack
74
+ #
75
+ # @param stack [Miasma::Models::Orchestration::Stack]
73
76
  def discover_stacks(stack)
74
77
  stack.resources.reload.all.each do |resource|
75
78
  if(resource.type == 'AWS::CloudFormation::Stack')
76
79
  nested_stack = provider.connection.stacks.get(resource.id)
77
- @stacks.push(nested_stack).uniq!
78
- discover_stacks(nested_stack)
80
+ if(nested_stack)
81
+ @stacks.push(nested_stack).uniq!
82
+ discover_stacks(nested_stack)
83
+ end
79
84
  end
80
85
  end
81
86
  end
@@ -117,13 +117,9 @@ module Sfn
117
117
  arguments
118
118
  end
119
119
 
120
- # Fetches value from local configuration (#opts) and falls
121
- # back to global configuration (#options)
122
- #
123
- # @return [Object]
124
120
  def config
125
121
  memoize(:config) do
126
- options.deep_merge(opts)
122
+ super
127
123
  end
128
124
  end
129
125
 
@@ -18,7 +18,7 @@ module Sfn
18
18
  # @param stack [Miasma::Models::Orchestration::Stack]
19
19
  # @return [Miasma::Models::Orchestration::Stack]
20
20
  def apply_stacks!(stack)
21
- remote_stacks = config.fetch(:apply_stacks, [])
21
+ remote_stacks = [config[:apply_stack]].flatten.compact
22
22
  remote_stacks.each do |stack_name|
23
23
  remote_stack = provider.connection.stacks.get(stack_name)
24
24
  if(remote_stack)
@@ -36,7 +36,7 @@ module Sfn
36
36
  # @param remote_stack [Miasma::Models::Orchestration::Stack] stack to inspect for nested stacks
37
37
  # @param stack [Miasma::Models::Orchestration::Stack] current stack
38
38
  # @return [Miasma::Models::Orchestration::Stack]
39
- def apply_nested_stacks(remote_stack, stack)
39
+ def apply_nested_stacks!(remote_stack, stack)
40
40
  remote_stack.resources.all.each do |resource|
41
41
  if(resource.type == 'AWS::CloudFormation::Stack')
42
42
  nested_stack = resource.expand
@@ -40,8 +40,8 @@ module Sfn
40
40
  # @option args [Numeric] :stack_list_interval interval to wait between stack list refresh
41
41
  def initialize(args={})
42
42
  args = args.to_smash
43
- unless(args[:miasma][:provider])
44
- best_guess = args[:miasma].keys.group_by do |key|
43
+ unless(args.get(:miasma, :provider))
44
+ best_guess = args.fetch(:miasma, {}).keys.group_by do |key|
45
45
  key.to_s.split('_').first
46
46
  end.sort do |x, y|
47
47
  y.size <=> x.size
@@ -1,4 +1,4 @@
1
1
  module Sfn
2
2
  # Current library version
3
- VERSION = Gem::Version.new('0.3.0')
3
+ VERSION = Gem::Version.new('0.3.2')
4
4
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.description = 'SparkleFormation CLI'
11
11
  s.license = 'Apache-2.0'
12
12
  s.require_path = 'lib'
13
- s.add_dependency 'bogo-cli', '~> 0.1.6'
13
+ s.add_dependency 'bogo-cli', '~> 0.1.12'
14
14
  s.add_dependency 'miasma'
15
15
  s.add_dependency 'net-ssh'
16
16
  s.add_dependency 'sparkle_formation', '>= 0.2.8'
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: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2015-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bogo-cli
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.1.6
19
+ version: 0.1.12
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.1.6
26
+ version: 0.1.12
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: miasma
29
29
  requirement: !ruby/object:Gem::Requirement