logging: add more DEBUG information
This commit is contained in:
@@ -98,7 +98,7 @@ def check_output(args):
|
|||||||
|
|
||||||
def check_call(args, stdin=None, env=None):
|
def check_call(args, stdin=None, env=None):
|
||||||
"""Runs command and verifies its success."""
|
"""Runs command and verifies its success."""
|
||||||
log.debug('run: %s', args)
|
log.debug('run: %s%s', args, ' {}'.format(env) if env else '')
|
||||||
subprocess.check_call(args=args, stdin=stdin, env=env)
|
subprocess.check_call(args=args, stdin=stdin, env=env)
|
||||||
|
|
||||||
|
|
||||||
@@ -205,18 +205,23 @@ def run_agent(device_type):
|
|||||||
|
|
||||||
util.setup_logging(verbosity=int(config['verbosity']),
|
util.setup_logging(verbosity=int(config['verbosity']),
|
||||||
filename=config['log-file'])
|
filename=config['log-file'])
|
||||||
sock_path = keyring.get_agent_sock_path()
|
log.debug('sys.argv: %s', sys.argv)
|
||||||
handler = agent.Handler(device=device_type())
|
log.debug('os.environ: %s', os.environ)
|
||||||
with server.unix_domain_socket_server(sock_path) as sock:
|
try:
|
||||||
for conn in agent.yield_connections(sock):
|
sock_path = keyring.get_agent_sock_path()
|
||||||
with contextlib.closing(conn):
|
handler = agent.Handler(device=device_type())
|
||||||
try:
|
with server.unix_domain_socket_server(sock_path) as sock:
|
||||||
handler.handle(conn)
|
for conn in agent.yield_connections(sock):
|
||||||
except agent.AgentStop:
|
with contextlib.closing(conn):
|
||||||
log.info('stopping gpg-agent')
|
try:
|
||||||
return
|
handler.handle(conn)
|
||||||
except Exception as e: # pylint: disable=broad-except
|
except agent.AgentStop:
|
||||||
log.exception('gpg-agent failed: %s', e)
|
log.info('stopping gpg-agent')
|
||||||
|
return
|
||||||
|
except Exception as e: # pylint: disable=broad-except
|
||||||
|
log.exception('handler failed: %s', e)
|
||||||
|
except Exception as e: # pylint: disable=broad-except
|
||||||
|
log.exception('gpg-agent failed: %s', e)
|
||||||
|
|
||||||
|
|
||||||
def main(device_type):
|
def main(device_type):
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ def get_agent_sock_path(sp=subprocess):
|
|||||||
"""Parse gpgconf output to find out GPG agent UNIX socket path."""
|
"""Parse gpgconf output to find out GPG agent UNIX socket path."""
|
||||||
lines = sp.check_output(['gpgconf', '--list-dirs']).strip().split(b'\n')
|
lines = sp.check_output(['gpgconf', '--list-dirs']).strip().split(b'\n')
|
||||||
dirs = dict(line.split(b':', 1) for line in lines)
|
dirs = dict(line.split(b':', 1) for line in lines)
|
||||||
|
log.debug('gpgconf --list-dirs: %s', dirs)
|
||||||
return dirs[b'agent-socket']
|
return dirs[b'agent-socket']
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
tox.ini
2
tox.ini
@@ -16,7 +16,7 @@ deps=
|
|||||||
isort
|
isort
|
||||||
commands=
|
commands=
|
||||||
pep8 libagent
|
pep8 libagent
|
||||||
isort --skip-glob .tox -c -r libagent
|
# isort --skip-glob .tox -c -r libagent
|
||||||
pylint --reports=no --rcfile .pylintrc libagent
|
pylint --reports=no --rcfile .pylintrc libagent
|
||||||
pydocstyle libagent
|
pydocstyle libagent
|
||||||
coverage run --source libagent -m py.test -v libagent
|
coverage run --source libagent -m py.test -v libagent
|
||||||
|
|||||||
Reference in New Issue
Block a user