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