ops_team 0.14.2 → 0.14.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/action.rb +14 -0
- data/lib/ops.rb +7 -0
- 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: 39b95630f778d48b40cb40418de7283acb5b5f47aeabe0d01f0580d6b1c93e22
|
4
|
+
data.tar.gz: 11c608a31bece6e3785bc94c48277c8b2aa6b9227a80517cd7fc46e18b3d5643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d891bdf8088dfc4d5c709e6cfe57e4d807aa6993630c6dd1d96335749a475266ecee061b93584e086e5f8f7047e9928f448be1b43237d9ef3bae5f1b2af331c
|
7
|
+
data.tar.gz: 9c974c476d915087da8752dd0a60236401cc1c058418e42835e196d679ed879c97fb73d82e248be2c625fa6619fca6b9a3915e13fd81cfc56ab521b74938ba33
|
data/lib/action.rb
CHANGED
@@ -36,6 +36,20 @@ class Action
|
|
36
36
|
@config["skip_#{name}_hooks"]
|
37
37
|
end
|
38
38
|
|
39
|
+
def config_valid?
|
40
|
+
config_errors.empty?
|
41
|
+
end
|
42
|
+
|
43
|
+
def config_errors
|
44
|
+
@config_errors ||= begin
|
45
|
+
errors = []
|
46
|
+
|
47
|
+
errors << "No 'command' specified in 'action'." unless @config['command']
|
48
|
+
|
49
|
+
errors
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
39
53
|
private
|
40
54
|
|
41
55
|
def load_secrets?
|
data/lib/ops.rb
CHANGED
@@ -19,6 +19,7 @@ require_rel "builtins"
|
|
19
19
|
# executes commands based on local `ops.yml`
|
20
20
|
class Ops
|
21
21
|
class UnknownActionError < StandardError; end
|
22
|
+
class ActionConfigError < StandardError; end
|
22
23
|
|
23
24
|
CONFIG_FILE = "ops.yml"
|
24
25
|
|
@@ -26,6 +27,7 @@ class Ops
|
|
26
27
|
UNKNOWN_ACTION_EXIT_CODE = 65
|
27
28
|
ERROR_LOADING_APP_CONFIG_EXIT_CODE = 66
|
28
29
|
MIN_VERSION_NOT_MET_EXIT_CODE = 67
|
30
|
+
ACTION_CONFIG_ERROR_EXIT_CODE = 68
|
29
31
|
|
30
32
|
RECOMMEND_HELP_TEXT = "Run 'ops help' for a list of builtins and actions."
|
31
33
|
|
@@ -52,6 +54,9 @@ class Ops
|
|
52
54
|
Output.error(e.to_s)
|
53
55
|
Output.out(RECOMMEND_HELP_TEXT) unless print_did_you_mean
|
54
56
|
exit(UNKNOWN_ACTION_EXIT_CODE)
|
57
|
+
rescue ActionConfigError => e
|
58
|
+
Output.error("Error(s) running action '#{@action_name}': #{e}")
|
59
|
+
exit(ACTION_CONFIG_ERROR_EXIT_CODE)
|
55
60
|
end
|
56
61
|
|
57
62
|
private
|
@@ -98,6 +103,8 @@ class Ops
|
|
98
103
|
|
99
104
|
return builtin.run if builtin
|
100
105
|
|
106
|
+
raise ActionConfigError, action.config_errors.join("; ") unless action.config_valid?
|
107
|
+
|
101
108
|
do_before_action
|
102
109
|
Output.notice("Running '#{action}' from #{CONFIG_FILE} in environment '#{ENV['environment']}'...")
|
103
110
|
action.run
|
data/ops_team.gemspec
CHANGED