apt: api fail issue when pkg pinned with high priority#85174
apt: api fail issue when pkg pinned with high priority#85174rohit-bharmal wants to merge 7 commits into
Conversation
|
@rohit-bharmal Tests are failing due to this change. Can you please check the reason for the failure? Thanks. |
|
@Akasurde FYI when you know that the CI is failing due to the PR patch, feel free to apply |
|
@rohit-bharmal Thanks for the update. Could you please add a test, something like this? |
@Akasurde Will the same test work here as well? I believe it was added for the same priority-related functionality. Right? |
Yes, you need to set the priority to something higher than 1001 and then try installing package using |
What if I do change in the same script to update the priority to 1002? like below:
|
|
@Akasurde I have added a test there! |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| - name: Pin foo=1.0.0 | ||
| copy: | ||
| content: |- | ||
| Package: foo | ||
| Pin: version 1.0.0 | ||
| Pin-Priority: 1002 | ||
| dest: /etc/apt/preferences.d/foo | ||
|
|
There was a problem hiding this comment.
Shouldn't this be done by modifying the previous task (which also copies data to the same destination file) instead?
SUMMARY
Fixes a bug in the
aptmodule where installing a specific version of a package (likemypkg=1.2.3) fails if other versions are pinned with a higher APT priority (>1001).Ansible was using APT's default candidate selection, which can ignore the version the user asked for. This update changes the logic to directly look for the requested version in the package cache, similar to how
apt-get install pkg=versionworks.This makes sure the correct version is installed if it exists, even if pinning would normally prevent it.
Fixes #85147
ISSUE TYPE