Skip to content

Commit 285d402

Browse files
committed
More helpful error when attempting to create empty secret
1 parent 4155e42 commit 285d402

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

k

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,6 +1994,11 @@ def secrets_create
19941994
new_env = YAML.load_file(tmp_file)
19951995
File.delete(tmp_file)
19961996

1997+
# Can happen if the user eg. deletes everything in the editor
1998+
unless new_env.is_a?(Hash) && !new_env.empty?
1999+
abort "Error: No environment variables found, aborting secret creation."
2000+
end
2001+
19972002
data = new_env.transform_values(&:to_s).transform_values(&Base64.method(:strict_encode64))
19982003

19992004
secret_yaml = {

0 commit comments

Comments
 (0)