Simplify distribution test

If it's Ubuntu, use UbuntuSourcesList; if it's any other apt-friendly
distribution, use SourcesList; otherwise, fail.
This commit is contained in:
Abhijit Menon-Sen 2015-07-30 13:16:11 +05:30 committed by Matt Clay
parent ca50b5c5e0
commit 9b496818cf

View file

@ -438,7 +438,7 @@ def main():
if isinstance(distro, aptsources_distro.UbuntuDistribution): if isinstance(distro, aptsources_distro.UbuntuDistribution):
sourceslist = UbuntuSourcesList(module, sourceslist = UbuntuSourcesList(module,
add_ppa_signing_keys_callback=get_add_ppa_signing_key_callback(module)) add_ppa_signing_keys_callback=get_add_ppa_signing_key_callback(module))
elif isinstance(distro, aptsources_distro.DebianDistribution) or isinstance(distro, aptsources_distro.Distribution): elif isinstance(distro, aptsources_distro.Distribution):
sourceslist = SourcesList(module) sourceslist = SourcesList(module)
else: else:
module.fail_json(msg='Module apt_repository supports only Debian and Ubuntu.') module.fail_json(msg='Module apt_repository supports only Debian and Ubuntu.')