source: fedd/fedd_multiinfo.py @ f24fc8d

Last change on this file since f24fc8d 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
Line 
1#!/usr/bin/env python
2
3import sys
4import os
5import pwd
6import tempfile
7import subprocess
8import re
9import xml.parsers.expat
10import time
11
12from federation.proof import proof
13from federation.remote_service import service_caller
14from federation.client_lib import client_opts, exit_with_fault, RPCException,\
15        wrangle_standard_options, do_rpc, info_format, log_authentication
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()
28try:
29    cert, fid, url = wrangle_standard_options(opts)
30except RuntimeError, e:
31    sys.exit("%s" %e)
32
33try:
34    resp_dict = do_rpc({ },
35            url, opts.transport, cert, opts.trusted, 
36            serialize_only=opts.serialize_only,
37            tracefile=opts.tracefile,
38            caller=service_caller('MultiInfo'), 
39            responseBody='MultiInfoResponseBody')
40except RPCException, e:
41    exit_with_fault(e, 'MultiInfo', opts)
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 "---"
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.