Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dmw'
Browse files Browse the repository at this point in the history
* origin/dmw:
  docs: update Changelog.
  tests/ansible: Spec.port() test & mitogen_via= fix.
  Update copyright year everywhere.
  tests/ansible: Spec.become_pass() test.
  docs: remove top "Table of Contents" link
  docs: remove a little more top margin wastage
  tests/ansible: Spec.become_user() test.
  docs: update Changelog; closes #539.
  issue #539: disable logger propagation.
  • Loading branch information
dw committed Feb 13, 2019
2 parents 20f96d0 + c39ee9b commit 6727402
Show file tree
Hide file tree
Showing 61 changed files with 449 additions and 67 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2017, David Wilson
Copyright 2019, David Wilson

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/affinity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/connection.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/loaders.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
29 changes: 16 additions & 13 deletions ansible_mitogen/logging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -75,25 +75,28 @@ def emit(self, record):

def setup():
"""
Install a handler for Mitogen's logger to redirect it into the Ansible
display framework, and prevent propagation to the root logger.
Install handlers for Mitogen loggers to redirect them into the Ansible
display framework. Ansible installs its own logging framework handlers when
C.DEFAULT_LOG_PATH is set, therefore disable propagation for our handlers.
"""
logging.getLogger('ansible_mitogen').handlers = [Handler(display.vvv)]
mitogen.core.LOG.handlers = [Handler(display.vvv)]
mitogen.core.IOLOG.handlers = [Handler(display.vvvv)]
mitogen.core.IOLOG.propagate = False
l_mitogen = logging.getLogger('mitogen')
l_mitogen_io = logging.getLogger('mitogen.io')
l_ansible_mitogen = logging.getLogger('ansible_mitogen')

for logger in l_mitogen, l_mitogen_io, l_ansible_mitogen:
logger.handlers = [Handler(display.vvv)]
logger.propagate = False

if display.verbosity > 2:
mitogen.core.LOG.setLevel(logging.DEBUG)
logging.getLogger('ansible_mitogen').setLevel(logging.DEBUG)
l_ansible_mitogen.setLevel(logging.DEBUG)
l_mitogen.setLevel(logging.DEBUG)
else:
# Mitogen copies the active log level into new children, allowing them
# to filter tiny messages before they hit the network, and therefore
# before they wake the IO loop. Explicitly setting INFO saves ~4%
# running against just the local machine.
mitogen.core.LOG.setLevel(logging.ERROR)
logging.getLogger('ansible_mitogen').setLevel(logging.ERROR)
l_mitogen.setLevel(logging.ERROR)
l_ansible_mitogen.setLevel(logging.ERROR)

if display.verbosity > 3:
mitogen.core.IOLOG.setLevel(logging.DEBUG)
logging.getLogger('ansible_mitogen').setLevel(logging.DEBUG)
l_mitogen_io.setLevel(logging.DEBUG)
2 changes: 1 addition & 1 deletion ansible_mitogen/mixins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/module_finder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/parsing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/planner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/action/mitogen_get_stack.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/connection/mitogen_doas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/connection/mitogen_docker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/connection/mitogen_jail.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/connection/mitogen_local.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/connection/mitogen_lxc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/connection/mitogen_lxd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/connection/mitogen_machinectl.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/connection/mitogen_setns.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/connection/mitogen_ssh.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/connection/mitogen_su.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/connection/mitogen_sudo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/strategy/mitogen.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/strategy/mitogen_free.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/strategy/mitogen_host_pinned.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/plugins/strategy/mitogen_linear.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/process.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/runner.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/services.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/strategy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion ansible_mitogen/target.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
4 changes: 2 additions & 2 deletions ansible_mitogen/transport_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down Expand Up @@ -497,7 +497,6 @@ def become_user(self):

def become_pass(self):
return optional_secret(
# TODO: Might have to come from PlayContext.
self._host_vars.get('ansible_become_password') or
self._host_vars.get('ansible_become_pass')
)
Expand All @@ -510,6 +509,7 @@ def password(self):

def port(self):
return (
self._host_vars.get('ansible_ssh_port') or
self._host_vars.get('ansible_port') or
C.DEFAULT_REMOTE_PORT
)
Expand Down
4 changes: 4 additions & 0 deletions docs/_static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ body {
font-size: 100%;
}

.sphinxsidebarwrapper {
padding-top: 0 !important;
}

.sphinxsidebar {
font-size: 80% !important;
}
Expand Down
1 change: 1 addition & 0 deletions docs/_templates/globaltoc.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ toctree() }}
6 changes: 6 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ Fixes
* `#538 <https://github.com/dw/mitogen/issues/538>`_: the Mitogen source
distribution includes a requisite ``LICENSE`` file.

* `#539 <https://github.com/dw/mitogen/issues/539>`_: log output is no longer
duplicated when the Ansible ``log_path`` setting is enabled.

* `#540 <https://github.com/dw/mitogen/issues/540>`_: the ``stderr`` stream of
async module invocations was previously discarded.

Expand All @@ -158,6 +161,9 @@ Fixes
``ansible_become_method`` variable is respected when ``mitogen_via=`` is
active.

* `7fd0d349 <https://github.com/dw/mitogen/commit/7fd0d349>`_: the
``ansible_ssh_port`` variable is respected when ``mitogen_via=`` is active.


Thanks!
~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion mitogen/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/core.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/debug.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/doas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/docker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/fakessh.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/fork.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/jail.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/lxc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/lxd.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/master.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/parent.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/profiler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/select.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/setns.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/ssh.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/su.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/sudo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion mitogen/unix.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017, David Wilson
# Copyright 2019, David Wilson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
Expand Down
Loading

0 comments on commit 6727402

Please sign in to comment.