File tree Expand file tree Collapse file tree 2 files changed +10
-9
lines changed
ansible_mitogen/plugins/connection Expand file tree Collapse file tree 2 files changed +10
-9
lines changed Original file line number Diff line number Diff line change 4545import ansible_mitogen .loaders
4646
4747
48- _class = ansible_mitogen .loaders .connection_loader__get (
48+ _get_result = ansible_mitogen .loaders .connection_loader__get (
4949 'kubectl' ,
5050 class_only = True ,
5151)
5252
53- if _class :
54- kubectl = sys .modules [_class .__module__ ]
55- del _class
56- else :
57- kubectl = None
58-
5953
6054class Connection (ansible_mitogen .connection .Connection ):
6155 transport = 'kubectl'
@@ -66,13 +60,19 @@ class Connection(ansible_mitogen.connection.Connection):
6660 )
6761
6862 def __init__ (self , * args , ** kwargs ):
69- if kubectl is None :
63+ if not _get_result :
7064 raise AnsibleConnectionFailure (self .not_supported_msg )
7165 super (Connection , self ).__init__ (* args , ** kwargs )
7266
7367 def get_extra_args (self ):
68+ try :
69+ # Ansible < 2.10, _get_result is the connection class
70+ connection_options = _get_result .connection_options
71+ except AttributeError :
72+ # Ansible >= 2.10, _get_result is a get_with_context_result
73+ connection_options = _get_result .object .connection_options
7474 parameters = []
75- for key , option in iteritems (kubectl . CONNECTION_OPTIONS ):
75+ for key , option in iteritems (connection_options ):
7676 if self .get_task_var ('ansible_' + key ) is not None :
7777 parameters += [ option , self .get_task_var ('ansible_' + key ) ]
7878
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ v0.3.1.dev0 (unreleased)
2828* :gh:issue: `873 ` `python -c ... ` first stage no longer uses :py:mod: `platform` ` to detect the macOS release
2929* :gh:issue: `876 ` `python -c ... ` first stage no longer contains tab characters, to reduce size
3030* :gh:issue: `878 ` Continuous Integration tests now correctly perform comparisons of 2 digit versions
31+ * :gh:issue: `878 ` Kubectl connector fixed with Ansible 2.10 and above
3132
3233
3334v0.3.0 (2021-11-24)
You can’t perform that action at this time.
0 commit comments