Esempio n. 1
0
    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'
            }
        }
Esempio n. 2
0
    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")
Esempio n. 3
0
    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')
Esempio n. 4
0
 def inner(*args, **kwargs):
     ''' decorator '''
     if utils.is_running('serf') and is_allowed('serf'):
         return function(*args, **kwargs)
     else:
         pass
Esempio n. 5
0
 def test_not_running_process_detection(self):
     self.assertFalse(utils.is_running('no_chance_this_program_is_running'))
Esempio n. 6
0
 def test_running_process_detection(self):
     self.assertTrue(utils.is_running(self.always_running_process))
Esempio n. 7
0
 def test_not_running_process_detection(self):
     self.assertFalse(utils.is_running('no_chance_this_program_is_running'))
Esempio n. 8
0
 def test_running_process_detection(self):
     self.assertTrue(utils.is_running(self.always_running_process))
Esempio n. 9
0
 def inner(*args, **kwargs):
     ''' decorator '''
     if utils.is_running('serf') and is_allowed('serf'):
         return function(*args, **kwargs)
     else:
         pass