source: fedd/fedd_multiinfo.py @ f74e3a1

Last change on this file since f74e3a1 was 2e46f35, checked in by mikeryan <mikeryan@…>, 14 years ago

switch to /usr/bin/env python to run python

  • Property mode set to 100755
File size: 1.5 KB
RevLine 
[2e46f35]1#!/usr/bin/env python
[d743d60]2
3import sys
4import os
5import pwd
6import tempfile
7import subprocess
8import re
9import xml.parsers.expat
10import time
11
[e83f2f2]12from federation.proof import proof
[d743d60]13from federation.remote_service import service_caller
14from federation.client_lib import client_opts, exit_with_fault, RPCException,\
[e83f2f2]15        wrangle_standard_options, do_rpc, info_format, log_authentication
[d743d60]16
17class exp_data_opts(client_opts):
18    def __init__(self):
19        client_opts.__init__(self)
20        self.add_option("--data", dest="data", default=[],
21                action="append", type="choice",
22                choices=("id", "experimentdescription", "federant", "vtopo", 
23                    "vis", "log", "status"),
24                help="data to extract")
25       
26parser = exp_data_opts()
27(opts, args) = parser.parse_args()
[a0c2866]28try:
29    cert, fid, url = wrangle_standard_options(opts)
30except RuntimeError, e:
31    sys.exit("%s" %e)
[d743d60]32
33try:
34    resp_dict = do_rpc({ },
[5d854e1]35            url, opts.transport, cert, opts.trusted, 
[d743d60]36            serialize_only=opts.serialize_only,
37            tracefile=opts.tracefile,
38            caller=service_caller('MultiInfo'), 
39            responseBody='MultiInfoResponseBody')
40except RPCException, e:
[e83f2f2]41    exit_with_fault(e, 'MultiInfo', opts)
[d743d60]42except RuntimeError, e:
43    sys.exit("Error processing RPC: %s" % e)
44
45formatter = info_format()
46for i in resp_dict.get('info', []):
47    for d in opts.data:
48        formatter(i, d)
49    print "---"
[e83f2f2]50proof = proof.from_dict(resp_dict.get('proof', {}))
51if proof and opts.auth_log:
52    log_authentication(opts.auth_log, 'MultiInfo', 'succeeded', proof)
Note: See TracBrowser for help on using the repository browser.