mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
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:
@@ -36,12 +36,11 @@ if os.path.exists('/etc/master.passwd'):
|
||||
# That is, this won't work on FreeBSD.
|
||||
|
||||
def get_bin_path(module, arg):
|
||||
if os.path.exists('/usr/sbin/%s' % arg):
|
||||
return '/usr/sbin/%s' % arg
|
||||
elif os.path.exists('/sbin/%s' % arg):
|
||||
return '/sbin/%s' % arg
|
||||
else:
|
||||
bin = module.get_bin_path(arg)
|
||||
if bin is None:
|
||||
module.fail_json(msg="Cannot find %s" % arg)
|
||||
else:
|
||||
return bin
|
||||
|
||||
def user_del(module, user, **kwargs):
|
||||
cmd = [get_bin_path(module, 'userdel')]
|
||||
|
||||
Reference in New Issue
Block a user