-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support setting path with global config. Using the priority order in h…
- Loading branch information
1 parent
8250776
commit e3aab54
Showing
5 changed files
with
57 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
version: '1.0' | ||
backend: docker | ||
|
||
docker: | ||
directory_map: | ||
/data/: /var/lib/docker/volumes/aplus_data/_data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from pathlib import PurePosixPath | ||
|
||
|
||
def get_host_path(original, mapping): | ||
ret = original | ||
orig_path = PurePosixPath(original) | ||
for k, v in mapping.items(): | ||
print(k, v) | ||
try: | ||
relative_path = orig_path.relative_to(k) | ||
ret = PurePosixPath(v).joinpath(relative_path) | ||
print("Get new path:", ret) | ||
return str(ret) | ||
except ValueError: | ||
pass | ||
return str(ret) |