mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 08:03:10 +02:00
Added None check and according test
This commit is contained in:
@@ -538,6 +538,9 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||||||
is_ssl = True
|
is_ssl = True
|
||||||
|
|
||||||
filename = get_file_path(self.aug.get("/augeas/files%s/path" % get_file_path(path)))
|
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"):
|
if self.conf("handle-sites"):
|
||||||
is_enabled = self.is_site_enabled(filename)
|
is_enabled = self.is_site_enabled(filename)
|
||||||
else:
|
else:
|
||||||
@@ -1802,7 +1805,10 @@ def get_file_path(vhost_path):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
# Strip off /files/
|
# Strip off /files/
|
||||||
|
try:
|
||||||
avail_fp = vhost_path[7:].split("/")
|
avail_fp = vhost_path[7:].split("/")
|
||||||
|
except TypeError:
|
||||||
|
return None
|
||||||
last_good = ""
|
last_good = ""
|
||||||
# Loop through the path parts and validate after every addition
|
# Loop through the path parts and validate after every addition
|
||||||
for p in avail_fp:
|
for p in avail_fp:
|
||||||
|
|||||||
@@ -125,6 +125,10 @@ class MultipleVhostsTest(util.ApacheTest):
|
|||||||
self.assertTrue("google.com" in names)
|
self.assertTrue("google.com" in names)
|
||||||
self.assertTrue("certbot.demo" 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):
|
def test_bad_servername_alias(self):
|
||||||
ssl_vh1 = obj.VirtualHost(
|
ssl_vh1 = obj.VirtualHost(
|
||||||
"fp1", "ap1", set([obj.Addr(("*", "443"))]),
|
"fp1", "ap1", set([obj.Addr(("*", "443"))]),
|
||||||
|
|||||||
Reference in New Issue
Block a user