示例#1
0
文件: client.py 项目: retr0h/tribe
 def ping(self):
     """
     Add a key to the `config.etcd_path` with a TTL of `config.ping_ttl`.
     A wrapper around `client.add_key`.
     """
     path = '{prefix}/{hostname}'.format(prefix=self._config.etcd_path,
                                         hostname=util.get_hostname())
     response = self._client.write(path,
                                   time.time(),
                                   ttl=self._config.ping_ttl)
     if response.action == 'set':
         # TODO(retr0h): log
         print 'ping -> [ok]'
示例#2
0
文件: test_util.py 项目: retr0h/tribe
    def test_get_hostname(self, mocked):
        mocked.return_value = 'mocked-fqdn'
        result = util.get_hostname()

        self.assertEquals('mocked-fqdn', result)