diff --git a/wo/core/acme.py b/wo/core/acme.py index 86de29e..dcc1944 100644 --- a/wo/core/acme.py +++ b/wo/core/acme.py @@ -51,11 +51,14 @@ class WOAcme: """Export acme.sh csv certificate list""" # check acme.sh is installed WOAcme.check_acme(self) - if not WOShellExec.cmd_exec( - self, "{0} ".format(WOAcme.wo_acme_exec) + - "--list --listraw > /var/lib/wo/cert.csv"): + acme_list = WOShellExec.cmd_exec_stdout( + self, "{0} ".format(WOAcme.wo_acme_exec) + + "--list --listraw") + if acme_list: + WOFileUtils.textwrite(self, '/var/lib/wo/cert.csv', acme_list) + WOFileUtils.chmod(self, '/var/lib/wo/cert.csv', 0o600) + else: Log.error(self, "Unable to export certs list") - WOFileUtils.chmod(self, '/var/lib/wo/cert.csv', 0o600) def setupletsencrypt(self, acme_domains, acmedata): """Issue SSL certificates with acme.sh""" diff --git a/wo/core/fileutils.py b/wo/core/fileutils.py index f6011da..92d45bf 100644 --- a/wo/core/fileutils.py +++ b/wo/core/fileutils.py @@ -386,27 +386,3 @@ class WOFileUtils(): return True else: return False - - def convertFileBestGuess(self, filename, filepath): - """Convert file to utf-8""" - sourceFormats = ['ascii', 'iso-8859-1'] - for format in sourceFormats: - try: - os.chdir(filepath) - with codecs.open(filename, 'rU', format) as sourceFile: - with codecs.open( - 'tmp' + '/' + sourceFile, 'w', 'utf-8') as targetFile: - for line in sourceFile: - targetFile.write(line) - return - except UnicodeDecodeError: - pass - if os.path.exists("/tmp/{0}".format(filename)): - try: - self.rm(filepath + filename) - self.mvfile("/tmp/{0}".format(filename), filepath + filename) - except Exception as e: - Log.debug(self, "{0}".format(e)) - Log.error( - self, - "Unable to move file : {0} ".format(filepath + filename))