Ignore:
Timestamp:
Jan 15, 2011 5:52:15 PM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master
Children:
aaf7f41
Parents:
ac15159 (diff), 944b746 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Ted Faber <faber@…> (01/15/11 17:51:40)
git-committer:
Ted Faber <faber@…> (01/15/11 17:52:15)
Message:

merge from current

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/fedd_create.py

    rac15159 r0a49bd7  
    77import ABAC
    88
    9 from string import join
    10 
     9from string import join, ascii_letters
     10from random import choice
     11
     12from federation.proof import proof
    1113from federation.fedid import fedid, generate_fedid
    1214from federation.remote_service import service_caller
    1315from federation.client_lib import client_opts, exit_with_fault, RPCException, \
    1416        wrangle_standard_options, do_rpc, get_experiment_names, save_certfile,\
    15         get_abac_certs
     17        get_abac_certs, log_authentication
    1618from federation.util import abac_split_cert, abac_context_to_creds
    1719from federation import topdl
     
    2628        client_opts.__init__(self)
    2729        self.add_option("--experiment_cert", dest="out_certfile",
     30                action="callback", callback=self.expand_file,
    2831                type="string", help="output certificate file")
    2932        self.add_option("--experiment_name", dest="exp_name",
    3033                type="string", help="Suggested experiment name")
    31         self.add_option("--file", dest="file",
     34        self.add_option("--file", dest="file", action="callback",
     35                callback=self.expand_file, type="str",
    3236                help="experiment description file")
    3337        self.add_option("--project", action="store", dest="project",
     
    153157(opts, args) = parser.parse_args()
    154158
     159svcs = []
    155160# Option processing
    156 cert, fid, url = wrangle_standard_options(opts)
     161try:
     162    cert, fid, url = wrangle_standard_options(opts)
     163except RuntimeError, e:
     164    sys.exit("%s" %e)
    157165
    158166if opts.file:
     
    199207
    200208# Fill in services
    201 svcs = []
    202209if opts.master and opts.project:
    203210    svcs.append(project_export_service(opts.master, opts.project))
     
    231238if acerts:
    232239    msg['credential'] = acerts
     240
     241# ZSI will not properly construct an empty message.  If nothing has been added
     242# to msg, pick a random localname to ensure the message is created
     243if not msg:
     244    msg['experimentID'] = {
     245            'localname': join([choice(ascii_letters) for i in range(0,8)],""),
     246            }
     247
    233248
    234249if opts.debug > 1: print >>sys.stderr, msg
     
    242257            caller=service_caller('New'), responseBody="NewResponseBody")
    243258except RPCException, e:
    244     exit_with_fault(e)
     259    exit_with_fault(e, 'New (create)', opts)
    245260except RuntimeError, e:
    246261    sys.exit("Error processing RPC: %s" % e)
     
    248263if opts.debug > 1: print >>sys.stderr, resp_dict
    249264
     265proof = proof.from_dict(resp_dict.get('proof', {}))
     266if proof and opts.auth_log:
     267    log_authentication(opts.auth_log, 'New (create)', 'succeeded', proof)
    250268# Save the experiment ID certificate if we need it
    251269try:
     
    298316            serialize_only=opts.serialize_only,
    299317            tracefile=opts.tracefile,
    300             caller=service_caller('Create'), responseBody="CreateResponseBody")
     318            caller=service_caller('Create', max_retries=1), responseBody="CreateResponseBody")
    301319except RPCException, e:
    302     exit_with_fault(e)
     320    exit_with_fault(e, 'Create', opts)
    303321except RuntimeError, e:
    304322    sys.exit("Error processing RPC: %s" % e)
     
    313331if e_fedid: print "fedid: %s" % e_fedid
    314332if st: print "status: %s" % st
    315 
     333proof = proof.from_dict(resp_dict.get('proof', {}))
     334if proof and opts.auth_log:
     335    log_authentication(opts.auth_log, 'Create', 'succeeded', proof)
Note: See TracChangeset for help on using the changeset viewer.