knife-cloudformation 0.2.6 → 0.2.8

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: 3b002141f6da41466fef046cf455e9ee8a355a98
4
- data.tar.gz: c48f9be9c8bdedfadee2aab047a02b971d7a90d9
3
+ metadata.gz: 13b24aa4ad8bd90e9b02f130ee8dc992e657ce1b
4
+ data.tar.gz: c1916b7656ed73950454349fb236407c94805013
5
5
  SHA512:
6
- metadata.gz: c6452f2c5114f4347c9accc2e0672e7be693e975c8fa61921808d2ef79acb352a63bafae6323836816b3c2c9f80caee30e90ac18987803e424d9268d228c81c3
7
- data.tar.gz: 5295001be1d029244189c029b753e12065d39061918091adc9cb81157b9bbdaec82c9f8623b8d6f4e178622700719f9f9a7d9e852dde417854a3b5421a155d0a
6
+ metadata.gz: b3927c0adb0eac79ce40f4468361814cc3cd22d7e50c5003f646164576e12a4180b480a0b3dc7eabd7ee2bc62a44a99234236f78b6e301d733834dbfcc93469f
7
+ data.tar.gz: dda8df44d640cb443a66e9757b0535d59d1d164bf3d33306b237063208b34ab9041cda45ca82ad160b311300cc4312080558a7855ada16d277b32fac2ab2d955
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## v0.2.8
2
+ * Update stack lookup implementation to make faster from CLI
3
+ * Prevent constant error on exception when Redis is not in use
4
+ * Provide better error messages on request failures
5
+
1
6
  ## v0.2.6
2
7
  * Update to parameter re-defaults to use correct hash instance
3
8
 
@@ -85,7 +85,7 @@ class Chef
85
85
  ui.info " -> #{stack_info}"
86
86
  end
87
87
 
88
- stack = provider.stacks.build(
88
+ stack = provider.connection.stacks.build(
89
89
  Chef::Config[:knife][:cloudformation][:options].dup.merge(
90
90
  :name => name,
91
91
  :template => file
@@ -107,13 +107,11 @@ class Chef
107
107
  stack.save
108
108
 
109
109
  if(Chef::Config[:knife][:cloudformation][:poll])
110
- provider.fetch_stacks
111
110
  poll_stack(stack.name)
112
- stack = provider.stacks.get(name)
111
+ stack = provider.connection.stacks.get(name)
113
112
 
114
113
  if(stack.reload.success?)
115
114
  ui.info "Stack create complete: #{ui.color('SUCCESS', :green)}"
116
- provider.fetch_stacks
117
115
  knife_output = Chef::Knife::CloudformationDescribe.new
118
116
  knife_output.name_args.push(name)
119
117
  knife_output.config[:outputs] = true
@@ -141,7 +139,7 @@ class Chef
141
139
  remote_stacks = Chef::Config[:knife][:cloudformation].
142
140
  fetch(:create, {}).fetch(:apply_stacks, [])
143
141
  remote_stacks.each do |stack_name|
144
- remote_stack = provider.stacks.get(stack_name)
142
+ remote_stack = provider.connection.stacks.get(stack_name)
145
143
  if(remote_stack)
146
144
  stack.apply_stack(remote_stack)
147
145
  else
@@ -41,7 +41,7 @@ class Chef
41
41
  # Run the stack describe action
42
42
  def _run
43
43
  stack_name = name_args.last
44
- stack = provider.stacks.get(stack_name)
44
+ stack = provider.connection.stacks.get(stack_name)
45
45
  if(stack)
46
46
  display = [].tap do |to_display|
47
47
  AVAILABLE_DISPLAYS.each do |display_option|
@@ -24,7 +24,7 @@ class Chef
24
24
  ui.warn "Destroying Cloud Formation#{plural}: #{ui.color(stacks.join(', '), :bold)}"
25
25
  ui.confirm "Destroy formation#{plural}"
26
26
  stacks.each do |stack_name|
27
- stack = provider.stacks.get(stack_name)
27
+ stack = provider.connection.stacks.get(stack_name)
28
28
  if(stack)
29
29
  stack.destroy
30
30
  else
@@ -33,7 +33,6 @@ class Chef
33
33
  end
34
34
  if(config[:polling])
35
35
  if(stacks.size == 1)
36
- provider.fetch_stacks
37
36
  poll_stack(stacks.first)
38
37
  else
39
38
  ui.error "Stack polling is not available when multiple stack deletion is requested!"
@@ -46,12 +46,12 @@ class Chef
46
46
  def _run
47
47
  name = name_args.first
48
48
  ui.info "Cloud Formation Events for Stack: #{ui.color(name, :bold)}\n"
49
- stack = provider.stacks.get(name)
49
+ stack = provider.connection.stacks.get(name)
50
50
  last_id = nil
51
51
  if(stack)
52
52
  events = get_events(stack)
53
53
  things_output(name, events, 'events')
54
- last_id = events.last[:id]
54
+ last_id = events.last ? events.last[:id] : nil
55
55
  if(Chef::Config[:knife][:cloudformation][:poll])
56
56
  cycle_events = true
57
57
  while(cycle_events)
@@ -53,7 +53,7 @@ class Chef
53
53
  # Run the stack inspection action
54
54
  def _run
55
55
  stack_name = name_args.last
56
- stack = provider.stacks.get(stack_name)
56
+ stack = provider.connection.stacks.get(stack_name)
57
57
  ui.info "Stack inspection #{ui.color(stack_name, :bold)}:"
58
58
  outputs = [:attribute, :nodes, :instance_failure].map do |key|
59
59
  if(config.has_key?(key))
@@ -37,7 +37,7 @@ class Chef
37
37
  exit 1
38
38
  end
39
39
 
40
- stack = provider.stacks.get(name)
40
+ stack = provider.connection.stacks.get(name)
41
41
 
42
42
  if(stack)
43
43
  ui.info "#{ui.color('Cloud Formation:', :bold)} #{ui.color('update', :green)}"
@@ -67,10 +67,8 @@ class Chef
67
67
 
68
68
  if(Chef::Config[:knife][:cloudformation][:poll])
69
69
  poll_stack(stack.name)
70
- provider.fetch_stacks
71
70
  if(stack.success?)
72
71
  ui.info "Stack update complete: #{ui.color('SUCCESS', :green)}"
73
- provider.fetch_stacks
74
72
  knife_output = Chef::Knife::CloudformationDescribe.new
75
73
  knife_output.name_args.push(name)
76
74
  knife_output.config[:outputs] = true
@@ -117,7 +115,7 @@ class Chef
117
115
  remote_stacks = Chef::Config[:knife][:cloudformation].
118
116
  fetch(:update, {}).fetch(:apply_stacks, [])
119
117
  remote_stacks.each do |stack_name|
120
- remote_stack = provider.stacks.get(stack_name)
118
+ remote_stack = provider.connection.stacks.get(stack_name)
121
119
  if(remote_stack)
122
120
  remote_stack.parameters.each do |key, value|
123
121
  next if Chef::Config[:knife][:cloudformation][:stacks][:ignore_parameters].include?(key)
@@ -18,7 +18,7 @@ class Chef
18
18
  file = KnifeCloudformation::Utils::StackParameterScrubber.scrub!(file)
19
19
  file = translate_template(file)
20
20
  begin
21
- result = provider.stacks.build(
21
+ result = provider.connection.stacks.build(
22
22
  :name => 'validation-stack',
23
23
  :template => file
24
24
  ).validate
@@ -264,8 +264,12 @@ module KnifeCloudformation
264
264
  self[lock_name].lock do
265
265
  yield
266
266
  end
267
- rescue Redis::Lock::LockTimeout
268
- raise if raise_on_locked
267
+ rescue => e
268
+ if(e.class.to_s == 'Redis::Lock::LockTimeout')
269
+ raise if raise_on_locked
270
+ else
271
+ raise
272
+ end
269
273
  end
270
274
  end
271
275
 
@@ -20,7 +20,10 @@ module KnifeCloudformation
20
20
  # @param args [String] extra strings to output
21
21
  def _debug(e, *args)
22
22
  if(ENV['DEBUG'])
23
- ui.fatal "Exception information: #{e.class}: #{e}\n#{e.backtrace.join("\n")}\n"
23
+ ui.fatal "Exception information: #{e.class}: #{e.message}\n#{e.backtrace.join("\n")}\n"
24
+ if(e.is_a?(Miasma::Error::ApiError))
25
+ ui.fatal "Response body: #{e.response.body.to_s.inspect}"
26
+ end
24
27
  args.each do |string|
25
28
  ui.fatal string
26
29
  end
@@ -92,7 +95,7 @@ module KnifeCloudformation
92
95
  begin
93
96
  _run
94
97
  rescue => e
95
- ui.fatal "Unexpected Error: #{e}"
98
+ ui.fatal "Unexpected Error: #{e.message}"
96
99
  _debug(e)
97
100
  exit 1
98
101
  end
@@ -19,13 +19,15 @@ module KnifeCloudformation
19
19
  # @param template [Hash]
20
20
  # @return [Hash] template
21
21
  def scrub!(template)
22
- parameters = template.fetch('Parameters', {})
23
- parameters.each do |name, options|
24
- options.delete_if do |attribute, value|
25
- !ALLOWED_PARAMETER_ATTRIBUTES.include?(attribute)
22
+ parameters = template['Parameters']
23
+ if(parameters)
24
+ parameters.each do |name, options|
25
+ options.delete_if do |attribute, value|
26
+ !ALLOWED_PARAMETER_ATTRIBUTES.include?(attribute)
27
+ end
26
28
  end
29
+ template['Parameters'] = parameters
27
30
  end
28
- template['Parameters'] = parameters
29
31
  template
30
32
  end
31
33
 
@@ -1,4 +1,4 @@
1
1
  module KnifeCloudformation
2
2
  # Current library version
3
- VERSION = Gem::Version.new('0.2.6')
3
+ VERSION = Gem::Version.new('0.2.8')
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-cloudformation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Roberts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-21 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef