#!/usr/bin/env python import sys import os import pwd import tempfile import subprocess import re import xml.parsers.expat import time from federation.proof import proof from federation.remote_service import service_caller from federation.client_lib import client_opts, exit_with_fault, RPCException,\ wrangle_standard_options, do_rpc, info_format, log_authentication class exp_data_opts(client_opts): def __init__(self): client_opts.__init__(self) self.add_option("--data", dest="data", default=[], action="append", type="choice", choices=("id", "experimentdescription", "federant", "vtopo", "vis", "log", "status"), help="data to extract") parser = exp_data_opts() (opts, args) = parser.parse_args() try: cert, fid, url = wrangle_standard_options(opts) except RuntimeError, e: sys.exit("%s" %e) try: resp_dict = do_rpc({ }, url, opts.transport, cert, opts.trusted, serialize_only=opts.serialize_only, tracefile=opts.tracefile, caller=service_caller('MultiInfo'), responseBody='MultiInfoResponseBody') except RPCException, e: exit_with_fault(e, 'MultiInfo', opts) except RuntimeError, e: sys.exit("Error processing RPC: %s" % e) formatter = info_format() for i in resp_dict.get('info', []): for d in opts.data: formatter(i, d) print "---" proof = proof.from_dict(resp_dict.get('proof', {})) if proof and opts.auth_log: log_authentication(opts.auth_log, 'MultiInfo', 'succeeded', proof)