I have a file that needs to be decrypted in GCP Dataflow pipeline, my code is written in Python. I have tried to use subprocess to invoke gpg command remotely:
subprocess.call(['gpg', '-d', '/tmp/test.csv.gpg' ,'>', '/tmp/test.csv'])
or
subprocess.call(['gpg', '-d', '/tmp/test.csv.gpg > /tmp/test.csv'])
but it seems that the above code snippets are not working right. Because no new file is created after the execution of the above code. Does anyone have any idea how to trigger this gpg command remotely?
Any help will be appreciated. Thanks
This issue occurs probably because the GPG command is reading '/tmp/test.csv.gpg > /tmp/test.csv' as a filename to open, therefore it would explain why it is not creating a new file as expected.
So, a simpler solution would be to change the code within subprocess as follows:
import subprocess
subprocess.call(['gpg', '--output', 'doc', '--decrypt','doc.gpg'])