From 2470f486e1e121159dc9d660b1966b4766506ce2 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 1 Apr 2018 10:48:20 +0100 Subject: [PATCH] issue 106: ansible: make the context name available For use later to track/deduplicate streaming uploads to targets. --- ansible_mitogen/connection.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ansible_mitogen/connection.py b/ansible_mitogen/connection.py index a81a4bd6..bd0d79ff 100644 --- a/ansible_mitogen/connection.py +++ b/ansible_mitogen/connection.py @@ -257,6 +257,14 @@ class Connection(ansible.plugins.connection.ConnectionBase): else: self.context = self.host + def get_context_name(self): + """ + Return the name of the target context we issue commands against, i.e. a + unique string useful as a key for related data, such as a list of + modules uploaded to the target. + """ + return self.context.name + def close(self): """ Arrange for the mitogen.master.Router running in the worker to