ops_team 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/app_config.rb +3 -2
- data/lib/ops.rb +4 -0
- data/lib/secrets.rb +15 -1
- data/ops_team.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a78e3661dac6cc0796d00dc840eeb9fedbbc7f358bf3c6af4609d37175e8d53e
|
4
|
+
data.tar.gz: f919b18cdcec154a9dac78020c20f229771b3bd870baf86ef020002c74394acc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54d21b402bce3e50963b679be2393a7cf1cd993fa51c2c73481c348c4fa019748d5511a4654d9c94c175a985bb7545580cf000594fd2a7c05c7a43d849895cdd
|
7
|
+
data.tar.gz: 64ef22c5c1a2264b3734166fef0b0752c2cc3ae18003ee376d1a86e0cba97d49fdb1c3de74606e0eb0aef050899d8e20c306165190d5cefc78dc030abe26997c
|
data/lib/app_config.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
class AppConfig
|
4
|
+
class ParsingError < StandardError; end
|
5
|
+
|
4
6
|
class << self
|
5
7
|
def load
|
6
8
|
new(app_config_path).load
|
@@ -36,8 +38,7 @@ class AppConfig
|
|
36
38
|
def config
|
37
39
|
@config ||= file_contents ? YAML.safe_load(file_contents) : {}
|
38
40
|
rescue YAML::SyntaxError => e
|
39
|
-
|
40
|
-
{}
|
41
|
+
raise ParsingError, "Error parsing config data: #{e}"
|
41
42
|
end
|
42
43
|
|
43
44
|
def file_contents
|
data/lib/ops.rb
CHANGED
@@ -18,6 +18,7 @@ class Ops
|
|
18
18
|
|
19
19
|
INVALID_SYNTAX_EXIT_CODE = 64
|
20
20
|
UNKNOWN_ACTION_EXIT_CODE = 65
|
21
|
+
ERROR_LOADING_APP_CONFIG_EXIT_CODE = 66
|
21
22
|
|
22
23
|
class << self
|
23
24
|
def project_name
|
@@ -60,6 +61,9 @@ class Ops
|
|
60
61
|
|
61
62
|
Output.notice("Running '#{action}' from #{CONFIG_FILE} in environment '#{ENV['environment']}'...")
|
62
63
|
action.run
|
64
|
+
rescue AppConfig::ParsingError => e
|
65
|
+
Output.error("Error parsing app config: #{e}")
|
66
|
+
exit(ERROR_LOADING_APP_CONFIG_EXIT_CODE)
|
63
67
|
end
|
64
68
|
|
65
69
|
def builtin
|
data/lib/secrets.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'json'
|
4
|
+
require 'open3'
|
4
5
|
|
5
6
|
require 'output'
|
6
7
|
require 'app_config'
|
@@ -38,6 +39,19 @@ class Secrets < AppConfig
|
|
38
39
|
end
|
39
40
|
|
40
41
|
def file_contents
|
41
|
-
@file_contents ||=
|
42
|
+
@file_contents ||= begin
|
43
|
+
@filename.match(/\.ejson$/) ? ejson_contents : super
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def ejson_contents
|
48
|
+
@ejson_contents ||= begin
|
49
|
+
out, err, _status = Open3.capture3("ejson decrypt #{@filename}")
|
50
|
+
|
51
|
+
# TODO: err is only nil in testing, but I can't figure out why the stubbing isn't working
|
52
|
+
raise ParsingError, "Error decrypting EJSON file: #{err}" unless err.nil? || err.empty?
|
53
|
+
|
54
|
+
out
|
55
|
+
end
|
42
56
|
end
|
43
57
|
end
|
data/ops_team.gemspec
CHANGED