kitchen-salt
kitchen-salt copied to clipboard
[Windows] gpg --import is not supported
Hi, I have been scratching my head for a bit to make the pillar decryption work on windows. Then to find out that gpg import (contain in gpgkey.sh) is not ran for windows_os.
I got kitchen-salt running on a git runner where I got the gpg key, the key get properly export to the guest instance, but its never being imported again.
salt_solo.rb
if windows_os?
salt_config_path = config[:salt_config]
cmd << "(get-content #{os_join(config[:root_path], salt_config_path, 'minion')}) -replace '\\$env:TEMP', $env:TEMP | set-content #{os_join(config[:root_path], salt_config_path, 'minion')} ;"
RUN GPG IMPORT HERE
else
# install/update dependencies
cmd << sudo("chmod +x #{config[:root_path]}/*.sh;")
cmd << sudo("#{config[:root_path]}/dependencies.sh;")
cmd << sudo("#{config[:root_path]}/gpgkey.sh;") if config[:gpg_key]
salt_config_path = config[:salt_config]
end
Let say that if gpg for windows is install then run the import (or pretty much what is in the gpgkey.erb):
gpg.exe --allow-secret-key-import --no-default-keyring --homedir "$GPGKEY_DIR" --import <"#{config[:root_path]}/gpgkey.txt"
Regards,
Feel free to open a PR to implement this for windows. I did not have a windows machine to test this feature on windows, so I didn't implement it.