Migrate remaining modules to use get_bin_path in module_common.py

* Migraed easy_install, pip, service, setup, and user.
* Updated fail_json message in apt_repository
* Fixed easy_install to not hardcode location of virtualenv in
  /usr/local/bin/.
* Made handling of virtualenv more consistent between easy_install and
  pip.
This commit is contained in:
Stephen Fromm
2012-08-29 20:26:22 -07:00
parent 4e7b67a45a
commit e5a635672c
6 changed files with 24 additions and 63 deletions

View File

@@ -436,7 +436,9 @@ class LinuxNetwork(Network):
Network.__init__(self)
def populate(self):
ip_path = self.get_ip_path()
ip_path = module.get_bin_path('ip')
if ip_path is None:
return self.facts
default_ipv4, default_ipv6 = self.get_default_interfaces(ip_path)
interfaces, ips = self.get_interfaces_info(ip_path, default_ipv4, default_ipv6)
self.facts['interfaces'] = interfaces.keys()
@@ -448,15 +450,6 @@ class LinuxNetwork(Network):
self.facts['all_ipv6_addresses'] = ips['all_ipv6_addresses']
return self.facts
def get_ip_path(self):
paths = ['/sbin/ip', '/usr/sbin/ip']
ip_path = None
for path in paths:
if os.path.exists(path):
ip_path = path
break
return ip_path
def get_default_interfaces(self, ip_path):
# Use the commands:
# ip -4 route get 8.8.8.8 -> Google public DNS
@@ -730,6 +723,7 @@ def run_setup(module):
return setup_result
def main():
global module
module = AnsibleModule(
argument_spec = dict()
)