mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-08 14:20:04 -07:00
Migrate apt_repository, group, and supervisorctl to use module.get_bin_path
This commit is contained in:
parent
4c62e495eb
commit
bdb39058ae
3 changed files with 12 additions and 18 deletions
|
@ -21,12 +21,11 @@
|
|||
import grp
|
||||
|
||||
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 group_del(module, group):
|
||||
cmd = [get_bin_path(module, 'groupdel'), group]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue