Don't require pycurl in apt_repository when it's not actually needed

This commit is contained in:
Lukáš Lalinský 2014-02-22 15:33:54 +01:00
parent 505fde72b0
commit a71cabdb50

View file

@ -28,9 +28,10 @@ short_description: Add and remove APT repositores
description: description:
- Add or remove an APT repositories in Ubuntu and Debian. - Add or remove an APT repositories in Ubuntu and Debian.
notes: notes:
- This module works on Debian and Ubuntu and requires C(python-apt) and C(python-pycurl) packages. - This module works on Debian and Ubuntu and requires C(python-apt).
- This module supports Debian Squeeze (version 6) as well as its successors. - This module supports Debian Squeeze (version 6) as well as its successors.
- This module treats Debian and Ubuntu distributions separately. So PPA could be installed only on Ubuntu machines. - This module treats Debian and Ubuntu distributions separately. So PPA could be installed only on Ubuntu machines.
Adding PPA repositories requires C(python-pycurl).
options: options:
repo: repo:
required: true required: true
@ -273,6 +274,8 @@ class UbuntuSourcesList(SourcesList):
def _get_ppa_info(self, owner_name, ppa_name): def _get_ppa_info(self, owner_name, ppa_name):
# we can not use urllib2 here as it does not do cert verification # we can not use urllib2 here as it does not do cert verification
if not HAVE_PYCURL:
module.fail_json(msg='Could not import python modules: pycurl. Please install python-pycurl package.')
lp_api = self.LP_API % (owner_name, ppa_name) lp_api = self.LP_API % (owner_name, ppa_name)
return self._get_ppa_info_curl(lp_api) return self._get_ppa_info_curl(lp_api)
@ -343,9 +346,6 @@ def main():
if not HAVE_PYTHON_APT: if not HAVE_PYTHON_APT:
module.fail_json(msg='Could not import python modules: apt_pkg. Please install python-apt package.') module.fail_json(msg='Could not import python modules: apt_pkg. Please install python-apt package.')
if not HAVE_PYCURL:
module.fail_json(msg='Could not import python modules: pycurl. Please install python-pycurl package.')
repo = module.params['repo'] repo = module.params['repo']
state = module.params['state'] state = module.params['state']
update_cache = module.params['update_cache'] update_cache = module.params['update_cache']