don't continue if there's no vhost

This commit is contained in:
Noah Swartz 2016-01-28 16:48:12 -08:00
parent 5f50d698ee
commit b7c94bb297

View file

@ -865,6 +865,8 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
fp = vhost.filep
vh_p = self.aug.match("/files%s//* [label()=~regexp('%s')]" %
(fp, parser.case_i("VirtualHost")))
if not vh_p:
return
vh_path = vh_p[0]
if (self.parser.find_dir("ServerName", target_name, start=vh_path, exclude=False)
or self.parser.find_dir("ServerAlias", target_name, start=vh_path, exclude=False)):