Skip to content

Commit eb4f550

Browse files
committed
print nice error message if virtualhost not found
1 parent e70cd26 commit eb4f550

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

bin/a2certbot

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,13 @@ def main():
444444

445445
print("Create cert for {}".format(name))
446446
aliases = get_aliases(args.domain, args.apacheconf) if args.aliases else list()
447-
webroot = get_webroot(name, args.apacheconf)
447+
448+
try:
449+
webroot = get_webroot(name, args.apacheconf)
450+
except StopIteration as e:
451+
print("Cannot find webroot for {} (starting from {}). Maybe site is not yet created/enabled?".format(
452+
name, args.apacheconf))
453+
return
448454

449455
# remove main name from aliases
450456
if name in aliases:

bin/a2vhost

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ def make_both(apacheconfig, config, domainlist, webroot, auto):
9696
cmd.append('-d')
9797
cmd.append(domain)
9898

99-
print(" {}".format(cmd))
10099
cp = subprocess.run(cmd)
101100
assert(cp.returncode == 0)
102101

@@ -151,6 +150,8 @@ def make_basic(apacheconfig, config, domainlist, webroot, auto):
151150
else:
152151
root = Node()
153152

153+
# TODO: add comment before VirtualHost
154+
154155
new_vhost=Node(raw='<VirtualHost *:80>')
155156
new_vhost.insert('ServerName {}'.format(domainlist[0]))
156157
if len(domainlist) > 1:

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.6',
12+
version='0.0.7',
1313
scripts=[
1414
'bin/a2conf',
1515
'bin/a2okerr',

0 commit comments

Comments
 (0)