Make OpenStack collections qualify for NewStylePlanner

To be detected as a NewStyle module mitogen expects that your module
imports ansible.module_utils. However the OpenStack collections modules
import a utility module which then imports ansible.module_utils.
Due to the naive way mitogen checks for this import the Openstack collections
modules do not qualify currently as being NewStyle as there is a layer of abstraction,
therefore causing them to fail down the line as they are run with the OldStylePlanner.
My fix is as equally naive!
pull/814/head
Georgina Shippey 4 years ago
parent 9b5c3326a7
commit b61788bfea

@ -301,6 +301,9 @@ class NewStylePlanner(ScriptPlanner):
@classmethod @classmethod
def detect(cls, path, source): def detect(cls, path, source):
if b'from ansible_collections.openstack.' in source:
cls.marker = b'from ansible_collections.openstack.'
LOG.debug('cls.marker: %r, source: %r', cls.marker, source)
return cls.marker in source return cls.marker in source
def _get_interpreter(self): def _get_interpreter(self):

Loading…
Cancel
Save