6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/dapp/kube/dapp/command/secret_edit.rb', line 6
def kube_secret_edit(file_path)
secret_key_should_exist!
with_kube_tmp_chart_dir do
decoded_data = begin
raise Error::Command, code: :file_not_exist, data: { path: File.expand_path(file_path) } unless File.exist?(file_path)
if options[:values]
(file_path)
else
(file_path)
end
end
tmp_file_path = kube_tmp_chart_path(file_path)
tmp_file_path.binwrite(decoded_data)
system(kube_secret_editor, tmp_file_path.to_s)
encoded_data = begin
if options[:values]
kube_secret_values(tmp_file_path)
else
kube_secret_file(tmp_file_path)
end
end
IO.binwrite(file_path, "#{encoded_data}\n")
end
end
|