mirror of
https://github.com/certbot/certbot.git
synced 2026-06-03 22:08:07 -04:00
Added None check and according test
This commit is contained in:
parent
c29e8c3332
commit
f4948855f0
2 changed files with 11 additions and 1 deletions
|
|
@ -538,6 +538,9 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||
is_ssl = True
|
||||
|
||||
filename = get_file_path(self.aug.get("/augeas/files%s/path" % get_file_path(path)))
|
||||
if filename is None:
|
||||
return None
|
||||
|
||||
if self.conf("handle-sites"):
|
||||
is_enabled = self.is_site_enabled(filename)
|
||||
else:
|
||||
|
|
@ -1802,7 +1805,10 @@ def get_file_path(vhost_path):
|
|||
|
||||
"""
|
||||
# Strip off /files/
|
||||
avail_fp = vhost_path[7:].split("/")
|
||||
try:
|
||||
avail_fp = vhost_path[7:].split("/")
|
||||
except TypeError:
|
||||
return None
|
||||
last_good = ""
|
||||
# Loop through the path parts and validate after every addition
|
||||
for p in avail_fp:
|
||||
|
|
|
|||
|
|
@ -125,6 +125,10 @@ class MultipleVhostsTest(util.ApacheTest):
|
|||
self.assertTrue("google.com" in names)
|
||||
self.assertTrue("certbot.demo" in names)
|
||||
|
||||
def test_get_bad_path(self):
|
||||
from certbot_apache.configurator import get_file_path
|
||||
self.assertEqual(get_file_path(None), None)
|
||||
|
||||
def test_bad_servername_alias(self):
|
||||
ssl_vh1 = obj.VirtualHost(
|
||||
"fp1", "ap1", set([obj.Addr(("*", "443"))]),
|
||||
|
|
|
|||
Loading…
Reference in a new issue