Changeset 62f3dd9 for fedd/federation
- Timestamp:
- Dec 10, 2010 9:00:16 AM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master
- Children:
- 913dc7a
- Parents:
- fbee30a
- git-author:
- Ted Faber <faber@…> (12/09/10 11:41:45)
- git-committer:
- Ted Faber <faber@…> (12/10/10 09:00:16)
- Location:
- fedd/federation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/client_lib.py
rfbee30a r62f3dd9 10 10 11 11 from fedid import fedid 12 from util import fedd_ssl_context 12 from util import fedd_ssl_context, file_expanding_opts 13 13 from remote_service import service_caller 14 14 from service_error import service_error … … 17 17 18 18 19 class client_opts( OptionParser):19 class client_opts(file_expanding_opts): 20 20 """ 21 21 Standatd set of options that all clients talking to fedd can probably use. 22 22 Client code usually specializes this. 23 23 """ 24 24 25 def __init__(self): 25 OptionParser.__init__(self, usage="%prog [opts] (--help for details)", 26 file_expanding_opts.__init__(self, 27 usage="%prog [opts] (--help for details)", 26 28 version="0.1") 27 29 28 self.add_option("--cert", action="store", dest="cert", 30 self.add_option("--cert", action="callback", dest="cert", 31 callback=self.expand_file, 29 32 type="string", help="my certificate file") 30 self.add_option("--abac", action="store", dest="abac_dir", 31 type="string", help="Directory with abac certs") 33 self.add_option("--abac", action="callback", dest="abac_dir", 34 callback=self.expand_file, 35 type="string", default=os.path.expanduser('~/.abac'), 36 help="Directory with abac certs") 37 self.add_option('--no_abac', action='store_const', const=None, 38 dest='abac_dir', help='Do not use abac authorization') 32 39 self.add_option( "--debug", action="count", dest="debug", 33 40 default=0, help="Set debug. Repeat for more information") … … 35 42 dest="serialize_only", default=False, 36 43 help="Print the SOAP request that would be sent and exit") 37 self.add_option("--trusted", action="store", dest="trusted", 44 self.add_option("--trusted", action="callback", dest="trusted", 45 callback=self.expand_file, 38 46 type="string", help="Trusted certificates (required)") 39 47 self.add_option("--url", action="store", dest="url", … … 98 106 ''' 99 107 rv = [ ] 100 if dir :108 if dir and os.path.isdir(dir): 101 109 for fn in ["%s/%s" % (dir, p) for p in os.listdir(dir) \ 102 110 if os.path.isfile("%s/%s" % (dir,p))]: -
fedd/federation/util.py
rfbee30a r62f3dd9 8 8 9 9 import httplib 10 11 from optparse import OptionParser 10 12 11 13 from socket import sslerror … … 95 97 self.set_allow_unknown_ca(True) 96 98 self.set_verify(SSL.verify_peer, 10, callback=callb) 99 100 class file_expanding_opts(OptionParser): 101 def expand_file(self, option, opt_str, v, p): 102 """ 103 Store the given value to the given destination after expanding home 104 directories. 105 """ 106 setattr(p.values, option.dest, os.path.expanduser(v)) 107 108 def __init__(self, usage=None, version=None): 109 OptionParser.__init__(self) 110 97 111 98 112 def read_simple_accessdb(fn, auth, mask=[]):
Note: See TracChangeset
for help on using the changeset viewer.