Changeset 0a49bd7 for fedd/fedd_create.py
- Timestamp:
- Jan 15, 2011 5:52:15 PM (14 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_create.py
rac15159 r0a49bd7 7 7 import ABAC 8 8 9 from string import join 10 9 from string import join, ascii_letters 10 from random import choice 11 12 from federation.proof import proof 11 13 from federation.fedid import fedid, generate_fedid 12 14 from federation.remote_service import service_caller 13 15 from federation.client_lib import client_opts, exit_with_fault, RPCException, \ 14 16 wrangle_standard_options, do_rpc, get_experiment_names, save_certfile,\ 15 get_abac_certs 17 get_abac_certs, log_authentication 16 18 from federation.util import abac_split_cert, abac_context_to_creds 17 19 from federation import topdl … … 26 28 client_opts.__init__(self) 27 29 self.add_option("--experiment_cert", dest="out_certfile", 30 action="callback", callback=self.expand_file, 28 31 type="string", help="output certificate file") 29 32 self.add_option("--experiment_name", dest="exp_name", 30 33 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", 32 36 help="experiment description file") 33 37 self.add_option("--project", action="store", dest="project", … … 153 157 (opts, args) = parser.parse_args() 154 158 159 svcs = [] 155 160 # Option processing 156 cert, fid, url = wrangle_standard_options(opts) 161 try: 162 cert, fid, url = wrangle_standard_options(opts) 163 except RuntimeError, e: 164 sys.exit("%s" %e) 157 165 158 166 if opts.file: … … 199 207 200 208 # Fill in services 201 svcs = []202 209 if opts.master and opts.project: 203 210 svcs.append(project_export_service(opts.master, opts.project)) … … 231 238 if acerts: 232 239 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 243 if not msg: 244 msg['experimentID'] = { 245 'localname': join([choice(ascii_letters) for i in range(0,8)],""), 246 } 247 233 248 234 249 if opts.debug > 1: print >>sys.stderr, msg … … 242 257 caller=service_caller('New'), responseBody="NewResponseBody") 243 258 except RPCException, e: 244 exit_with_fault(e )259 exit_with_fault(e, 'New (create)', opts) 245 260 except RuntimeError, e: 246 261 sys.exit("Error processing RPC: %s" % e) … … 248 263 if opts.debug > 1: print >>sys.stderr, resp_dict 249 264 265 proof = proof.from_dict(resp_dict.get('proof', {})) 266 if proof and opts.auth_log: 267 log_authentication(opts.auth_log, 'New (create)', 'succeeded', proof) 250 268 # Save the experiment ID certificate if we need it 251 269 try: … … 298 316 serialize_only=opts.serialize_only, 299 317 tracefile=opts.tracefile, 300 caller=service_caller('Create' ), responseBody="CreateResponseBody")318 caller=service_caller('Create', max_retries=1), responseBody="CreateResponseBody") 301 319 except RPCException, e: 302 exit_with_fault(e )320 exit_with_fault(e, 'Create', opts) 303 321 except RuntimeError, e: 304 322 sys.exit("Error processing RPC: %s" % e) … … 313 331 if e_fedid: print "fedid: %s" % e_fedid 314 332 if st: print "status: %s" % st 315 333 proof = proof.from_dict(resp_dict.get('proof', {})) 334 if proof and opts.auth_log: 335 log_authentication(opts.auth_log, 'Create', 'succeeded', proof)
Note: See TracChangeset
for help on using the changeset viewer.