Changeset c573278 for fedd/fedd_create.py
- Timestamp:
- Nov 24, 2010 3:45:50 PM (13 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master
- Children:
- 725c55d
- Parents:
- de7cb08
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_create.py
rde7cb08 rc573278 4 4 import re 5 5 import subprocess 6 7 import ABAC 6 8 7 9 from string import join … … 12 14 wrangle_standard_options, do_rpc, get_experiment_names, save_certfile,\ 13 15 get_abac_certs 14 from federation.util import abac_split_cert 16 from federation.util import abac_split_cert, abac_context_to_creds 15 17 16 18 class fedd_create_opts(client_opts): … … 101 103 value if the filename in which the certificate was stored. 102 104 ''' 103 104 105 certfile = keyfile = None 105 106 expid = "%s" % fedid … … 110 111 try: 111 112 keyfile, certfile = abac_split_cert(cert) 112 print "%s %s" % (keyfile, certfile)113 113 114 114 rv = 0 115 if name: fn = '%s/%s_attr.der' % (dir, name) 116 else: fn = '%s/%s_attr.der' % (dir, expid) 115 if name: 116 fn ='%s/%s_attr.der' % (dir, name) 117 id_fn = '%s/%s_id.pem' % (dir, name) 118 else: 119 fn = '%s/%s_attr.der' % (dir, expid) 120 id_fn = '%s/%s_id.pem' % (dir, expid) 117 121 118 122 cmd = [creddy, '--attribute', '--issuer=%s' % certfile, … … 122 126 if not debug: 123 127 if subprocess.call(cmd) != 0: 124 return None128 return [] 125 129 else: 126 130 print join(cmd) 127 return None 128 129 f = open(fn, 'r') 130 rv = f.read() 131 f.close() 132 return rv 131 return [] 132 133 context = ABAC.Context() 134 if context.load_id_file(certfile) != ABAC.ABAC_CERT_SUCCESS or \ 135 context.load_attribute_file(fn) != ABAC.ABAC_CERT_SUCCESS: 136 return [] 137 ids, attrs = abac_context_to_creds(context) 138 139 return ids + attrs 140 133 141 134 142 finally: … … 236 244 if e_fedid and opts.delegate: 237 245 try: 238 cred = delegate(e_fedid, cert, opts.abac_dir, name=opts.exp_name)239 if cred :240 acerts. append(cred)246 creds = delegate(e_fedid, cert, opts.abac_dir, name=opts.exp_name) 247 if creds: 248 acerts.extend(creds) 241 249 except EnvironmentError, e: 242 250 sys.exit("Cannot delegate rights %s: %s" % (e.filename, e.strerror));
Note: See TracChangeset
for help on using the changeset viewer.