Ignore:
Timestamp:
Dec 10, 2010 9:00:16 AM (13 years ago)
Author:
Ted Faber <faber@…>
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)
Message:

allow command line progams to expand tildes. Added a class derived from OptionParser? to make that easily available.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedd/access_to_abac.py

    rfbee30a r62f3dd9  
    1212from federation.fedid import fedid
    1313from federation.authorizer import abac_authorizer
    14 from federation.util import abac_split_cert, abac_pem_type
     14from federation.util import abac_split_cert, abac_pem_type, file_expanding_opts
    1515
    1616
     
    224224
    225225
    226 class access_opts(OptionParser):
     226class access_opts(file_expanding_opts):
    227227    '''
    228228    Parse the options for this program.  Most are straightforward, but the
     
    247247
    248248    def __init__(self):
    249         OptionParser.__init__(self, usage='%prog [opts] file [...]')
     249        file_expanding_opts.__init__(self, usage='%prog [opts] file [...]')
    250250        self.add_option('--cert', dest='cert', default=None,
     251                type='str', action='callback', callback=self.expand_file,
    251252                help='my fedid as an X.509 certificate')
    252253        self.add_option('--key', dest='key', default=None,
     254                type='str', action='callback', callback=self.expand_file,
    253255                help='key for the certificate')
    254256        self.add_option('--dir', dest='dir', default=None,
     257                type='str', action='callback', callback=self.expand_file,
    255258                help='Output directory for credentials')
    256259        self.add_option('--type', action='callback', nargs=1, type='str',
     
    263266                default=False,
    264267                help='Do not print credential to local attribute map')
    265         self.add_option('--create-creds', action='store_true',
     268        self.add_option('--create_creds', action='store_true',
    266269                dest='create_creds', default=False,
    267270                help='create credentials for rules.  Requires ' + \
    268271                        '--cert, --key, and --dir to be given.')
    269272        self.add_option('--file', dest='file', default=None,
     273                type='str', action='callback', callback=self.expand_file,
    270274                help='Access DB to parse.  If this is present, ' + \
    271275                        'omit the positional filename')
    272276        self.add_option('--mapfile', dest='map', default=None,
     277                type='str', action='callback', callback=self.expand_file,
    273278                help='File for the attribute to local authorization data')
    274279        self.add_option('--no-delegate', action='store_false', dest='delegate',
Note: See TracChangeset for help on using the changeset viewer.