-
Notifications
You must be signed in to change notification settings - Fork 13
Fix for dmidecode + support mounting filepaths in docker #344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
48f74d5
9af8083
6b73726
abf53b6
845b141
5e9f7e4
5fb35f3
8a5111f
3b730f8
76c3353
2595369
799500e
6b7c7e1
0e83b5c
7e127ac
094657f
a288fe7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,8 +218,7 @@ def update_container_paths(path, mounts=None, force_target_path=''): | |
if not path: | ||
return '', '' # Return empty paths if no path is provided. | ||
|
||
# Normalize and resolve the absolute path. | ||
host_path = os.path.abspath(path) | ||
host_path = path | ||
container_path = host_path # Default to the same path for containers. | ||
|
||
# Handle Windows-specific path conversion for Docker. | ||
|
@@ -392,7 +391,7 @@ def get_docker_default(key): | |
|
||
def get_host_path(value): | ||
# convert relative path to absolute path | ||
value = convert_to_abs_path(value) | ||
value = os.path.dirname(convert_to_abs_path(value)) | ||
|
||
path_split = value.split(os.sep) | ||
|
||
|
@@ -419,6 +418,7 @@ def get_container_path_script(i): | |
|
||
def get_container_path(value, username="mlcuser"): | ||
# convert relative path to absolute path | ||
# if we are trying to mount a file, mount the parent folder. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why change here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. relative path was already been converted to absolute path here. But I guess that should be done in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in commit 5e9f7e4 |
||
value = convert_to_abs_path(value) | ||
|
||
path_split = value.split(os.sep) | ||
|
@@ -434,4 +434,4 @@ def get_container_path(value, username="mlcuser"): | |
return "/".join(new_path_split1), "/".join(new_path_split2) | ||
else: | ||
orig_path, target_path = update_container_paths(path=value) | ||
return target_path, target_path | ||
return os.path.dirname(target_path), target_path |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ | |
if [[ ${MLC_SUDO_USER} == "yes" ]]; then | ||
${MLC_SUDO} dmidecode -t memory > ${MLC_MEMINFO_FILE} | ||
fi | ||
test $? -eq 0 || return $? | ||
test $? -eq 0 || echo "Warning: Memory info is not recorded" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dmidecode exits with error no device error. Maybe due to permission error with dmidecode inside docker containers. Would it be okay if we just print warnings instead of exiting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if it's a folder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.path.dirname
does not change the value if folder is directly supplied.sample output:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's only if / is at the end right? I think we should explicitly check for a file here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is correct, to be safe, commit 5fb35f3 uses
pathlib
library to process the paths