## `USERV_USER' environment variable.
with cli_errors():
- args = parse_options()
- if not args or args[0] != 'userv':
- raise U.ExpectedError, (500, 'missing userv token')
- CONF.loadconfig(OPTS.config)
- try: CU.set_user(ENV['USERV_USER'])
- except KeyError: raise ExpectedError, (500, 'USERV_USER unset')
with OUT.redirect_to(O.FileOutput()):
+ args = parse_options()
+ if not args or args[0] != 'userv':
+ raise U.ExpectedError, (500, 'missing userv token')
+ CONF.loadconfig(OPTS.config)
+ try: CU.set_user(ENV['USERV_USER'])
+ except KeyError: raise ExpectedError, (500, 'USERV_USER unset')
OPTPARSE.dispatch('userv', [ENV['USERV_SERVICE']] + args[1:])
elif 'SSH_ORIGINAL_COMMAND' in ENV:
## of telling us that this is a user request, so treat it like Userv.
with cli_errors():
- cmd = ssh_setup()
- CU.set_user(ENV['CHPWD_SSH_USER'])
with OUT.redirect_to(O.FileOutput()):
+ cmd = ssh_setup()
+ CU.set_user(ENV['CHPWD_SSH_USER'])
OPTPARSE.dispatch('userv', cmd)
elif 'CHPWD_SSH_MASTER' in ENV:
## a user.
try:
- cmd = ssh_setup()
with OUT.redirect_to(O.RemoteOutput()):
+ cmd = ssh_setup()
OPTPARSE.dispatch('remote', map(CGI.urldecode, cmd))
except U.ExpectedError, e:
print 'ERR', e.code, e.msg
## as we are.
with cli_errors():
- args = parse_options()
- CONF.loadconfig(OPTS.config)
- CGI.SSLP = OPTS.sslp
- ctx = OPTS.context
- if OPTS.user:
- CU.set_user(OPTS.user)
- CGI.STATE.kw['user'] = OPTS.user
- if ctx is None: ctx = 'userv'
- else:
- D.opendb()
- if ctx is None:
- ctx = 'admin'
- OPTPARSE.show_global_opts = True
with OUT.redirect_to(O.FileOutput()):
+ args = parse_options()
+ CONF.loadconfig(OPTS.config)
+ CGI.SSLP = OPTS.sslp
+ ctx = OPTS.context
+ if OPTS.user:
+ CU.set_user(OPTS.user)
+ CGI.STATE.kw['user'] = OPTS.user
+ if ctx is None: ctx = 'userv'
+ else:
+ D.opendb()
+ if ctx is None:
+ ctx = 'admin'
+ OPTPARSE.show_global_opts = True
OPTPARSE.dispatch(ctx, args)
###----- That's all, folks --------------------------------------------------