jackal-stacks 0.1.4 → 0.1.6

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: f8b70c383108ba379df03bf7533a5b998ed8fb23
4
- data.tar.gz: f63f27a159a8135681745cd7f7c142608a54130c
3
+ metadata.gz: 7331be29e3c4592f1e4c524ffab3560693ebeed5
4
+ data.tar.gz: eb3236969e633ebb07a8363542d8aaec2ea61525
5
5
  SHA512:
6
- metadata.gz: 9aaf37401220932bb185bcc12725935f421d897d0fcdd428d2bd1f3b838da9cfdd0db83c700640125a661c826999202a48ae87f25dfe38edd338721f0306902d
7
- data.tar.gz: a014498992b6c01e2e80feb0d7736a2b3b8d021ef2ab9e26589580e83aaa5df5caec114412bfe79986c539292d0394cb7b34140799a83d2de511526fcfdce387
6
+ metadata.gz: 3ef673f4bc94b275c7ba8e53c6e70c8eeab9b5a30b135ef20487ec69ce2c657d9c6039ada30d08e70fb0fc15a980a85bea230a53d735edbd6ca68dfd58ef402a
7
+ data.tar.gz: 1303387ab2be6bf3d0118b9e562bac1f0d918e7b8eadf3ae0f677e9b5a76fd457b3ed31b300c4d896e374fbed67039f5902e641ece2c25893c564d03a398a13b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.1.6
2
+ * Add wait helper on expected stack state
3
+ * Provide explicit method to extract API configuration
4
+ * Add provider entry to configuration items
5
+
1
6
  # v0.1.4
2
7
  * Add service registration
3
8
 
data/lib/jackal-stacks.rb CHANGED
@@ -19,8 +19,12 @@ Jackal.service(
19
19
  :orchestration__bucket_name => {
20
20
  :description => 'Name of remote bucket used for infrastructure storage'
21
21
  },
22
+ :orchestration__api__provider => {
23
+ :description => 'Remote orchestration provider',
24
+ :type => :string
25
+ },
22
26
  :orchestration__api__credentials => {
23
- :description => 'Remove credentials for API access',
27
+ :description => 'Credentials for orchestration API access',
24
28
  :type => :hash
25
29
  },
26
30
  :default_template_path => {
@@ -32,19 +32,6 @@ module Jackal
32
32
  end
33
33
  end
34
34
 
35
- # @return [String] working directory
36
- def working_directory
37
- memoize(:working_directory, :direct) do
38
- FileUtils.mkdir_p(dir = config.fetch(:working_directory, '/tmp/jackal-stack-builder'))
39
- dir
40
- end
41
- end
42
-
43
- # @return [String] fresh working directory
44
- def workspace(payload)
45
- File.join(working_directory, payload[:id])
46
- end
47
-
48
35
  # Build or update stacks
49
36
  #
50
37
  # @param message [Carnivore::Message]
@@ -165,6 +152,19 @@ module Jackal
165
152
  args = build_stack_args(payload, directory)
166
153
  stack_name = payload.get(:data, :stacks, :name)
167
154
  Sfn::Command.const_get(action.to_s.capitalize).new(args, [stack_name]).execute!
155
+ wait_for_complete(stacks_api.stacks.get(stack_name))
156
+ true
157
+ end
158
+
159
+ # Wait for stack to reach a completion state
160
+ #
161
+ # @param stack [Miasma::Models::Orchestration::Stack]
162
+ # @return [TrueClass]
163
+ def wait_for_complete(stack)
164
+ until(stack.state.to_s.donwcase.end_with?('complete') || stack.state.to_s.donwcase.end_with?('failed'))
165
+ sleep(10)
166
+ stack.reload
167
+ end
168
168
  true
169
169
  end
170
170
 
@@ -6,17 +6,18 @@ module Jackal
6
6
 
7
7
  # @return [Miasma::Models::Orchestration]
8
8
  def stacks_api
9
- memoize(:stacks_api, :direct) do
10
- Miasma.api(
11
- config.fetch(
12
- :orchestration, :api, Smash.new
13
- ).merge(
14
- :type => :orchestration
15
- )
16
- )
9
+ memoize(:stacks_api, api_config.to_smash.checksum) do
10
+ Miasma.api(api_config)
17
11
  end
18
12
  end
19
13
 
14
+ # @return [Hash] API connection configuration
15
+ def api_config
16
+ config.fetch(:orchestration, :api, Smash.new).merge(
17
+ :type => :orchestration
18
+ )
19
+ end
20
+
20
21
  # Determine namespace key to use for accessing parameters
21
22
  #
22
23
  # @param payload [Smash]
@@ -1,6 +1,6 @@
1
1
  module Jackal
2
2
  module Stacks
3
3
  # Current library version
4
- VERSION = Gem::Version.new('0.1.4')
4
+ VERSION = Gem::Version.new('0.1.6')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jackal-stacks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.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: 2015-05-21 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jackal
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubyforge_project:
102
- rubygems_version: 2.2.2
102
+ rubygems_version: 2.4.8
103
103
  signing_key:
104
104
  specification_version: 4
105
105
  summary: Message processing helper