mirror of
https://github.com/certbot/certbot.git
synced 2026-05-28 04:34:11 -04:00
Add certbot.hooks.list_hooks
This commit is contained in:
parent
f312e073d4
commit
eecbc2d35b
1 changed files with 12 additions and 0 deletions
|
|
@ -151,3 +151,15 @@ def execute(shell_cmd):
|
|||
logger.error('Error output from %s:\n%s', base_cmd, err)
|
||||
return (err, out)
|
||||
|
||||
|
||||
def list_hooks(dir_path):
|
||||
"""List paths to all hooks found in dir_path in sorted order.
|
||||
|
||||
:param str dir_path: directory to search
|
||||
|
||||
:returns: `list` of `str`
|
||||
:rtype: sorted list of absolute paths to executables in dir_path
|
||||
|
||||
"""
|
||||
paths = (os.path.join(dir_path, f) for f in os.listdir(dir_path))
|
||||
return sorted(path for path in paths if util.is_exe(path))
|
||||
|
|
|
|||
Loading…
Reference in a new issue