axis_examplecompt_changesinfo-ops
Last change
on this file since 25f66c3 was
6e63513,
checked in by Ted Faber <faber@…>, 14 years ago
|
Checkpoint
|
-
Property mode set to
100755
|
File size:
985 bytes
|
Rev | Line | |
---|
[71461a4] | 1 | #!/usr/local/bin/python |
---|
| 2 | |
---|
[353db8c] | 3 | import sys |
---|
| 4 | |
---|
[71461a4] | 5 | from optparse import OptionParser |
---|
| 6 | from federation.authorizer import abac_authorizer |
---|
| 7 | |
---|
| 8 | class Parser(OptionParser): |
---|
| 9 | def __init__(self): |
---|
[547aa3b] | 10 | OptionParser.__init__(self, usage='%prog [options]') |
---|
[71461a4] | 11 | self.add_option('--cert', dest='cert', help='Identity certificate') |
---|
| 12 | self.add_option('--key', dest='key', help='Identity key') |
---|
| 13 | self.add_option('--policy', dest='policy', |
---|
| 14 | help='ABAC policy certificates') |
---|
| 15 | self.add_option('--dir', dest='out_dir', help='directory to save into') |
---|
| 16 | |
---|
| 17 | parser = Parser() |
---|
| 18 | opts, args = parser.parse_args() |
---|
| 19 | |
---|
[353db8c] | 20 | if any([ not x for x in (opts.cert, opts.policy, opts.out_dir)]): |
---|
[71461a4] | 21 | parser.print_help() |
---|
| 22 | sys.exit(1) |
---|
[353db8c] | 23 | try: |
---|
| 24 | a = abac_authorizer(key=opts.key, me=opts.cert, certs=opts.policy, |
---|
| 25 | save=opts.out_dir) |
---|
| 26 | a.save(opts.out_dir) |
---|
| 27 | except EnvironmentError, e: |
---|
| 28 | sys.exit("Can't create or write %s: %s" % (e.filename, e.strerror)) |
---|
[6e63513] | 29 | except abac_authorizer.bad_cert_error, e: |
---|
[353db8c] | 30 | sys.exit("Error creating authorizer: %s" % e) |
---|
Note: See
TracBrowser
for help on using the repository browser.