Support EDITOR having arguments in encrypted secrets codebase
The following discussion from !136002 (merged) should be addressed:
-
@stanhu started a discussion: (+1 comment) I ran this Rake task and got:
WARNING: Content was not a valid Redis secret yml file. Did not include any key-value pairs Contents were unchanged. File encrypted and saved.It did create
shared/encrypted_settings/redis.yaml.enc, but I expected to see an edit prompt. I think it's because myEDITORprompt is set toemacs -nw, sosystemdidn't run:[42, 51] in /Users/stanhu/gdk-ee/gitlab/lib/gitlab/encrypted_command_base.rb 42: contents = encrypted_file_template unless File.exist?(encrypted.content_path) 43: File.write(temp_file.path, contents) 44: system(ENV['EDITOR'], temp_file.path) 45: changes = File.read(temp_file.path) 46: contents_changed = contents != changes => 47: validate_contents(changes) 48: changes 49: end 50: 51: puts "Contents were unchanged." unless contents_changed (byebug) encrypted_file_template "# password: '123'\n" (byebug)This might be a follow-up issue, but:
- Should we check the return value of
system? - Should we use
ENV['EDITOR']&.splitso that multiple arguments are handled?
- Should we check the return value of