debops / ansible-apt

Configure and manage APT Package Manager
GNU General Public License v3.0
10 stars 15 forks source link

Role redesign #76

Closed drybjed closed 8 years ago

ypid commented 8 years ago

The role fails to deal with an entry in the original file like this one:

deb cdrom:[Debian GNU/Linux 8.3.0 _Jessie_ - Official amd64 CD Binary-1 20160123-19:04]/ jessie main

and writes the following invalid entries:

deb cdrom:[Debian jessie main
deb cdrom:[Debian jessie-updates main
deb cdrom:[Debian jessie-backports main

Yes, some people prefer to install from CD or ISO because ;)

ypid commented 8 years ago

Maybe the apt__original_sources should be absent by default? At least when people use DebOps extensively the original sources does not matter and the once configured by DebOps are a better fit. Like in my example above. I installed the test box from ISO and the just run DebOps against the host.

Hm, on the other hand apt__original_sources definitely comes in handy for all the VPS out there … Note sure what to do about that. Maybe the apt__original_sources enabled by default is not such a bad idea after all.

drybjed commented 8 years ago

About the cdrom source - yeah, you're right. Shame that this is not quoted in the sources.list, not sure how to handle that. I guess for starters the Python script could only include some valid entries that include ^http\:\/\/, ^https\:\/\/, perhaps some others. I'll start with that.

ypid commented 8 years ago

Seems the duplicate entry detection is a bit too greedy:

apt__default_mirror: '{{ ansible_local.apt.default_mirrors
                         if (ansible_local|d() and ansible_local.apt|d() and
                             ansible_local.apt.default_mirrors|d())
                         else "http://httpredir.debian.org/debian" }}'
apt__original_sources: []
apt__group_sources:
  - comment: 'Additional Debian repositories'
    uri: '{{ apt__default_mirror }}'
    suites:
      - 'stretch'
      - 'sid'
    component:
      - 'main'
      - 'contrib'
      - 'non-free'

results in the entries from apt__default_sources missing.

drybjed commented 8 years ago

The duplicate entries seem to not create a fatal error, but you still get messages like this:

W: Duplicate sources.list entry http://httpredir.debian.org/debian/ stable/main amd64 Packages (/var/lib/apt/lists/httpredir.debian.org_debian_dists_stable_main_binary-amd64_Packages)
W: You may want to run apt-get update to correct these problems

And these will show up in the mails sent daily from cron due to the /etc/cron.d/apt script getting these warnings and outputting them. I don't want to suddently have every host generate tons of e-mails every day.

I think that a note in the docs about duplicate entries being commented out should be enough. The user configuration via Ansible inventory should override the defaults.

ypid commented 8 years ago

Hm, the thing is not that there are duplicate entries in my file but that entries for apt__default_sources are missing:

# This file is managed by Ansible, all changes will be lost.

# Additional Debian repositories
deb http://httpredir.debian.org/debian stretch main contrib non-free
deb http://httpredir.debian.org/debian sid main contrib non-free

# Official Debian repositories
# deb http://httpredir.debian.org/debian jessie main
# deb http://httpredir.debian.org/debian jessie-updates main
# deb http://httpredir.debian.org/debian jessie-backports main

# Debian Security repository
deb http://security.debian.org/ jessie/updates main

Can you reproduce this using the above inventory variables?

drybjed commented 8 years ago

@ypid Your config results in the same file on my system.

BTW, "Official Debian repositories" is what would be generated from the apt__default_sources. They are just commented out for the reason stated above - duplicate entries generate cron emails which I want to avoid.