author | Pascal Volk <neverseen@users.sourceforge.net> |
Tue, 04 Mar 2008 23:28:04 +0000 | |
changeset 13 | 1d9bf63a86f7 |
parent 12 | 44161dbb1518 |
child 17 | fe9be0081e5f |
permissions | -rwxr-xr-x |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
2 |
# -*- coding: UTF-8 -*- |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
3 |
# Copyright 2007-2008 VEB IT |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
4 |
# See COPYING for distribution information. |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
5 |
# $Id$ |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
6 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
7 |
"""This is the vmm main script.""" |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
8 |
|
4 | 9 |
from VirtualMailManager.constants.VERSION import VERSION |
10 |
||
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
11 |
__author__ = 'Pascal Volk <p.volk@veb-it.de>' |
4 | 12 |
__version__ = VERSION |
13 |
__revision__ = 'rev '+'$Rev$'.split()[1] |
|
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
14 |
__date__ = '$Date$'.split()[1] |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
15 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
16 |
import os |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
17 |
import sys |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
18 |
from getpass import getpass |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
19 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
20 |
from VirtualMailManager.VirtualMailManager import VirtualMailManager |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
21 |
from VirtualMailManager.Config import VMMConfig |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
22 |
import VirtualMailManager.Exceptions as VMME |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
23 |
import VirtualMailManager.constants.EXIT as EXIT |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
24 |
|
4 | 25 |
__prog__ = os.path.basename(sys.argv[0]) |
26 |
||
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
27 |
def usage(excode=0, errMsg=None): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
28 |
sys.stderr.write("""\ |
4 | 29 |
Usage: %s OPTION OBJECT ARGS* |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
30 |
short long |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
31 |
option object args (* = optional) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
32 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
33 |
da domainadd domain.tld transport* |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
34 |
di domaininfo domain.tld detailed* |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
35 |
dt domaintransport domain.tld transport |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
36 |
dd domaindelete domain.tld delalias*|deluser*|delall* |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
37 |
ua useradd user@domain.tld password* |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
38 |
ui userinfo user@domain.tld du* |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
39 |
un username user@domain.tld 'Users Name' |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
40 |
up userpassword user@domain.tld password* |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
41 |
u0 userdisable user@domain.tld |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
42 |
u1 userenable user@domain.tld |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
43 |
ud userdelete user@domain.tld |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
44 |
aa aliasadd alias@domain.tld user@domain.tld |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
45 |
ai aliasinfo alias@domain.tld |
12
44161dbb1518
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
5
diff
changeset
|
46 |
ad aliasdelete alias@domain.tld user@domain.tld* |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
47 |
cf configure section* |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
48 |
h help |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
49 |
v version |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
50 |
|
5 | 51 |
""" % __prog__) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
52 |
if not errMsg is None: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
53 |
sys.stderr.write('Error: %s\n' % errMsg) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
54 |
sys.exit(excode) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
55 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
56 |
def getVMM(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
57 |
try: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
58 |
vmm = VirtualMailManager() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
59 |
return vmm |
2
9b39f828aa8a
* 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
1
diff
changeset
|
60 |
except (VMME.VMMException, VMME.VMMNotRootException, VMME.VMMPermException, |
9b39f828aa8a
* 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
1
diff
changeset
|
61 |
VMME.VMMConfigException), e: |
9b39f828aa8a
* 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
1
diff
changeset
|
62 |
sys.stderr.write("\aERROR: %s\n" % e[0][0]) |
9b39f828aa8a
* 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
1
diff
changeset
|
63 |
sys.exit(e[0][1]) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
64 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
65 |
def configure(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
66 |
try: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
67 |
if len(sys.argv) < 3: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
68 |
vmm.configure() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
69 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
70 |
vmm.configure(sys.argv[2]) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
71 |
except (EOFError, KeyboardInterrupt): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
72 |
sys.stderr.write('\nOuch!\n') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
73 |
sys.exit(EXIT.USER_INTERRUPT) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
74 |
except VMME.VMMConfigException, e: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
75 |
sys.stderr.write(str(e)) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
76 |
sys.exit(EXIT.CONF_ERROR) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
77 |
sys.exit(0) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
78 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
79 |
def _readpass(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
80 |
clear0 = '' |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
81 |
clear1 = '1' |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
82 |
while clear0 != clear1: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
83 |
while len(clear0) < 1: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
84 |
clear0 = getpass(prompt='Enter new password: ') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
85 |
if len(clear0) < 1: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
86 |
sys.stderr.write('Sorry, empty passwords are not permitted\n') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
87 |
clear1 = getpass(prompt='Retype new password: ') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
88 |
if clear0 != clear1: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
89 |
clear0 = '' |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
90 |
sys.stderr.write('Sorry, passwords do not match\n') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
91 |
return clear0 |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
92 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
93 |
def _printInfo(info, title): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
94 |
msg = title+' information' |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
95 |
print '%s\n%s' % (msg, '-'*len(msg)) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
96 |
for k,v in info.items(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
97 |
print '\t%s: %s' % (k.title().ljust(15, '.'), v) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
98 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
99 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
100 |
def _printUsers(users, title): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
101 |
msg = 'Available '+title |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
102 |
print '%s\n%s' % (msg, '-'*len(msg)) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
103 |
if len(users) > 0: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
104 |
for user in users: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
105 |
print '\t%s' % user |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
106 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
107 |
print '\tNone' |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
108 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
109 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
110 |
def _printAliases(alias, targets): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
111 |
msg = 'Alias information' |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
112 |
print '%s\n%s' % (msg, '-'*len(msg)) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
113 |
print '\tMail for %s goes to:' % alias |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
114 |
if len(targets) > 0: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
115 |
for target in targets: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
116 |
print '\t -> %s' % target |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
117 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
118 |
print '\tNone' |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
119 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
120 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
121 |
def domain_add(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
122 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
123 |
if argc < 3: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
124 |
usage(EXIT.MISSING_ARGS, 'Missing domain name.') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
125 |
elif argc < 4: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
126 |
vmm.domain_add(sys.argv[2].lower()) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
127 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
128 |
vmm.domain_add(sys.argv[2].lower(), sys.argv[3]) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
129 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
130 |
def domain_delete(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
131 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
132 |
if argc < 3: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
133 |
usage(EXIT.MISSING_ARGS, 'Missing domain name.') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
134 |
elif argc < 4: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
135 |
vmm.domain_delete(sys.argv[2].lower()) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
136 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
137 |
vmm.domain_delete(sys.argv[2].lower(), sys.argv[3]) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
138 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
139 |
def domain_info(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
140 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
141 |
if argc < 3: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
142 |
usage(EXIT.MISSING_ARGS, 'Missing domain name.') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
143 |
elif argc < 4: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
144 |
_printInfo(vmm.domain_info(sys.argv[2].lower()), 'Domain') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
145 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
146 |
infos = vmm.domain_info(sys.argv[2].lower(), sys.argv[3]) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
147 |
_printInfo(infos[0], 'Domain') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
148 |
_printUsers(infos[1], 'accounts') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
149 |
_printUsers(infos[2], 'aliases') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
150 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
151 |
def domain_transport(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
152 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
153 |
if argc < 3: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
154 |
usage(EXIT.MISSING_ARGS, 'Missing domain name and new transport.') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
155 |
if argc < 4: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
156 |
usage(EXIT.MISSING_ARGS, 'Missing new transport.') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
157 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
158 |
vmm.domain_transport(sys.argv[2].lower(), sys.argv[3]) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
159 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
160 |
def user_add(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
161 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
162 |
if argc < 3: |
3
a9b44e04bf01
* VirtualMailManager/Account.py:
Pascal Volk <neverseen@users.sourceforge.net>
parents:
2
diff
changeset
|
163 |
usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
164 |
elif argc < 4: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
165 |
password = _readpass() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
166 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
167 |
password = sys.argv[3] |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
168 |
vmm.user_add(sys.argv[2].lower(), password) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
169 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
170 |
def user_delete(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
171 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
172 |
if argc < 3: |
3
a9b44e04bf01
* VirtualMailManager/Account.py:
Pascal Volk <neverseen@users.sourceforge.net>
parents:
2
diff
changeset
|
173 |
usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
174 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
175 |
vmm.user_delete(sys.argv[2].lower()) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
176 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
177 |
def user_info(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
178 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
179 |
if argc < 3: |
3
a9b44e04bf01
* VirtualMailManager/Account.py:
Pascal Volk <neverseen@users.sourceforge.net>
parents:
2
diff
changeset
|
180 |
usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
181 |
elif argc < 4: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
182 |
_printInfo(vmm.user_info(sys.argv[2].lower()), 'Account') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
183 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
184 |
_printInfo(vmm.user_info(sys.argv[2].lower(), True), 'Account') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
185 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
186 |
def user_name(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
187 |
global argc |
2
9b39f828aa8a
* 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
1
diff
changeset
|
188 |
if argc < 3: |
3
a9b44e04bf01
* VirtualMailManager/Account.py:
Pascal Volk <neverseen@users.sourceforge.net>
parents:
2
diff
changeset
|
189 |
usage(EXIT.MISSING_ARGS, 'Missing e-mail address and users name.') |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
190 |
if argc < 4: |
2
9b39f828aa8a
* 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
1
diff
changeset
|
191 |
usage(EXIT.MISSING_ARGS, 'Missing users name.') |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
192 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
193 |
vmm.user_name(sys.argv[2].lower(), sys.argv[3]) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
194 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
195 |
def user_enable(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
196 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
197 |
if argc < 3: |
3
a9b44e04bf01
* VirtualMailManager/Account.py:
Pascal Volk <neverseen@users.sourceforge.net>
parents:
2
diff
changeset
|
198 |
usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
199 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
200 |
vmm.user_enable(sys.argv[2].lower()) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
201 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
202 |
def user_disable(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
203 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
204 |
if argc < 3: |
3
a9b44e04bf01
* VirtualMailManager/Account.py:
Pascal Volk <neverseen@users.sourceforge.net>
parents:
2
diff
changeset
|
205 |
usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
206 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
207 |
vmm.user_disable(sys.argv[2].lower()) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
208 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
209 |
def user_password(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
210 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
211 |
if argc < 3: |
3
a9b44e04bf01
* VirtualMailManager/Account.py:
Pascal Volk <neverseen@users.sourceforge.net>
parents:
2
diff
changeset
|
212 |
usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
213 |
elif argc < 4: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
214 |
password = _readpass() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
215 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
216 |
password = sys.argv[3] |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
217 |
vmm.user_password(sys.argv[2].lower(), password) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
218 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
219 |
def alias_add(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
220 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
221 |
if argc < 4: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
222 |
usage(EXIT.MISSING_ARGS, 'Missing alias address and destination.') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
223 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
224 |
vmm.alias_add(sys.argv[2].lower(), sys.argv[3]) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
225 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
226 |
def alias_info(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
227 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
228 |
if argc < 3: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
229 |
usage(EXIT.MISSING_ARGS, 'Missing alias address') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
230 |
else: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
231 |
_printAliases(sys.argv[2], vmm.alias_info(sys.argv[2].lower())) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
232 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
233 |
def alias_delete(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
234 |
global argc |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
235 |
if argc < 3: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
236 |
usage(EXIT.MISSING_ARGS, 'Missing alias address') |
12
44161dbb1518
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
5
diff
changeset
|
237 |
elif argc < 4: |
44161dbb1518
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
5
diff
changeset
|
238 |
vmm.alias_delete(sys.argv[2].lower()) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
239 |
else: |
12
44161dbb1518
* 'VirtualMailManager/Alias.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
5
diff
changeset
|
240 |
vmm.alias_delete(sys.argv[2].lower(), sys.argv[3].lower()) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
241 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
242 |
def showWarnings(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
243 |
if vmm.hasWarnings(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
244 |
print '\nWarnings:' |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
245 |
for w in vmm.getWarnings(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
246 |
print " * ",w |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
247 |
|
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
248 |
#def main(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
249 |
if __name__ == '__main__': |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
250 |
argc = len(sys.argv) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
251 |
if argc < 2: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
252 |
usage(EXIT.MISSING_ARGS) # -> exit |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
253 |
vmm = getVMM() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
254 |
try: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
255 |
if sys.argv[1] in ['cf', 'configure'] or not vmm.setupIsDone(): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
256 |
configure() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
257 |
except VMME.VMMConfigException, e: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
258 |
sys.stderr.write(str(e)) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
259 |
sys.exit(EXIT.CONF_ERROR) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
260 |
except VMME.VMMException, e: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
261 |
sys.stderr.write("\aERROR: %s\n" % e[0][0]) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
262 |
sys.exit(e[0][1]) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
263 |
try: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
264 |
if sys.argv[1] in ['da', 'domainadd']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
265 |
domain_add() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
266 |
elif sys.argv[1] in ['di', 'domaininfo']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
267 |
domain_info() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
268 |
elif sys.argv[1] in ['dt', 'domaintransport']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
269 |
domain_transport() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
270 |
elif sys.argv[1] in ['dd', 'domaindelete']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
271 |
domain_delete() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
272 |
elif sys.argv[1] in ['ua', 'useradd']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
273 |
user_add() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
274 |
elif sys.argv[1] in ['ui', 'userinfo']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
275 |
user_info() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
276 |
elif sys.argv[1] in ['un', 'username']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
277 |
user_name() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
278 |
elif sys.argv[1] in ['up', 'userpassword']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
279 |
user_password() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
280 |
elif sys.argv[1] in ['u0', 'userdisable']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
281 |
user_disable() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
282 |
elif sys.argv[1] in ['u1', 'userenable']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
283 |
user_enable() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
284 |
elif sys.argv[1] in ['ud', 'userdelete']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
285 |
user_delete() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
286 |
elif sys.argv[1] in ['aa', 'aliasadd']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
287 |
alias_add() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
288 |
elif sys.argv[1] in ['ai', 'aliasinfo']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
289 |
alias_info() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
290 |
elif sys.argv[1] in ['ad', 'aliasdelete']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
291 |
alias_delete() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
292 |
elif sys.argv[1] in ['h', 'help']: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
293 |
usage() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
294 |
elif sys.argv[1] in ['v', 'version']: |
4 | 295 |
print "%s, version %s (%s from %s)\n" % (__prog__, __version__, |
296 |
__revision__, __date__) |
|
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
297 |
else: |
2
9b39f828aa8a
* 'VirtualMailManager/Exceptions.py'
Pascal Volk <neverseen@users.sourceforge.net>
parents:
1
diff
changeset
|
298 |
usage(EXIT.UNKNOWN_OPTION, 'Unknown option: »%s«' % sys.argv[1]) |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
299 |
showWarnings() |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
300 |
except (EOFError, KeyboardInterrupt): |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
301 |
sys.stderr.write('\nOuch!\n') |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
302 |
sys.exit(EXIT.USER_INTERRUPT) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
303 |
except VMME.VMMException, e: |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
304 |
sys.stderr.write("\aERROR: %s\n" % e[0][0]) |
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
305 |
sys.exit(e[0][1]) |