Exemplo n.º 1
0
 def take_action(self, parsed_args):
     vargs = vars(parsed_args)
     negotiation_id = vargs["negotiation_id"]
     contribution_id = int(vargs["contribution_id"])
     client = mk_panoramix_client(cfg)
     d = client.contribution_accept(negotiation_id, contribution_id)
     print("%s" % d["id"])
Exemplo n.º 2
0
 def take_action(self, parsed_args):
     vargs = vars(parsed_args)
     peer_id = vargs["peer_id"]
     client = mk_panoramix_client(cfg)
     client.peer_import(peer_id)
     m = "Imported public key for %s in your local registry" % peer_id
     print(m)
Exemplo n.º 3
0
    def take_action(self, parsed_args):
        vargs = vars(parsed_args)
        peer_id = vargs["peer_id"]
        endpoint_id = vargs["endpoint_id"]
        endpoint_type = vargs["endpoint_type"]
        params = dict(vargs["param"] or [])
        links = vargs["link"] or []
        links = map(link_arg_to_dict, links)
        endpoint_params = canonical.to_canonical(params)
        size_min = int(vargs["size_min"])
        size_max = int(vargs["size_max"])
        description = vargs["description"] or ""
        public = vargs["public"]
        consensus_id = vargs["consensus_id"]
        negotiation_id = vargs["negotiation_id"]
        accept = vargs["accept"]

        client = mk_panoramix_client(cfg)
        is_contrib, d = client.endpoint_create(endpoint_id,
                                               peer_id,
                                               endpoint_type,
                                               endpoint_params,
                                               size_min,
                                               size_max,
                                               description,
                                               public=public,
                                               links=links,
                                               consensus_id=consensus_id,
                                               negotiation_id=negotiation_id,
                                               accept=accept)
        id_key = "id" if is_contrib else "endpoint_id"
        print("%s" % d["data"][id_key])
Exemplo n.º 4
0
 def take_action(self, parsed_args):
     vargs = vars(parsed_args)
     peer_id = vargs["peer_id"]
     status = vargs["status"]
     client = mk_panoramix_client(cfg)
     es = client.endpoint_list(peer_id=peer_id, status=status)
     return from_list_of_dict(es)
Exemplo n.º 5
0
 def take_action(self, parsed_args):
     vargs = vars(parsed_args)
     negotiation_id = vargs["negotiation_id"]
     body = vargs["body"]
     accept = vargs["accept"]
     client = mk_panoramix_client(cfg)
     r = client.run_contribution(negotiation_id, body, accept)
     print(r.json())
Exemplo n.º 6
0
 def take_action(self, parsed_args):
     vargs = vars(parsed_args)
     recipients = vargs["recipients"]
     recipients = recipients.split(',')
     endpoint_id = vargs["endpoint_id"]
     data = vargs["data"]
     client = mk_panoramix_client(cfg)
     d = client.message_send(endpoint_id, data, recipients)
     print("%s" % d["data"]["id"])
Exemplo n.º 7
0
 def take_action(self, parsed_args):
     vargs = vars(parsed_args)
     consensus_id = vargs["consensus_id"]
     client = mk_panoramix_client(cfg)
     r = client.clients.negotiations.list(
         params={"consensus": consensus_id})
     conses = r.json()
     assert len(conses) == 1
     cons = conses[0]["data"]
     return cons.keys(), cons.values()
Exemplo n.º 8
0
    def take_action(self, parsed_args):
        vargs = vars(parsed_args)
        negotiation_id = vargs["negotiation_id"]
        client = mk_panoramix_client(cfg)
        contribs = filter_data_only(client.contribution_list(negotiation_id))
        listing = []

        for contrib in contribs:
            realtext = canonical.from_unicode_canonical(contrib["text"])
            listing.append({
                "body": realtext["body"],
                "meta": realtext["meta"],
                "id": contrib["id"],
                "signer_key_id": contrib["signer_key_id"],
            })
        return from_list_of_dict(listing)
Exemplo n.º 9
0
    def take_action(self, parsed_args):
        client = mk_panoramix_client(cfg)
        vargs = vars(parsed_args)
        consensus_id = vargs["consensus_id"]
        negotiation_id = vargs["negotiation_id"]
        accept = vargs["accept"]
        name = vargs["name"]
        if name is None:
            name = cfg.get("NAME")
        name = utils.locale_to_unicode(name)
        owners = vargs["owners"]
        owners = owners.split(',') if owners else []

        is_contrib, d = client.peer_create(name, True, owners, consensus_id,
                                           negotiation_id, accept)
        id_key = "id" if is_contrib else "peer_id"
        print("%s" % d["data"][id_key])
Exemplo n.º 10
0
    def take_action(self, parsed_args):
        vargs = vars(parsed_args)
        process_log_file = vargs["process_log_file"]

        upload = vargs["upload"]
        peer_id = vargs["peer_id"]
        endpoint_id = vargs["endpoint_id"]

        client = mk_panoramix_client(cfg)
        responses, process_log = client.inbox_process(endpoint_id, peer_id,
                                                      upload)

        for response in responses:
            print("%s" % response["data"]["id"])
        with open(process_log_file, "w") as f:
            json.dump(process_log, f)
        print("Wrote process log in '%s'." % process_log_file)
Exemplo n.º 11
0
    def take_action(self, parsed_args):
        vargs = vars(parsed_args)
        endpoint_id = vargs["endpoint_id"]
        from_log = vargs["from_log"]
        with open(from_log) as f:
            properties = json.load(f)
        on_last_consensus_id = vargs.get("on_last_consensus_id")
        consensus_id = vargs.get("consensus_id")
        negotiation_id = vargs["negotiation_id"]
        accept = vargs["accept"]

        client = mk_panoramix_client(cfg)
        is_contrib, d = client.endpoint_action(endpoint_id, self.STATUS,
                                               properties,
                                               on_last_consensus_id,
                                               consensus_id, negotiation_id,
                                               accept)
        id_key = "id" if is_contrib else "endpoint_id"
        print("%s" % d["data"][id_key])
Exemplo n.º 12
0
    def take_action(self, parsed_args):
        vargs = vars(parsed_args)
        endpoint_id = vargs["endpoint_id"]
        hashes_log_file = vargs["hashes_log_file"]
        serialized = vargs["serialized"]
        dry_run = vargs["dry_run"]
        client = mk_panoramix_client(cfg)
        r = client.get_input_from_link(endpoint_id,
                                       self.BOX,
                                       serialized=serialized,
                                       dry_run=dry_run)
        if r is None:
            print "Input not ready"
            return
        responses, hashes = r
        for response in responses:
            print("%s" % response["data"]["id"])

        wrapped_hash_log = {"message_hashes": hashes}
        with open(hashes_log_file, "w") as f:
            json.dump(wrapped_hash_log, f)
        print("Wrote %s log in '%s'." % (self.BOX, hashes_log_file))
Exemplo n.º 13
0
 def take_action(self, parsed_args):
     vargs = vars(parsed_args)
     endpoint_id = vargs["endpoint_id"]
     client = mk_panoramix_client(cfg)
     ms = client.box_list(endpoint_id, self.BOX)
     return from_list_of_dict(ms)
Exemplo n.º 14
0
 def take_action(self, parsed_args):
     vargs = vars(parsed_args)
     peer_id = vargs["peer_id"]
     client = mk_panoramix_client(cfg)
     d = client.peer_info(peer_id)
     return d.keys(), d.values()
Exemplo n.º 15
0
 def take_action(self, parsed_args):
     client = mk_panoramix_client(cfg)
     neg_dict = client.negotiation_create()
     neg_id = neg_dict["id"]
     print(neg_id)
Exemplo n.º 16
0
 def take_action(self, parsed_args):
     client = mk_panoramix_client(cfg)
     info = client.crypto_client.get_key_info()
     return info.keys(), info.values()
Exemplo n.º 17
0
 def take_action(self, parsed_args):
     vargs = vars(parsed_args)
     endpoint_id = vargs["endpoint_id"]
     client = mk_panoramix_client(cfg)
     d = client.endpoint_info(endpoint_id)
     return d.keys(), d.values()
Exemplo n.º 18
0
 def take_action(self, parsed_args):
     client = mk_panoramix_client(cfg)
     r = client.clients.negotiations.list()
     ps = r.json()
     return from_list_of_dict(filter_data_only(ps))
Exemplo n.º 19
0
 def take_action(self, parsed_args):
     vargs = vars(parsed_args)
     negotiation_id = vargs["negotiation_id"]
     client = mk_panoramix_client(cfg)
     neg = client.negotiation_info(negotiation_id)
     return neg.keys(), neg.values()