fix: i still have no idea how python modules work

This commit is contained in:
ptrcnull 2024-03-16 07:28:36 +01:00
parent acf0019a38
commit d6c80b4015
Signed by: ptrcnull
GPG key ID: 411F7B30801DD9CA
3 changed files with 5 additions and 4 deletions

2
hook_launcher.py Executable file
View file

@ -0,0 +1,2 @@
from nyacme.hook import main
main()

4
nyacme/__main__.py Executable file → Normal file
View file

@ -1,4 +1,3 @@
#!/usr/bin/env python3
import argparse import argparse
import os.path import os.path
import subprocess import subprocess
@ -48,7 +47,8 @@ def main() -> None:
hook_path = shutil.which('nyacme-hook') hook_path = shutil.which('nyacme-hook')
if not hook_path: if not hook_path:
hook_path = os.path.join(os.path.dirname(__file__), 'hook.py') log.warning('setting hook path to hook launcher from git repo')
hook_path = os.path.join(os.path.dirname(__file__), '..', 'hook_launcher.py')
res = subprocess.run([ res = subprocess.run([
'uacme', '-v', 'uacme', '-v',

3
nyacme/hook.py Executable file → Normal file
View file

@ -1,4 +1,3 @@
#!/usr/bin/env python3
import argparse import argparse
import logging import logging
from itertools import chain from itertools import chain
@ -37,7 +36,7 @@ def main() -> None:
short_record_name = record_name.replace('.' + zone_name, '') short_record_name = record_name.replace('.' + zone_name, '')
handler_name = config.get_handler(zone_name) handler_name = config.get_handler(zone_name)
handler = handlers[handler_name](zone_name, config, token) handler = handlers[handler_name](zone_name, config, args.token)
if args.method == 'begin': if args.method == 'begin':
handler.create(short_record_name, args.auth) handler.create(short_record_name, args.auth)