fixes #827
some ansible collections write their own module classes derived from ansible.module_utils.basic.AnsibleModule, thus lacking that import in the plugin file. NewStylePlanner was unable to detect these plugins as Ansiballz. This commit extends the search pattern for NewStylePlanner to also detect ansible_collections imports.
This commit is contained in:
parent
36f3e3b28c
commit
a2dcedabda
|
@ -41,6 +41,7 @@ import json
|
|||
import logging
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
|
||||
from ansible.executor import module_common
|
||||
from ansible.collections.list import list_collection_dirs
|
||||
|
@ -297,11 +298,11 @@ class NewStylePlanner(ScriptPlanner):
|
|||
preprocessing the module.
|
||||
"""
|
||||
runner_name = 'NewStyleRunner'
|
||||
marker = b'from ansible.module_utils.'
|
||||
MARKER = re.compile(b'from ansible(?:_collections|\.module_utils)\.')
|
||||
|
||||
@classmethod
|
||||
def detect(cls, path, source):
|
||||
return cls.marker in source
|
||||
return cls.MARKER.search(source) != None
|
||||
|
||||
def _get_interpreter(self):
|
||||
return None, None
|
||||
|
|
Loading…
Reference in New Issue