dnf
dnf copied to clipboard
Add detection for ostree-based systems and warn users about losing changes
On ostree-based systems, users can use dnf to customize the environment but those changes will be lost at the next ostree-based image update. If you want to retain changes between ostree-updates you need to make use of rpm-ostree right now.
All this patch does is add a function to detect systems managed this way and present warnings before dnf operations that modify the system. I display the warning at the beginning of the output, but maybe that should be after any other output is on the display.
I have two proposals regarding the code I've reviewed.
Firstly, as you suggested, I'd go with displaying the warning text to the user during the transaction confirmation, which involves moving the logic before this specific line. This approach eliminates the need to handle individual commands, as it addresses any transactional operation.
Secondly, in util.py, I'd retain only the logic related to detecting container presence. After confirming that is_container returns True, we can relocate the logging of the ostree message to the previously mentioned location. What do you think about that?
I have two proposals regarding the code I've reviewed.
Firstly, as you suggested, I'd go with displaying the warning text to the user during the transaction confirmation, which involves moving the logic before this specific line. This approach eliminates the need to handle individual commands, as it addresses any transactional operation.
Secondly, in
util.py, I'd retain only the logic related to detecting container presence. After confirming thatis_containerreturnsTrue, we can relocate the logging of the ostree message to the previously mentioned location. What do you think about that?
I like these suggestions, thanks! I will get the PR updated. I've also got an additional method for reliably detecting an ostree system, so I'm going to try to rework is_container() a bit too.
LGTM, thanks!
xref https://issues.redhat.com/browse/SWM-1313 related to this
This should test for /run/ostree-booted instead and only that. bootc or rpm-ostree being installed on the system does not mean that we are using a Image Based system.