mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-28 03:00:23 -07:00
Use get_bin_path
properly
This commit is contained in:
parent
a092eadbbb
commit
d52f1d969b
1 changed files with 3 additions and 15 deletions
|
@ -19,17 +19,8 @@
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#
|
#
|
||||||
|
|
||||||
def _find_supervisorctl():
|
def _is_present(name, supervisorctl):
|
||||||
paths = ['/usr/local/bin', '/usr/bin']
|
rc, out, err = _run('%s status' % supervisorctl)
|
||||||
|
|
||||||
for p in paths:
|
|
||||||
e = p + '/supervisorctl'
|
|
||||||
if os.path.exists(e):
|
|
||||||
return e
|
|
||||||
|
|
||||||
|
|
||||||
def _is_present(name):
|
|
||||||
rc, out, err = _run('%s status' % _find_supervisorctl())
|
|
||||||
return name in out
|
return name in out
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,10 +50,7 @@ def main():
|
||||||
|
|
||||||
SUPERVISORCTL = module.get_bin_path('supervisorctl', True)
|
SUPERVISORCTL = module.get_bin_path('supervisorctl', True)
|
||||||
|
|
||||||
if SUPERVISORCTL is None:
|
present = _is_present(name, SUPERVISORCTL)
|
||||||
module.fail_json(msg='supervisorctl is not installed')
|
|
||||||
|
|
||||||
present = _is_present(name)
|
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
if not present:
|
if not present:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue