153 vmm.domain_transport(sys.argv[2].lower(), sys.argv[3]) |
153 vmm.domain_transport(sys.argv[2].lower(), sys.argv[3]) |
154 |
154 |
155 def user_add(): |
155 def user_add(): |
156 global argc |
156 global argc |
157 if argc < 3: |
157 if argc < 3: |
158 usage(EXIT.MISSING_ARGS, 'Missing email address.') |
158 usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
159 elif argc < 4: |
159 elif argc < 4: |
160 password = _readpass() |
160 password = _readpass() |
161 else: |
161 else: |
162 password = sys.argv[3] |
162 password = sys.argv[3] |
163 vmm.user_add(sys.argv[2].lower(), password) |
163 vmm.user_add(sys.argv[2].lower(), password) |
164 |
164 |
165 def user_delete(): |
165 def user_delete(): |
166 global argc |
166 global argc |
167 if argc < 3: |
167 if argc < 3: |
168 usage(EXIT.MISSING_ARGS, 'Missing email address.') |
168 usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
169 else: |
169 else: |
170 vmm.user_delete(sys.argv[2].lower()) |
170 vmm.user_delete(sys.argv[2].lower()) |
171 |
171 |
172 def user_info(): |
172 def user_info(): |
173 global argc |
173 global argc |
174 if argc < 3: |
174 if argc < 3: |
175 usage(EXIT.MISSING_ARGS, 'Missing email address.') |
175 usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
176 elif argc < 4: |
176 elif argc < 4: |
177 _printInfo(vmm.user_info(sys.argv[2].lower()), 'Account') |
177 _printInfo(vmm.user_info(sys.argv[2].lower()), 'Account') |
178 else: |
178 else: |
179 _printInfo(vmm.user_info(sys.argv[2].lower(), True), 'Account') |
179 _printInfo(vmm.user_info(sys.argv[2].lower(), True), 'Account') |
180 |
180 |
181 def user_name(): |
181 def user_name(): |
182 global argc |
182 global argc |
183 if argc < 3: |
183 if argc < 3: |
184 usage(EXIT.MISSING_ARGS, 'Missing email address and users name.') |
184 usage(EXIT.MISSING_ARGS, 'Missing e-mail address and users name.') |
185 if argc < 4: |
185 if argc < 4: |
186 usage(EXIT.MISSING_ARGS, 'Missing users name.') |
186 usage(EXIT.MISSING_ARGS, 'Missing users name.') |
187 else: |
187 else: |
188 vmm.user_name(sys.argv[2].lower(), sys.argv[3]) |
188 vmm.user_name(sys.argv[2].lower(), sys.argv[3]) |
189 |
189 |
190 def user_enable(): |
190 def user_enable(): |
191 global argc |
191 global argc |
192 if argc < 3: |
192 if argc < 3: |
193 usage(EXIT.MISSING_ARGS, 'Missing email address.') |
193 usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
194 else: |
194 else: |
195 vmm.user_enable(sys.argv[2].lower()) |
195 vmm.user_enable(sys.argv[2].lower()) |
196 |
196 |
197 def user_disable(): |
197 def user_disable(): |
198 global argc |
198 global argc |
199 if argc < 3: |
199 if argc < 3: |
200 usage(EXIT.MISSING_ARGS, 'Missing email address.') |
200 usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
201 else: |
201 else: |
202 vmm.user_disable(sys.argv[2].lower()) |
202 vmm.user_disable(sys.argv[2].lower()) |
203 |
203 |
204 def user_password(): |
204 def user_password(): |
205 global argc |
205 global argc |
206 if argc < 3: |
206 if argc < 3: |
207 usage(EXIT.MISSING_ARGS, 'Missing email address.') |
207 usage(EXIT.MISSING_ARGS, 'Missing e-mail address.') |
208 elif argc < 4: |
208 elif argc < 4: |
209 password = _readpass() |
209 password = _readpass() |
210 else: |
210 else: |
211 password = sys.argv[3] |
211 password = sys.argv[3] |
212 vmm.user_password(sys.argv[2].lower(), password) |
212 vmm.user_password(sys.argv[2].lower(), password) |