mirror of
https://github.com/ZettaIO/restic-compose-backup.git
synced 2026-11-17 18:35:40 +00:00
utils.strip_root
This commit is contained in:
1 parent
a61452fd91
commit
ef4ce2ecb4
1 file changed
+12
@@ -24,3 +24,15 @@ def is_true(value):
|
||||
Evaluates the truthfullness of a bool value in container labels
|
||||
"""
|
||||
return value in TRUE_VALUES
|
||||
|
||||
|
||||
def strip_root(path):
|
||||
"""
|
||||
Removes the root slash in a path.
|
||||
Example: /srv/data becomes srv/data
|
||||
"""
|
||||
path = path.strip()
|
||||
if path.startswith('/'):
|
||||
return path[1:]
|
||||
|
||||
return path
|
||||
Reference in new issue
Block a user