mirror of
https://github.com/certbot/certbot.git
synced 2026-06-03 13:59:02 -04:00
escape and unescape augeas
This commit is contained in:
parent
50d900718b
commit
07fb5dd9cc
1 changed files with 9 additions and 4 deletions
|
|
@ -514,7 +514,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||
try:
|
||||
args = self.aug.match(path + "/arg")
|
||||
except RuntimeError:
|
||||
logger.warn("It looks like one of your paths has a character that your version of augeas can't parse")
|
||||
logger.warn("Encountered a problem while parsing file: %s, skipping", path)
|
||||
return None
|
||||
for arg in args:
|
||||
addrs.add(obj.Addr.fromstring(self.parser.get_arg(arg)))
|
||||
|
|
@ -529,7 +529,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||
if addr.get_port() == "443":
|
||||
is_ssl = True
|
||||
|
||||
filename = get_file_path(path)
|
||||
filename = _unescape(get_file_path(path))
|
||||
if self.conf("handle-sites"):
|
||||
is_enabled = self.is_site_enabled(filename)
|
||||
else:
|
||||
|
|
@ -727,7 +727,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||
|
||||
"""
|
||||
avail_fp = nonssl_vhost.filep
|
||||
ssl_fp = self._get_ssl_vhost_path(avail_fp)
|
||||
ssl_fp = _escape(self._get_ssl_vhost_path(avail_fp))
|
||||
|
||||
self._copy_create_ssl_vhost_skeleton(avail_fp, ssl_fp)
|
||||
|
||||
|
|
@ -901,7 +901,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||
self.parser.add_dir(vh_path, "Include", self.mod_ssl_conf)
|
||||
|
||||
def _add_servername_alias(self, target_name, vhost):
|
||||
fp = vhost.filep
|
||||
fp = _escape(vhost.filep)
|
||||
vh_p = self.aug.match("/files%s//* [label()=~regexp('%s')]" %
|
||||
(fp, parser.case_i("VirtualHost")))
|
||||
if not vh_p:
|
||||
|
|
@ -953,6 +953,11 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||
|
||||
if need_to_save:
|
||||
self.save()
|
||||
def _unescape(fp):
|
||||
return fp.replace("\\", "")
|
||||
|
||||
def _escape(fp):
|
||||
return fp.replace(",", "\\,")
|
||||
|
||||
######################################################################
|
||||
# Enhancements
|
||||
|
|
|
|||
Loading…
Reference in a new issue