apt_repository strikes back

Hi!

I’ve just made the second PR against apt_repository. It has the same features as before, but now it has no additional dependences completely.
Please feel free to grab it from my github repo at https://github.com/sashka/ansible or from PR itself: https://github.com/ansible/ansible/pull/3630

Let me know if it fails.

One note: I make no assumption on URL handling, so url with trailing slash and w/o trailing slash are treated as different URL.

Alexander.

For those that do not remember this, I believe this no longer auto-adds deb-src URLs and works on more distributions.

Testing from Debian/Ubuntu users (and comments on the ticket) are much appreciated!

Thanks Alexander!

❦ Alexander Saltanov <alexander.saltanov@gmail.com>:

I've just made the second PR against apt_repository. It has the same
features as before, but now it has no additional dependences completely.

Did not try it for now, but if I read the code correctly I wonder if it is
a drop in replacement?

As far as I can see for every apt_repository a own file in sources.list.d is
created. If I added a repository with the current version it lands in
sources.list. Is this considered? Does removing them from sources.list work
with your solution?

Yes, it works as drop-in replacement. It reads source specs from any valid source file (sources.list and sources.list.d/*)

Only new sources (if it had never existed in sources.list) will be created in sources.list.d.

Maybe it would make sense to have an option to switch the behavior, but I'd rather go with one way.

I prefer sources.list.d as better maintainable way, but may be you know more contras than pros. Please let me know.

A.

❦ Michael DeHaan <michael@ansibleworks.com>:

Testing from Debian/Ubuntu users (and comments on the ticket) are much
appreciated!

I finally found some time to test the apt_repository. I am very satisfied to
not have to install another package (python-software-properties) to manage my
apt configuration.

I did not find a problem. I tested adding and removing. I use it like this:

- name: Common | Setup empty sources.list
  template: src=sources.list.j2 dest=/etc/apt/sources.list
  tags: common

- name: Common | Add security repository
  apt_repository: repo='deb http://security.debian.org/ wheezy/updates main contrib non-free'
  tags: common

I'll add a comment to the pull request ticket.

Thanks. I'll look into issue tomorrow morning CEST.

A.