def _needs_install(name, path=None):
    ret = 0
    has_minion = retcode(name,
                         'which salt-minion',
                         path=path,
                         ignore_retcode=True)
    # we assume that installing is when no minion is running
    # but testing the executable presence is not enougth for custom
    # installs where the bootstrap can do much more than installing
    # the bare salt binaries.
    if has_minion:
        processes = run_stdout(name, "ps aux", path=path)
        if 'salt-minion' not in processes:
            ret = 1
        else:
            retcode(name, 'salt-call --local service.stop salt-minion')
    else:
        ret = 1
    return ret
dataset/ETHPy150Open saltstack/salt/salt/modules/lxc.py/_needs_install/original