-
Notifications
You must be signed in to change notification settings - Fork 19
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
Update installer.py #19
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
|
@@ -926,10 +926,28 @@ def _setup_install_repo(self): | |
def _install_additional_rpms(self): | ||
rpms_path = self.install_config.get('additional_rpms_path', None) | ||
|
||
if not rpms_path or not os.path.exists(rpms_path): | ||
rpm_dir = [] | ||
if not rpms_path or len(rpm_dir) == 0: | ||
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. Have you tested this @spyroot ? AFAIK 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.
Short answer : ) Two cases. Consider during a boot, you really need to figure out where to look for RPMs. For example, you have the latest version for rpm without collision with the main RPM inside ISO in packages_rt_expanded.
/mnt/media So if this name changes, you need to change all customization. https://github.com/spyroot/photon_rt/blob/main/post.sh
https://packages.vmware.com/photon/5.0/photon_updates_5.0_x86_64/
If you keep a flat structure, you can technically put RPM that will collide.
|
||
return | ||
|
||
if self.cmd.run(['rpm', '--root', self.photon_root, '-U', rpms_path + '/*.rpm']) != 0: | ||
if isinstance(rpms_path, list): | ||
rpm_dir = [d for d in rpm_dir if len(d) > 0 | ||
and os.path.exists(d)] | ||
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. Don't check for len(d) > 0, if user provides invalid rpm paths, it should be caught. Throw exception if path doesn't exist 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. So I specifically did this because there is an issue with how cmd returns the exit code. The exit code that we use is not a sufficient condition. I did a separate patch for that. Could you please also check I did a separate commit specifically for run
So if an exception is raised, that retval is 0. That way, the logical step considers this as the best-effort operation. Because you can debug and fix any issue if we don't crash, So the command run can interleave with the parent PID, then we have a concurrency issue. i.e This subprocess call might be executed before CDROM is mounted, and we don't read from stderr. 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. We should throw an error if the path does not exist. Better yet, check if the directory contains any rpm files. 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. So in this patch, I indicate what the issue is closely related. The problem is that sub-process might not report the exit code. Since we don't read from stderr and parse. Another issue sub-process might If you check the exit code from the rpm tool, you will see it returns different exit codes Suppose RPM in additional rpm has conflict, i.e., ver. > Then, in the RPM in actual ISO, For example, if generated in the script additional rpms, you always Since we invoke rpm with a list if one rpm in that list is wrong based And because it is a sub-process, debugging is tough for someone who wrote Kickstart. Essentially it boils down. Do you want a crash installer or not? If we want to crash, That way, using the best-effort strategy here, IMHO better. so a person will be able to install OS |
||
else: | ||
if os.path.exists(rpms_path): | ||
rpm_dir.append(rpm_dir) | ||
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. I think you meant to do 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. Yes, So old behavior should work so it won't break old kick-start files., i.e if it is just a single value or if it lists, we check one by one as best effort. i.e., if you wrote kick start and have no clue where CDROM mounted /mnt/cdrom / mnt/media etc. so you can add a bunch of dir. |
||
else: | ||
return | ||
|
||
cmd_err = 0 | ||
for rdir in rpm_dir: | ||
try: | ||
# best effort for each dir in list | ||
cmd_err = self.cmd.run(['rpm', '--root', self.photon_root, '-U', rdir + '/*.rpm']) | ||
except FileNotFoundError as _: | ||
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. Same here, don't ignore erroneous situations. Small optimization here can be, passing all rpm dirs at once to
An rpm in path1 might need an rpm from path2 as a requirement, so it will get satisfied. 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. Actually we should use 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. We wouldn't need this if we had checked for rpm files above. |
||
pass | ||
|
||
if cmd_err > 0: | ||
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. This needs to be within the loop above or we'd only see if the last iteration failed. |
||
self.logger.info('Failed to install additional_rpms from ' + rpms_path) | ||
self.exit_gracefully() | ||
|
||
|
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.
Nit: please rename to
rpms_dir
.