Module: Dapp::Kube::Dapp::Command::SecretRegenerate
- Included in:
- Dapp
- Defined in:
- lib/dapp/kube/dapp/command/secret_regenerate.rb
Instance Method Summary collapse
- #kube_regenerate_secret_file(file_path) ⇒ Object
- #kube_regenerate_secret_values(file_path) ⇒ Object
- #kube_secret_regenerate(*secret_values_paths) ⇒ Object
- #old_secret ⇒ Object
Instance Method Details
#kube_regenerate_secret_file(file_path) ⇒ Object
24 25 26 |
# File 'lib/dapp/kube/dapp/command/secret_regenerate.rb', line 24 def kube_regenerate_secret_file(file_path) secret.generate(old_secret.extract(IO.binread(file_path).chomp("\n"))) end |
#kube_regenerate_secret_values(file_path) ⇒ Object
28 29 30 |
# File 'lib/dapp/kube/dapp/command/secret_regenerate.rb', line 28 def kube_regenerate_secret_values(file_path) kube_helm_encode_json(secret, kube_helm_decode_json(old_secret, yaml_load_file(file_path))).to_yaml end |
#kube_secret_regenerate(*secret_values_paths) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dapp/kube/dapp/command/secret_regenerate.rb', line 6 def kube_secret_regenerate(*secret_values_paths) regenerated_data = {} secret_values_paths << kube_chart_path('secret-values.yaml') if kube_chart_path('secret-values.yaml').file? secret_values_paths.each do |file_path| kube_secret_file_validate!(file_path) regenerated_data[file_path] = kube_regenerate_secret_values(file_path) end Dir.glob(kube_chart_secret_path('**/*'), File::FNM_DOTMATCH).each do |file_path| next if File.directory?(file_path) kube_secret_file_validate!(file_path) regenerated_data[file_path] = kube_regenerate_secret_file(file_path) end regenerated_data.each { |file_path, data| IO.binwrite(file_path, "#{data}\n") } end |