diff --git a/wo/cli/plugins/site.py b/wo/cli/plugins/site.py index 5fd383d..d0fc061 100644 --- a/wo/cli/plugins/site.py +++ b/wo/cli/plugins/site.py @@ -820,7 +820,7 @@ class WOSiteUpdateController(CementBaseController): dict(help="configure letsencrypt ssl for the site", action='store' or 'store_const', choices=('on', 'off', 'renew', 'subdomain', - 'wildcard', 'clean'), + 'wildcard', 'clean', 'purge'), const='on', nargs='?')), (['--dns'], dict(help="choose dns provider api for letsencrypt", @@ -1186,6 +1186,9 @@ class WOSiteUpdateController(CementBaseController): elif pargs.letsencrypt == 'clean': data['letsencrypt'] = False letsencrypt = False + elif pargs.letsencrypt == 'purge': + data['letsencrypt'] = False + letsencrypt = False if letsencrypt is check_ssl: if letsencrypt is False: @@ -1214,13 +1217,16 @@ class WOSiteUpdateController(CementBaseController): if pargs.letsencrypt == "on": if oldsitetype in ['wpsubdomain']: - data['letsencrypt'] = True - letsencrypt = True - pargs.letsencrypt == 'wildcard' + if pargs.dns: + data['letsencrypt'] = True + letsencrypt = True + pargs.letsencrypt == 'wildcard' + else: + data['letsencrypt'] = True + letsencrypt = True else: data['letsencrypt'] = True letsencrypt = True - wildcard = False if pargs.wpredis and data['currcachetype'] != 'wpredis': data['wpredis'] = True @@ -1345,16 +1351,9 @@ class WOSiteUpdateController(CementBaseController): '{0}/conf/nginx/' 'hsts.conf.disabled' .format(wo_site_webroot)) - if self.app.pargs.letsencrypt == "clean": - if os.path.isfile("{0}/conf/nginx/ssl.conf" - .format(wo_site_webroot)): - WOFileUtils.remove(self, "{0}/conf/nginx/ssl.conf" - .format(wo_site_webroot)) - WOFileUtils.remove(self, "/etc/letsencrypt/live" - "/{0}".format(wo_domain)) - WOFileUtils.remove(self, "/etc/nginx/conf.d/" - "force-ssl-{0}.conf" - .format(wo_domain_name)) + elif (self.app.pargs.letsencrypt == "clean" or + self.app.pargs.letsencrypt == "purge"): + removeAcmeConf(self, wo_domain) if not WOService.reload_service(self, 'nginx'): Log.error(self, "service nginx reload failed. " "check issues with `nginx -t` command") diff --git a/wo/cli/plugins/site_functions.py b/wo/cli/plugins/site_functions.py index dc9900d..b0bf70f 100644 --- a/wo/cli/plugins/site_functions.py +++ b/wo/cli/plugins/site_functions.py @@ -1307,11 +1307,19 @@ def removeAcmeConf(self, domain): "-d {0} --ecc" .format(domain)) except CommandExecutionError as e: - Log.error(self, "Cert removal failed") - WOFileUtils.remove(self, '/etc/letsencrypt/renewal/{0}_ecc' + Log.error(self, "Cert removal failed") + WOFileUtils.rm(self, '/etc/letsencrypt/renewal/{0}_ecc' .format(domain)) - WOFileUtils.remove(self, '/etc/letsencrypt/live/{0}' + WOFileUtils.rm(self, '/etc/letsencrypt/live/{0}' .format(domain)) + WOFileUtils.rm(self, '/var/www/{0}/conf/nginx/ssl.conf'.format(domain)) + WOFileUtils.rm(self, '/var/www/{0}/conf/nginx/ssl.conf.disabled' + .format(domain)) + WOFileUtils.rm( + self, '/etc/nginx/conf.d/force-ssl-{0}.conf'.format(domain)) + WOFileUtils.rm( + self, '/etc/nginx/conf.d/force-ssl-{0}.conf.disabled'.format(domain)) + WOGit.add(self, ["/etc/letsencrypt"], msg="Deleted {0} " .format(domain)) diff --git a/wo/cli/plugins/stack_upgrade.py b/wo/cli/plugins/stack_upgrade.py index c511880..6aac565 100644 --- a/wo/cli/plugins/stack_upgrade.py +++ b/wo/cli/plugins/stack_upgrade.py @@ -229,17 +229,17 @@ class WOStackUpgradeController(CementBaseController): if self.app.pargs.phpmyadmin: Log.info(self, "Upgrading phpMyAdmin, please wait...") - WOExtract.extract( - self, '/var/lib/wo/tmp/pma.tar.gz', '/var/lib/wo/tmp/') - shutil.copyfile('{0}22222/htdocs/db/pma' - '/config.inc.php' - .format(WOVariables.wo_webroot), - '/var/lib/wo/tmp/phpMyAdmin-{0}' - '-all-languages/config.inc.php' - .format(WOVariables.wo_phpmyadmin) + WOExtract.extract(self, '/var/lib/wo/tmp/pma.tar.gz', + '/var/lib/wo/tmp/') + shutil.copyfile(('{0}22222/htdocs/db/pma' + '/config.inc.php' + .format(WOVariables.wo_webroot)), + ('/var/lib/wo/tmp/phpMyAdmin-{0}' + '-all-languages/config.inc.php' + .format(WOVariables.wo_phpmyadmin)) ) - WOFileUtils.remove(self, '{0}22222/htdocs/db/pma' - .format(WOVariables.wo_webroot)) + WOFileUtils.rm(self, '{0}22222/htdocs/db/pma/' + .format(WOVariables.wo_webroot)) shutil.move('/var/lib/wo/tmp/phpMyAdmin-{0}' '-all-languages/' .format(WOVariables.wo_phpmyadmin),