-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
opkg - _package_in_desired_state
does not handle properly opkg list_installed
output
#8706
Comments
community.general.opkg
- _package_in_desired_state
does not handle properly opkg list_installed
community.general.opkg
- _package_in_desired_state
does not handle properly opkg list_installed
output
Files identified in the description: If these files are incorrect, please update the |
The condition has_package = out.startswith(name + " - %s" % ("" if not version else version)) is not correct either, since it thinks I would probably adjust the code to split into lines, and check whether the first line starts with CC @joergho who implemented version support in #5688 and might have some insight here as well... |
Thans for reporting the bug @akire0ne and for the analysis @felixfontein If the Yocto version of opkg is used, the following code is executed in the end: print_pkg. This means that depending of the configuration, the output can be any of the following:
I'd therefore suggest to split the string by
I have done minimal testing in Python console but not yet using the whole ansible stack. |
If you simply split by How about using
instead of |
Yes, this would work! |
community.general.opkg
- _package_in_desired_state
does not handle properly opkg list_installed
output_package_in_desired_state
does not handle properly opkg list_installed
output
Summary
Tried to integrate
community.general.opkg
for the first time in our ansible stack. We have some embedded devices that usesopkg
for package management. My task is very trivial.This results in
The package is installed on the remote host
After installing the package, the modules runs the above command to confirm that it has been installed properly. This part is broken. After diging a bit, the culprit is that function:
community.general/plugins/modules/opkg.py
Lines 177 to 181 in fd811df
In my case:
out="vim - 9.0.1211-r0\n"
So when it executeshas_package = out.startswith(name + " - %s" % ("" if not version else (version + " ")))
- It will always returnFalse
, because there is no whitespace at the end of myout
. I am not sure what is the rationale behind this condition but it clearly does not fit theout
from my device. It seems like an unhandled scenario.I fixed locally by removing the extra whitespace after
version
in the condtion:I'm not sure if that approach is fine, I can't find history about that extra whitespace.
Issue Type
Bug Report
Component Name
community.general.opkg
Ansible Version
Community.general Version
Configuration
Too sensitive environment. sorry. I don't think it's helpful for that issue.
OS / Environment
Controller: Ubuntu 22.04 LTS
Target:
OS: PetaLinux 2023.1
kernel: Linux k26-lunx-tx 6.1.30-xilinx-v2023.1 #1 SMP Fri Jun 30 09:49:44 UTC 2023 aarch64 GNU/Linux
opkg: version 0.6.1 (libsolv 0.7.22)
Steps to Reproduce
I think the description is self explanatory. The target device that we use is rather exotic and unfortunatelly I think it might be difficult to reproduce.
Expected Results
The package should show as "installed" and the module should not error out because of unhandled
out
Actual Results
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: