mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-21 20:30:21 -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
|
@ -133,12 +133,7 @@ from ansible.module_utils.six import string_types
|
|||
from ansible.module_utils.ec2 import ansible_dict_to_boto3_filter_list, boto3_tag_list_to_ansible_dict
|
||||
from ansible.module_utils.ec2 import camel_dict_to_snake_dict
|
||||
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable, to_safe_group_name
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
import boto3
|
||||
|
@ -146,6 +141,8 @@ try:
|
|||
except ImportError:
|
||||
raise AnsibleError('The ec2 dynamic inventory plugin requires boto3 and botocore.')
|
||||
|
||||
display = Display()
|
||||
|
||||
# The mappings give an array of keys to get from the filter name to the value
|
||||
# returned by boto3's EC2 describe_instances method.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue