Changeset c259a77 for fedd/fedd_ns2topdl.py
- Timestamp:
- Jun 3, 2014 4:29:31 PM (10 years ago)
- Branches:
- master
- Children:
- 0b217d1
- Parents:
- ba07149
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_ns2topdl.py
rba07149 rc259a77 8 8 from federation.remote_service import service_caller 9 9 from federation.client_lib import client_opts, exit_with_fault, RPCException, \ 10 wrangle_standard_options, do_rpc, get_experiment_names, save_certfile 10 wrangle_standard_options, do_rpc, get_experiment_names, save_certfile,\ 11 ns_service_re 11 12 12 13 class ns_topdl_opts(client_opts): … … 26 27 except RuntimeError, e: 27 28 sys.exit("%s" %e) 28 29 svcs = [] 30 contents = '' 29 31 if opts.file: 30 32 try: 31 contents = "".join([l for l in open(opts.file, "r")]) 33 for l in open(opts.file, 'r'): 34 contents += l 35 if ns_service_re.match(l): 36 svcs.append('SERVICE: %s' % ns_service_re.match(l).group(1)) 32 37 except EnvironmentError, e: 33 38 sys.exit("Can't read %s: %s" % (opts.file, e)) … … 62 67 sys.exit("Bad response. %s" % e.message) 63 68 69 if len(svcs) > 0 : 70 comments = '<!--\n%s\n-->' % '\n'.join(svcs) 71 else: 72 comments = '' 73 64 74 if opts.outfile: 65 75 try: 66 76 f = open(opts.outfile, "w") 77 print >>f, comments 67 78 print >>f, topdl.topology_to_xml(top, top="experiment") 68 79 f.close() … … 70 81 sys.exit("Can't write to %s: %s" % (opts.outfile, e)) 71 82 else: 83 print comments 72 84 print topdl.topology_to_xml(top, top="experiment") 73 85 proof = proof.from_dict(resp_dict.get('proof', {}))
Note: See TracChangeset
for help on using the changeset viewer.