diff --git a/lecm/certificate.py b/lecm/certificate.py index e6dabbe..8e8944d 100644 --- a/lecm/certificate.py +++ b/lecm/certificate.py @@ -320,7 +320,8 @@ def generate(self): self._create_account_key() self._create_private_key() self._create_csr() - os.makedirs('%s/challenges/%s' % (self.path, self.name)) + if not os.path.exists('%s/challenges/%s' % (self.path, self.name)): + os.makedirs('%s/challenges/%s' % (self.path, self.name)) self._create_certificate() def renew(self): diff --git a/lecm/utils.py b/lecm/utils.py index c51568e..2b44aec 100644 --- a/lecm/utils.py +++ b/lecm/utils.py @@ -15,6 +15,7 @@ from prettytable import PrettyTable from OpenSSL import crypto +from distro import linux_distribution import copy import logging @@ -45,8 +46,7 @@ def filter_certificates(items, certificates): def enforce_selinux_context(output_directory): - - if platform.dist()[0] in ['fedora', 'centos', 'redhat']: + if linux_distribution()[0] in ['fedora', 'centos', 'redhat']: if os.path.exists('/sbin/semanage'): FNULL = open(os.devnull, 'w')