1 | #============================================================================ |
---|
2 | # This library is free software; you can redistribute it and/or |
---|
3 | # modify it under the terms of version 2.1 of the GNU Lesser General Public |
---|
4 | # License as published by the Free Software Foundation. |
---|
5 | # |
---|
6 | # This library is distributed in the hope that it will be useful, |
---|
7 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
8 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
9 | # Lesser General Public License for more details. |
---|
10 | # |
---|
11 | # You should have received a copy of the GNU Lesser General Public |
---|
12 | # License along with this library; if not, write to the Free Software |
---|
13 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
14 | #============================================================================ |
---|
15 | # Copyright (C) 2006 International Business Machines Corp. |
---|
16 | # Author: Reiner Sailer <sailer@us.ibm.com> |
---|
17 | #============================================================================ |
---|
18 | """Compiling a XML source policy file into mapping and binary versions. |
---|
19 | """ |
---|
20 | import sys |
---|
21 | import traceback |
---|
22 | from xen.util.security import ACMError, err, make_policy |
---|
23 | from xen.xm.opts import OptionError |
---|
24 | |
---|
25 | def usage(): |
---|
26 | print "\nUsage: xm makepolicy <policy>\n" |
---|
27 | print " Translate an XML source policy and create" |
---|
28 | print " mapping file and binary policy.\n" |
---|
29 | err("Usage") |
---|
30 | |
---|
31 | |
---|
32 | def main(argv): |
---|
33 | if len(argv) != 2: |
---|
34 | raise OptionError('No XML policy file specified') |
---|
35 | |
---|
36 | make_policy(argv[1]) |
---|
37 | |
---|
38 | if __name__ == '__main__': |
---|
39 | try: |
---|
40 | main(sys.argv) |
---|
41 | except Exception, e: |
---|
42 | sys.stderr.write('Error: %s\n' % str(e)) |
---|
43 | sys.exit(-1) |
---|
44 | |
---|
45 | |
---|