mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Merge branch 'binpath' of https://github.com/sfromm/ansible into devel
Conflicts: library/supervisorctl
This commit is contained in:
@@ -19,20 +19,12 @@
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
def _find_supervisorctl():
|
||||
paths = ['/usr/local/bin', '/usr/bin']
|
||||
|
||||
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
|
||||
|
||||
def _is_running(name):
|
||||
rc, out, err = _run('%s status %s' % (_find_supervisorctl(), name))
|
||||
def _is_running(name, supervisorctl):
|
||||
rc, out, err = _run('%s status %s' % (supervisorctl, name))
|
||||
return 'RUNNING' in out
|
||||
|
||||
|
||||
@@ -55,7 +47,7 @@ def main():
|
||||
name = module.params['name']
|
||||
state = module.params['state']
|
||||
|
||||
SUPERVISORCTL = _find_supervisorctl()
|
||||
SUPERVISORCTL = module.get_bin_path('supervisorctl', True)
|
||||
|
||||
if SUPERVISORCTL is None:
|
||||
module.fail_json(msg='supervisorctl is not installed')
|
||||
@@ -74,7 +66,7 @@ def main():
|
||||
|
||||
module.exit_json(changed=False, name=name, state=state)
|
||||
|
||||
running = _is_running(name)
|
||||
running = _is_running(name, SUPERVISORCTL)
|
||||
|
||||
if running and state == 'started':
|
||||
module.exit_json(changed=False, name=name, state=state)
|
||||
|
||||
Reference in New Issue
Block a user