Commit 6ba42819 authored by Shashank Kumar's avatar Shashank Kumar

adding explicit gpg2 binary

parent 7e84a43a
......@@ -20,5 +20,6 @@ pylint:
pytest:
type: test
script:
- apt-get install -y gnupg2
- pipenv install --skip-lock pytest pytest-cov
- pipenv run pytest tests --cov=modules
......@@ -35,7 +35,8 @@ sudo apt-get install -y \
libswscale-dev \
libavformat-dev \
libavcodec-dev \
zlib1g-dev
zlib1g-dev \
gnupg2
# Install gstreamer for audio, video (optional)
sudo apt-get install -y \
......
'''
Service functions for encryption.tools module
'''
from subprocess import check_output
import gnupg
from modules.encryption.tools.all_tools.exceptions import GPGError
......@@ -13,9 +15,14 @@ def create_gnupg_object():
'''
Creating and returning GnuPG object
'''
gpg = gnupg.GPG(gnupghome=GNUPG_HOME)
gpg.encoding = 'utf-8'
return gpg
gpg_binary_path = check_output(
'which gpg2', shell=True).decode().strip('\n')
if gpg_binary_path:
gpg = gnupg.GPG(gnupghome=GNUPG_HOME, gpgbinary=gpg_binary_path)
gpg.encoding = 'utf-8'
return gpg
raise GPGError('''Please install gpg2 using your Operating System\'s
package manager''')
def create_gpg_key_pair(name, email, comment, expire_date, passphrase=''):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment