| Trees | Indices | Help |
|---|
|
|
1 #!/usr/bin/python2
2 #
3 # Copyright (c) 2008--2018 Red Hat, Inc.
4 #
5 # This software is licensed to you under the GNU General Public License,
6 # version 2 (GPLv2). There is NO WARRANTY for this software, express or
7 # implied, including the implied warranties of MERCHANTABILITY or FITNESS
8 # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
9 # along with this software; if not, see
10 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
11 #
12 # Red Hat trademarks are not licensed under GPLv2. No permission is
13 # granted to use or replicate Red Hat trademarks that are incorporated
14 # in this software or its documentation.
15 #
16
17 import os
18 import sys
19
20 _path = "@@ROOT@@"
21 if _path not in sys.path:
22 sys.path.append(_path)
23
24 mod_name = os.path.basename(sys.argv[0])
25 mod_name = mod_name.replace('-', '_')
26 try:
27 mod = __import__("osad." + mod_name)
28 except ImportError:
29 e = sys.exc_info()[1]
30 sys.stderr.write("Unable to load module %s\n" % mod_name)
31 sys.stderr.write(str(e) + "\n")
32 sys.exit(1)
33 mod = getattr(mod, mod_name)
34
35 if __name__ == '__main__':
36 try:
37 sys.exit(mod.main() or 0)
38 except KeyboardInterrupt:
39 e = sys.exc_info()[1]
40 sys.stderr.write("\nUser interrupted process.\n")
41 sys.exit(0)
42 except SystemExit:
43 e = sys.exc_info()[1]
44 sys.exit(e.code)
45 except Exception:
46 e = sys.exc_info()[1]
47 sys.stderr.write("\nERROR: unhandled exception occurred: (%s).\n" % e)
48 sys.exit(-1)
49
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Wed Mar 4 07:37:43 2020 | http://epydoc.sourceforge.net |