Skip to content

Commit c6eb8de

Browse files
committed
raise exception in yield_vhost
1 parent 8769966 commit c6eb8de

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

bin/a2certbot

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ from a2conf import Node, VhostNotFound
1818
log = None
1919

2020

21-
2221
class FatalError(Exception):
2322
pass
2423

@@ -225,8 +224,8 @@ def yield_vhost(domain, apacheconf=None, root=None):
225224
if domain.lower() in map(str.lower, alias.args.split(' ')):
226225
# return vhost
227226
yield vhost
228-
229-
return None
227+
raise VhostNotFound('Not found vhost {}'.format(domain))
228+
# return None
230229

231230
def process_file(leconf_path, local_ip_list, args, leconf=None):
232231

@@ -559,7 +558,11 @@ def main():
559558
pemfile = args.recreate
560559
print("recreate", pemfile)
561560
names = get_altnames(pemfile)
562-
webroot = args.webroot or get_webroot(names[0], args.apacheconf)
561+
try:
562+
webroot = args.webroot or get_webroot(names[0], args.apacheconf)
563+
except VhostNotFound as e:
564+
print(e)
565+
sys.exit(1)
563566
print(f"cert for {names} webroot {webroot}")
564567
mkcert(webroot, names)
565568

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def read(fname):
99

1010
setup(
1111
name='a2utils',
12-
version='0.0.29',
12+
version='0.0.30',
1313
scripts=[
1414
'bin/a2conf',
1515
'bin/a2okerr',

0 commit comments

Comments
 (0)