import dbmaint as D
import httpauth as HA
import output as O; OUT = O.OUT
+import service as S
import subcommand as SC
import util as U
'help': 'run commands with the given CONTEXT' }),
('-f', '--config-file', {
'metavar': 'FILE', 'dest': 'config',
- 'default': OS.path.join(HOME, 'chpwd.conf'),
+ 'default': ENV.get('CHPWD_CONFIG',
+ OS.path.join(HOME, 'chpwd.conf')),
'help': 'read configuration from FILE.' }),
('-s', '--ssl', {
'dest': 'sslp', 'action': 'store_true',
OPTS, args = OPTPARSE.parse_args()
CONF.loadconfig(OPTS.config)
cmd = SL.split(ENV['SSH_ORIGINAL_COMMAND'])
- if args: raise ExpectedError, (500, 'Unexpected arguments via SSH')
+ if args: raise U.ExpectedError, (500, 'Unexpected arguments via SSH')
return cmd
if 'CHPWD_SSH_USER' in ENV:
with cli_errors():
cmd = ssh_setup()
CU.set_user(ENV['CHPWD_SSH_USER'])
- SERVICES['master'].find(USER)
+ S.SERVICES['master'].find(CU.USER)
with OUT.redirect_to(O.FileOutput()):
OPTPARSE.dispatch('userv', cmd)
try:
cmd = ssh_setup()
with OUT.redirect_to(O.RemoteOutput()):
- OPTPARSE.dispatch('remote', map(urldecode, cmd))
- except ExpectedError, e:
+ OPTPARSE.dispatch('remote', map(CGI.urldecode, cmd))
+ except U.ExpectedError, e:
print 'ERR', e.code, e.msg
else:
print 'OK'
## file, but we can't do much about it from here.
with cli_errors():
- raise ExpectedError, (400, "Unabled to determine SSH context")
+ raise U.ExpectedError, (400, "Unabled to determine SSH context")
else:
## Plain old command line, apparently. We default to administration