Exemplo n.º 1
0
 def __init__(self,
              node_id,
              master_repl,
              worker_count=5,
              sock_dir=None,
              node_cert=None,
              node_key=None,
              ca=None,
              user_store=None,
              cert_pass=None,
              **kwargs):
     self.node_id = node_id or socket.gethostname()
     self.master_repl = 'tcp://%s' % master_repl
     self.worker_count = worker_count
     self.sock_dir = sock_dir or os.path.join(LIB_DIR, 'cloudrunner',
                                              'sock')
     self.node_cert = node_cert
     self.node_key = node_key
     self.ca = ca
     self.cert_pass = cert_pass
     self._sockets = []
     self.context = zmq.Context()
     self.stopped = Event()
     if not user_store:
         user_store = os.path.join(LIB_DIR, 'cloudrunner', 'user_store.db')
     self.user_store = CertStore(user_store)
Exemplo n.º 2
0
    def __init__(self, **kwargs):
        api_url = kwargs.get('api_url') or 'http://127.0.0.1/rest/'
        self.session = requests.Session()
        self.op_queue = OpQueue(self.session, api_url)
        host_resolver_uri = kwargs.get("host_resolver")
        if host_resolver_uri:
            self.host_resolver = HostResolver(host_resolver_uri)
        else:
            self.host_resolver = None

        self.peer_cache = kwargs.get("peer_cache")
        if not self.peer_cache:
            self.peer_cache = os.path.join(LIB_DIR, 'cloudrunner-cli',
                                           'peer_cache.db')
        self.peer_store = CertStore(self.peer_cache)
Exemplo n.º 3
0
 def unregister_cli(self):
     user_store = CONFIG.user_store
     store = CertStore(user_store)
     if not store.remove(common_name=self.args.common_name,
                         fingerprint=self.args.fingerprint):
         exit(2)
Exemplo n.º 4
0
 def register_cli(self):
     user_store = CONFIG.user_store
     store = CertStore(user_store)
     if not store.insert(self.args.common_name, self.args.fingerprint):
         exit(2)
Exemplo n.º 5
0
 def unregister_cli(self):
     user_store = CONFIG.user_store
     store = CertStore(user_store)
     if not store.remove(common_name=self.args.common_name,
                         fingerprint=self.args.fingerprint):
         exit(2)
Exemplo n.º 6
0
 def list_cli(self):
     user_store = CONFIG.user_store
     store = CertStore(user_store)
     for cli in store._store:
         print colors.blue("%-40s %s" % cli)
Exemplo n.º 7
0
 def register_cli(self):
     user_store = CONFIG.user_store
     store = CertStore(user_store)
     if not store.insert(self.args.common_name, self.args.fingerprint):
         exit(2)