def get(self): ''' Inspect Hivy, docker, salt-master and serf states ''' log.info('request hivy status') docker_version, docker_status = utils.docker_check() return { 'state': { 'hivy': os.environ.get('HIVY_STATUS', True), 'sub-systems': { 'docker': docker_status, 'salt-master': 'not implemented', 'serf': utils.is_running('serf') } }, 'version': { 'hivy': { 'major': self.hivy_version.major, 'minor': self.hivy_version.minor, 'patch': self.hivy_version.patch }, 'docker': docker_version, 'serf': self.serf.version(), #'salt': str(self.salt('--version')) 'salt': 'not implemented' } }
def __init__(self, path="/usr/local/bin/serf"): try: self.serf = sh.Command(path) self.enable = utils.is_running("serf") except sh.CommandNotFound: log.warn("serf command not found", path=path) self.serf = None if self.enable: log.info("reactor enabled") else: log.warning("reactor disabled")
def __init__(self, path='/usr/local/bin/serf'): try: self.serf = sh.Command(path) self.enable = utils.is_running('serf') except sh.CommandNotFound: log.warn('serf command not found', path=path) self.serf = None if self.enable: log.info('reactor enabled') else: log.warning('reactor disabled')
def inner(*args, **kwargs): ''' decorator ''' if utils.is_running('serf') and is_allowed('serf'): return function(*args, **kwargs) else: pass
def test_not_running_process_detection(self): self.assertFalse(utils.is_running('no_chance_this_program_is_running'))
def test_running_process_detection(self): self.assertTrue(utils.is_running(self.always_running_process))