mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 04:40:22 -07:00
Add a Singleton metaclass, use it with Display (#48935)
* Add a Singleton class, use it with Display * update six import * Move remaining failes to display singleton * Fix rebase issues * Singleton improvements * Add code-smell for 'from __main__ import display'. ci_complete * s/self/cls/g * Add docs for no-main-display * Address linting issues * Add changelog fragment. ci_complete * Implement reentrant lock for class instantiation in Singleton * Add Display singleton porting guide
This commit is contained in:
parent
54a2f21f93
commit
9773a1f289
149 changed files with 407 additions and 766 deletions
|
@ -100,6 +100,7 @@ from ansible.module_utils.common._collections_compat import MutableMapping, Muta
|
|||
from ansible.module_utils.six import string_types, text_type
|
||||
from ansible.parsing.yaml.objects import AnsibleSequence, AnsibleUnicode
|
||||
from ansible.plugins.inventory import BaseFileInventoryPlugin
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
import toml
|
||||
|
@ -107,12 +108,7 @@ try:
|
|||
except ImportError:
|
||||
HAS_TOML = False
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
|
||||
display = Display()
|
||||
|
||||
WARNING_MSG = (
|
||||
'The TOML inventory format is marked as preview, which means that it is not guaranteed to have a backwards '
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue