Skip to content
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

apt_repository should update only the new repository #53670

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

@bugrasan
Copy link

@bugrasan bugrasan commented Mar 12, 2019

when adding new repository to apt (with apt_repository module), and set update_cache to true, the apt update should update just the new repo added instead all repos

822a7e1

SUMMARY

this will create a slight performance gain since apt cache update would not need to update all repository sources, especially while adding multiple sources.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

apt_repository module

ADDITIONAL INFORMATION

the question "apt-get update only for a specific repository" has been answered on askubuntu.com with following code sniplet:

update-repo() {
    for source in "$@"; do
        sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/${source}" \
        -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"    
    done
}

this is the same behaviour that python-apt bindings are using to update the cache in cache.update() function, however due to the following line with os.path.abspath

                apt_pkg.config.set("Dir::Etc::sourcelist",
                                   os.path.abspath(sources_list))

we need to provide the absolute path of the new repo file.

Therefore please review the code if there is a better way to add the absolute path and filename within ansible.

Additionally while removing a repository we don't need to update the apt sources cache again, apt seems to be intelligent enough to handle this properly.

…apt update should update just the new repo added instead all repos
@ansibot
Copy link
Contributor

@ansibot ansibot commented Mar 12, 2019

@bcoca
Copy link
Member

@bcoca bcoca commented Oct 9, 2020

This seems to have been accidentally missed by triage process (bot took 'ci_verified' label as human having triaged the issue, not just the CI failure).

This PR needs a rebase, changelog and tests ... and of course, to pass CI.

@aminvakil
Copy link
Contributor

@aminvakil aminvakil commented Oct 9, 2020

What if the current repos have not been updated for long and the newly added repo needs a current version of dependencies which is not present in the out-dated package list on the remote server?

I think updating only the currently added repo may create a problem, am I right?

@ansibot ansibot removed the stale_ci label Dec 5, 2020
@ansibot ansibot added the pre_azp label Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants