covalence 0.9.1 → 0.9.2

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: 01a6df525586ec948c89317d69451a4f8acc3e46bc80fb09b55833f6b91e9ba2
4
- data.tar.gz: b20fd2249962484525305bc11f0fdf796276126c26a074e97322358b6da76622
3
+ metadata.gz: 3edbe8b6ef3a74f89e5c9e71fe0f4bab0fb20262c382b0f77e18d1e29c95368c
4
+ data.tar.gz: e8f77050f4854b994b27b961386f4bf5e010b65e485e91a427bec14c6fd7abea
5
5
  SHA512:
6
- metadata.gz: 57f06cc073babb01bda236615fec3ef042b9f20165870b6468a2b9c1d9c9f25dcd1288ccbc21e78c38ed03bd703af79205fef1f83ed8fa03907516e184fda83c
7
- data.tar.gz: 98ebbed71d2a26b88cc97784bc0006270ad211ef6e5398ac506cd78119e8d46f90067a415e6fe287ec5fcc38bc99596a5601bbe6d25e27276e051208461f7b0b
6
+ metadata.gz: 56e51eb5b4ffab694f0f21a7f5d5a2335b7353f7438809bea1fb7a064210bd506a4a891b5096ebcb9e7ea23ea415312aae7664c861bb46c8bf6ce6a4962bc69b
7
+ data.tar.gz: f224f0d6d40a9faf6183650ced547feaf6b3770586ab2a9a1b04b274710115c59155e89cdbb2e882a524a08707efb2e2f6b1020c60f4de7dcc28f87d9ab3db59
@@ -1,4 +1,4 @@
1
- ## 0.9.1 (Aug 11, 2019)
1
+ ## 0.9.2 (Aug 11, 2019)
2
2
 
3
3
  BACKWARDS INCOMPATIBILITIES:
4
4
  - The legacy Atlas Artifact backend is no longer supported.
data/README.md CHANGED
@@ -105,6 +105,10 @@ The suite can be executed with the following command:
105
105
  $ bin/covalence spec
106
106
  ```
107
107
 
108
+ To run the Rspec test locally without container, you will need to install the following:
109
+ * prefixout -- https://github.com/WhistleLabs/prefixout
110
+ * sops -- https://github.com/mozilla/sops
111
+
108
112
  ### UAT
109
113
 
110
114
  User acceptance tests targeting execution in a continuous integration (CI) environment.
@@ -498,7 +502,7 @@ You will probably need the following packages installed locally
498
502
  - Terraform
499
503
  - Packer
500
504
  - Sops
501
- - [prefixout](https://github.com/unifio/prefixout/releases/tag/v0.1.0)
505
+ - [prefixout](https://github.com/unifio/prefixout/releases)
502
506
 
503
507
  Execute the following to build the gem:
504
508
 
@@ -33,7 +33,7 @@ module Covalence
33
33
  SOPS_DECRYPTED_SUFFIX = ENV['SOPS_DECRYPTED_SUFFIX'] || "-decrypted"
34
34
 
35
35
  # No-op shell command. Should not need to modify for most unix shells.
36
- DRY_RUN_CMD = (ENV['COVALENCE_DRY_RUN_CMD'] || ":")
36
+ DRY_RUN_CMD = (ENV['COVALENCE_DRY_RUN_CMD'] || "true")
37
37
  DEBUG_CLI = (ENV['COVALENCE_DEBUG'] || 'false') =~ (/(true|t|yes|y|1)$/i)
38
38
 
39
39
  #DOCKER_ENV_FILE
@@ -1,3 +1,3 @@
1
1
  module Covalence
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: covalence
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unif.io
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-11 00:00:00.000000000 Z
11
+ date: 2019-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge
@@ -366,7 +366,6 @@ files:
366
366
  - lib/covalence/core/services/hiera_syntax_service.rb
367
367
  - lib/covalence/core/services/packer_stack_tasks.rb
368
368
  - lib/covalence/core/services/terraform_stack_tasks.rb
369
- - lib/covalence/core/state_stores/atlas.rb
370
369
  - lib/covalence/core/state_stores/consul.rb
371
370
  - lib/covalence/core/state_stores/s3.rb
372
371
  - lib/covalence/environment_tasks.rb
@@ -396,8 +395,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
396
395
  - !ruby/object:Gem::Version
397
396
  version: '0'
398
397
  requirements: []
399
- rubyforge_project:
400
- rubygems_version: 2.7.6.2
398
+ rubygems_version: 3.0.3
401
399
  signing_key:
402
400
  specification_version: 4
403
401
  summary: A tool for the management and orchestration of data used by HashiCorp infrastructure
@@ -1,157 +0,0 @@
1
- require 'json'
2
- require 'rest-client'
3
-
4
- module Covalence
5
- module Atlas
6
- AtlasTokenMissing = Class.new(StandardError)
7
-
8
- # Default base URL for Atlas.
9
- URL = "https://atlas.hashicorp.com"
10
-
11
- def self.reset_cache()
12
- @cache = Hash.new{|h,k| h[k] = Hash.new{|h,k| h[k] = Hash.new{|h,k| h[k] = Hash.new}}}
13
- end
14
-
15
- reset_cache
16
-
17
- def self.get_artifact(slug, version, key, metadata: {})
18
- ensure_atlas_token_set
19
-
20
- @cache[slug][version][key][metadata] ||= begin
21
- # Create and execute HTTP request
22
- request = "#{URL}/api/v1/artifacts/#{slug}/search"
23
-
24
- params = {}
25
- params[:version] = version
26
- if !metadata.empty?
27
- i = 1
28
- metadata.map do |k,v|
29
- params["metadata.#{i}.key"] = k
30
- params["metadata.#{i}.value"] = v
31
- i += 1
32
- end
33
- end
34
-
35
- headers = {:'X-Atlas-Token' => ENV['ATLAS_TOKEN']}
36
- headers = headers.merge({:params => params})
37
-
38
- begin
39
- response = RestClient.get request, headers
40
- rescue RestClient::ExceptionWithResponse => err
41
- fail "Unable to retrieve ID for artifact '#{slug}': " + err.message
42
- end
43
-
44
- # Parse JSON response
45
- parsed = JSON.parse(response)
46
- latest = parsed["versions"].select {|version| version['metadata'].keys.include? "#{key}" }.first
47
-
48
- # Return ID for the region specified
49
- if latest != nil
50
- latest["metadata"]["#{key}"]
51
- else
52
- fail "Requested key '#{key}' not found"
53
- end
54
- end
55
- end
56
-
57
- def self.get_output(name, stack)
58
- ensure_atlas_token_set
59
-
60
- @cache[stack][name][0][0] || begin
61
- # Create and execute HTTP request
62
- request = "#{URL}/api/v1/terraform/state/#{stack}"
63
- headers = {:'X-Atlas-Token' => ENV['ATLAS_TOKEN']}
64
-
65
- begin
66
- response = RestClient.get request, headers
67
- rescue RestClient::ExceptionWithResponse => err
68
- fail "Unable to retrieve output '#{name}' from stack '#{stack}': " + err.message
69
- end
70
-
71
- # Parse JSON response
72
- parsed = JSON.parse(response)
73
- outputs = parsed.fetch("modules")[0].fetch("outputs")
74
-
75
- # Populate the cache for subsequent calls
76
- outputs.keys.each do |key|
77
- @cache[stack][key][0][0] = outputs.fetch(key)
78
- end
79
-
80
- # Check outputs for requested key and return
81
- if outputs.has_key?(name)
82
- @cache[stack][name][0][0]
83
- else
84
- fail("Requested output '#{name}' not found")
85
- end
86
- end
87
- end
88
-
89
- def self.get_state_store(params, workspace_enabled=false)
90
- raise "State store parameters must be a Hash" unless params.is_a?(Hash)
91
- raise "Missing 'name' store parameter" unless params.has_key? 'name'
92
-
93
- config = <<-CONF
94
- terraform {
95
- backend "atlas" {
96
- name = "#{params['name']}"
97
- }
98
- }
99
- CONF
100
-
101
- return config
102
- end
103
-
104
- def self.ensure_atlas_token_set
105
- raise AtlasTokenMissing.new("Missing ATLAS_TOKEN environment variable") unless ENV.key? 'ATLAS_TOKEN'
106
- end
107
-
108
- # Return module capabilities
109
- # TODO: maybe a state_store mixin later
110
- #def self.has_key_read?
111
- #return true
112
- #end
113
-
114
- #def self.has_key_write?
115
- #return false
116
- #end
117
-
118
- #def self.has_state_read?
119
- #return true
120
- #end
121
-
122
- def self.has_state_store?
123
- return true
124
- end
125
-
126
- # Key lookups
127
- def self.lookup(type, params)
128
- raise "Lookup parameters must be a Hash" unless params.is_a?(Hash)
129
-
130
- case
131
- when type == 'artifact'
132
- required_params = [
133
- 'slug',
134
- 'version',
135
- 'key',
136
- ]
137
- required_params.each do |param|
138
- raise "Missing '#{param}' lookup parameter" unless params.has_key?(param)
139
- end
140
- metadata = {}
141
- metadata = params['metadata'] unless !params['metadata']
142
- self.get_artifact(params['slug'],params['version'],params['key'], metadata: metadata)
143
- when type == 'state'
144
- required_params = [
145
- 'key',
146
- 'stack'
147
- ]
148
- required_params.each do |param|
149
- raise "Missing '#{param}' lookup parameter" unless params.has_key?(param)
150
- end
151
- self.get_output(params['key'],params['stack'])
152
- else
153
- raise "Atlas module does not support the '#{type}' lookup type"
154
- end
155
- end
156
- end
157
- end