diff options
| author | dd <dd@wx.tnyzeq.icu> | 2024-10-06 17:00:14 +0200 |
|---|---|---|
| committer | dd <dd@wx.tnyzeq.icu> | 2024-10-06 17:32:49 +0200 |
| commit | f8bb674857505c2ca5a360ad35ae7281da784b2f (patch) | |
| tree | 877737ba7f78a75ded3735480c444da16184400d /new/lib | |
| parent | b982c1877c29281b5679c6c070fb25b986cd758e (diff) | |
| download | vyos-jenkins-f8bb674857505c2ca5a360ad35ae7281da784b2f.tar.gz vyos-jenkins-f8bb674857505c2ca5a360ad35ae7281da784b2f.zip | |
added circinus image builder
Diffstat (limited to 'new/lib')
| -rw-r--r-- | new/lib/git.py | 4 | ||||
| -rw-r--r-- | new/lib/helpers.py | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/new/lib/git.py b/new/lib/git.py index dcf4281..119af46 100644 --- a/new/lib/git.py +++ b/new/lib/git.py @@ -40,8 +40,8 @@ class Git: if re.search(r"^[*]+$", pattern): return True # catch-all pattern - pattern: str = re.escape(pattern) # escape special characters - pattern = pattern.replace("\\*", "*") # undo escape of stars + pattern: str = re.escape(pattern) # escape special characters + pattern = pattern.replace("\\*", "*") # undo escape of stars # convert stars into regex patterns pattern = pattern.replace("**", ".*") diff --git a/new/lib/helpers.py b/new/lib/helpers.py index 1e17e39..2d84e1a 100644 --- a/new/lib/helpers.py +++ b/new/lib/helpers.py @@ -1,9 +1,20 @@ import logging import shlex +import shutil import subprocess import sys +def rmtree(directory): + try: + shutil.rmtree(directory) + except PermissionError: + logging.error( + "Unable to delete '%s' due to permissions." + " Please delete this directory yourself" + " with root privileges and then rerun again." % directory + ) + exit(1) def execute(command, passthrough=False, timeout=None, **kwargs): if passthrough: |
