mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-22 14:01:42 -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
|
@ -60,6 +60,7 @@ from ansible.plugins.httpapi import HttpApiBase
|
|||
from urllib3 import encode_multipart_formdata
|
||||
from urllib3.fields import RequestField
|
||||
from ansible.module_utils.connection import ConnectionError
|
||||
from ansible.utils.display import Display
|
||||
|
||||
BASE_HEADERS = {
|
||||
'Content-Type': 'application/json',
|
||||
|
@ -69,12 +70,7 @@ BASE_HEADERS = {
|
|||
TOKEN_EXPIRATION_STATUS_CODE = 408
|
||||
UNAUTHORIZED_STATUS_CODE = 401
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class HttpApi(HttpApiBase):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue