Unverified Commit fc67fb4c authored by Valters Jansons's avatar Valters Jansons
Browse files

aptsources: Allow non-existent `source.list` file

Apt itself allows for the `sources.list` file to not exist,
and so should aptsources.

For example, the `puppetlabs/apt` Puppet module changed its
purging behavior for `sources.list` file to simply delete
the file instead of leaving a file with a comment as it
previously did. As a result, everyone enforcing source entry
purging via the Puppet module as a result receives an unnecessary
warning when this Python module is used prior to this change.
parent 49e05ae2
......@@ -280,7 +280,8 @@ class SourcesList(object):
self.list = []
# read sources.list
file = apt_pkg.config.find_file("Dir::Etc::sourcelist")
if os.path.exists(file):
# read sources.list.d
partsdir = apt_pkg.config.find_dir("Dir::Etc::sourceparts")
for file in glob.glob("%s/*.list" % partsdir):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment