mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02: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
2
changelogs/fragments/display-singleton.yaml
Normal file
2
changelogs/fragments/display-singleton.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- Display - Add a ``Singleton`` metaclass and apply it to ``Display`` to remove the need of using ``__main__.Display`` as a pseudo singleton
|
|
@ -236,12 +236,9 @@ Here's a simple lookup plugin implementation --- this lookup returns the content
|
|||
"""
|
||||
from ansible.errors import AnsibleError, AnsibleParserError
|
||||
from ansible.plugins.lookup import LookupBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class LookupModule(LookupBase):
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
Sanity Tests » no-main-display
|
||||
==============================
|
||||
|
||||
As of Ansible 2.8, ``Display`` should no longer be imported from ``__main__``.
|
||||
|
||||
``Display`` is now a singleton and should be utilized like the following::
|
||||
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
|
||||
There is no longer a need to attempt ``from __main__ import display`` inside
|
||||
a ``try/except`` block.
|
|
@ -332,8 +332,8 @@ As a simple example we are going to make a hybrid ``fileglob`` lookup plugin.
|
|||
from ansible.utils import (listify_lookup_plugin_terms, path_dwim, warning)
|
||||
except ImportError:
|
||||
# ansible-2.0
|
||||
from __main__ import display
|
||||
warning = display.warning
|
||||
from ansible.utils.display import Display
|
||||
warning = Display().warning
|
||||
|
||||
class LookupModule(LookupBase):
|
||||
|
||||
|
|
|
@ -124,7 +124,28 @@ Plugins
|
|||
Porting custom scripts
|
||||
======================
|
||||
|
||||
No notable changes.
|
||||
Display class
|
||||
-------------
|
||||
|
||||
As of Ansible 2.8, the ``Display`` class is now a "singleton". Instead of using ``__main__.display`` each file should
|
||||
import and instantiate ``ansible.utils.display.Display`` on it's own.
|
||||
|
||||
**OLD** In Ansible 2.7 (and earlier) the following was used to access the ``display`` object:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
|
||||
**NEW** In Ansible 2.8 the following should be used:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
|
||||
Networking
|
||||
==========
|
||||
|
|
|
@ -40,16 +40,13 @@ from ansible.module_utils.six import with_metaclass, string_types
|
|||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
from ansible.release import __version__
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.path import unfrackpath
|
||||
from ansible.utils.vars import load_extra_vars, load_options_vars
|
||||
from ansible.vars.manager import VariableManager
|
||||
from ansible.parsing.vault import PromptVaultSecret, get_file_vault_secret
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class SortedOptParser(optparse.OptionParser):
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
########################################################
|
||||
|
||||
from ansible import constants as C
|
||||
from ansible.cli import CLI
|
||||
from ansible.errors import AnsibleError, AnsibleOptionsError
|
||||
|
@ -29,16 +27,11 @@ from ansible.parsing.splitter import parse_kv
|
|||
from ansible.playbook import Playbook
|
||||
from ansible.playbook.play import Play
|
||||
from ansible.plugins.loader import get_all_plugin_loaders
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
########################################################
|
||||
|
||||
class AdHocCLI(CLI):
|
||||
''' is an extra-simple tool/framework/API for doing 'remote things'.
|
||||
this command allows you to define and run a single task 'playbook' against a set of hosts
|
||||
|
|
|
@ -16,14 +16,10 @@ from ansible.errors import AnsibleError, AnsibleOptionsError
|
|||
from ansible.module_utils._text import to_native, to_text
|
||||
from ansible.parsing.yaml.dumper import AnsibleDumper
|
||||
from ansible.utils.color import stringc
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.path import unfrackpath
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ConfigCLI(CLI):
|
||||
|
|
|
@ -46,12 +46,9 @@ from ansible.playbook.play import Play
|
|||
from ansible.plugins.loader import module_loader, fragment_loader
|
||||
from ansible.utils import plugin_docs
|
||||
from ansible.utils.color import stringc
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ConsoleCLI(CLI, cmd.Cmd):
|
||||
|
|
|
@ -35,13 +35,10 @@ from ansible.parsing.metadata import extract_metadata
|
|||
from ansible.parsing.plugin_docs import read_docstub
|
||||
from ansible.parsing.yaml.dumper import AnsibleDumper
|
||||
from ansible.plugins.loader import action_loader, fragment_loader
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.plugin_docs import BLACKLIST, get_docstring
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class DocCLI(CLI):
|
||||
|
|
|
@ -41,12 +41,9 @@ from ansible.galaxy.role import GalaxyRole
|
|||
from ansible.galaxy.token import GalaxyToken
|
||||
from ansible.module_utils._text import to_native, to_text
|
||||
from ansible.playbook.role.requirement import RoleRequirement
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class GalaxyCLI(CLI):
|
||||
|
|
|
@ -27,12 +27,9 @@ from ansible.inventory.host import Host
|
|||
from ansible.plugins.loader import vars_loader
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
from ansible.utils.vars import combine_vars
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
INTERNAL_VARS = frozenset(['ansible_diff_mode',
|
||||
'ansible_facts',
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
########################################################
|
||||
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
|
@ -28,12 +26,9 @@ from ansible.errors import AnsibleError, AnsibleOptionsError
|
|||
from ansible.executor.playbook_executor import PlaybookExecutor
|
||||
from ansible.playbook.block import Block
|
||||
from ansible.playbook.play_context import PlayContext
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class PlaybookCLI(CLI):
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
########################################################
|
||||
import datetime
|
||||
import os
|
||||
import platform
|
||||
|
@ -34,16 +33,11 @@ from ansible.errors import AnsibleOptionsError
|
|||
from ansible.module_utils._text import to_native, to_text
|
||||
from ansible.plugins.loader import module_loader
|
||||
from ansible.utils.cmd_functions import run_cmd
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
########################################################
|
||||
|
||||
class PullCLI(CLI):
|
||||
''' is used to up a remote copy of ansible on each managed node,
|
||||
each set to run via cron and update playbook source via a source repository.
|
||||
|
|
|
@ -28,12 +28,9 @@ from ansible.errors import AnsibleOptionsError
|
|||
from ansible.module_utils._text import to_text, to_bytes
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
from ansible.parsing.vault import VaultEditor, VaultLib, match_encrypt_secret
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class VaultCLI(CLI):
|
||||
|
|
|
@ -20,8 +20,8 @@ from ansible.config.manager import ConfigManager, ensure_type, get_ini_config_va
|
|||
def _warning(msg):
|
||||
''' display is not guaranteed here, nor it being the full class, but try anyways, fallback to sys.stderr.write '''
|
||||
try:
|
||||
from __main__ import display
|
||||
display.warning(msg)
|
||||
from ansible.utils.display import Display
|
||||
Display().warning(msg)
|
||||
except Exception:
|
||||
import sys
|
||||
sys.stderr.write(' [WARNING] %s\n' % (msg))
|
||||
|
@ -30,8 +30,8 @@ def _warning(msg):
|
|||
def _deprecated(msg, version='2.8'):
|
||||
''' display is not guaranteed here, nor it being the full class, but try anyways, fallback to sys.stderr.write '''
|
||||
try:
|
||||
from __main__ import display
|
||||
display.deprecated(msg, version=version)
|
||||
from ansible.utils.display import Display
|
||||
Display().deprecated(msg, version=version)
|
||||
except Exception:
|
||||
import sys
|
||||
sys.stderr.write(' [DEPRECATED] %s, to be removed in %s\n' % (msg, version))
|
||||
|
|
|
@ -42,12 +42,9 @@ from ansible.plugins.loader import module_utils_loader
|
|||
# variable to the object and then it never gets updated.
|
||||
from ansible.executor import action_write_locks
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
from ansible.utils.display import Display
|
||||
|
||||
display = Display()
|
||||
|
||||
REPLACER = b"#<<INCLUDE_ANSIBLE_MODULE_COMMON>>"
|
||||
REPLACER_VERSION = b"\"<<ANSIBLE_VERSION>>\""
|
||||
|
|
|
@ -26,13 +26,10 @@ from ansible.module_utils.six import iteritems
|
|||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
from ansible.playbook.block import Block
|
||||
from ansible.playbook.task import Task
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
__all__ = ['PlayIterator']
|
||||
|
|
|
@ -30,12 +30,9 @@ from ansible.utils.helpers import pct_to_int
|
|||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
from ansible.utils.path import makedirs_safe
|
||||
from ansible.utils.ssh_functions import check_for_controlpersist
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class PlaybookExecutor:
|
||||
|
|
|
@ -40,15 +40,12 @@ from ansible.errors import AnsibleConnectionFailure
|
|||
from ansible.executor.task_executor import TaskExecutor
|
||||
from ansible.executor.task_result import TaskResult
|
||||
from ansible.module_utils._text import to_text
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
from ansible.utils.display import Display
|
||||
|
||||
__all__ = ['WorkerProcess']
|
||||
|
||||
display = Display()
|
||||
|
||||
|
||||
class WorkerProcess(multiprocessing.Process):
|
||||
'''
|
||||
|
|
|
@ -25,13 +25,10 @@ from ansible.template import Templar
|
|||
from ansible.utils.listify import listify_lookup_plugin_terms
|
||||
from ansible.utils.unsafe_proxy import UnsafeProxy, wrap_var
|
||||
from ansible.vars.clean import namespace_facts, clean_facts
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.vars import combine_vars
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
__all__ = ['TaskExecutor']
|
||||
|
|
|
@ -38,16 +38,13 @@ from ansible.template import Templar
|
|||
from ansible.utils.helpers import pct_to_int
|
||||
from ansible.vars.hostvars import HostVars
|
||||
from ansible.vars.reserved import warn_if_reserved
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
__all__ = ['TaskQueueManager']
|
||||
|
||||
display = Display()
|
||||
|
||||
|
||||
class TaskQueueManager:
|
||||
|
||||
|
|
|
@ -32,12 +32,9 @@ from ansible.module_utils.six.moves.urllib.error import HTTPError
|
|||
from ansible.module_utils.six.moves.urllib.parse import quote as urlquote, urlencode
|
||||
from ansible.module_utils._text import to_bytes, to_native, to_text
|
||||
from ansible.module_utils.urls import open_url
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
def g_connect(method):
|
||||
|
|
|
@ -31,12 +31,9 @@ from ansible.module_utils.six.moves.urllib.parse import quote as urlquote, urlpa
|
|||
from ansible.module_utils.six.moves.urllib.error import HTTPError
|
||||
from ansible.module_utils.urls import open_url
|
||||
from ansible.utils.color import stringc
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class GalaxyLogin(object):
|
||||
|
|
|
@ -36,12 +36,9 @@ from ansible.module_utils._text import to_native, to_text
|
|||
from ansible.module_utils.urls import open_url
|
||||
from ansible.playbook.role.requirement import RoleRequirement
|
||||
from ansible.galaxy.api import GalaxyAPI
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class GalaxyRole(object):
|
||||
|
|
|
@ -26,11 +26,9 @@ from stat import S_IRUSR, S_IWUSR
|
|||
|
||||
import yaml
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
from ansible.utils.display import Display
|
||||
|
||||
display = Display()
|
||||
|
||||
|
||||
class GalaxyToken(object):
|
||||
|
|
|
@ -26,14 +26,11 @@ from ansible.errors import AnsibleError
|
|||
from ansible.inventory.group import Group
|
||||
from ansible.inventory.host import Host
|
||||
from ansible.module_utils.six import iteritems, string_types
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.vars import combine_vars
|
||||
from ansible.utils.path import basedir
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class InventoryData(object):
|
||||
|
|
|
@ -32,12 +32,9 @@ from ansible.module_utils._text import to_bytes, to_text
|
|||
from ansible.parsing.utils.addresses import parse_address
|
||||
from ansible.plugins.loader import inventory_loader
|
||||
from ansible.utils.path import unfrackpath
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
IGNORED_ALWAYS = [br"^\.", b"^host_vars$", b"^group_vars$", b"^vars_plugins$"]
|
||||
IGNORED_PATTERNS = [to_bytes(x) for x in C.INVENTORY_IGNORE_PATTERNS]
|
||||
|
|
|
@ -21,12 +21,9 @@ from ansible.parsing.quoting import unquote
|
|||
from ansible.parsing.utils.yaml import from_yaml
|
||||
from ansible.parsing.vault import VaultLib, b_HEADER, is_encrypted, is_encrypted_file, parse_vaulttext_envelope
|
||||
from ansible.utils.path import unfrackpath
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
# Tries to determine if a path is inside a role, last dir must be 'tasks'
|
||||
|
|
|
@ -11,12 +11,9 @@ import yaml
|
|||
from ansible.module_utils._text import to_text
|
||||
from ansible.parsing.metadata import extract_metadata
|
||||
from ansible.parsing.yaml.loader import AnsibleLoader
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
def read_docstring(filename, verbose=True, ignore_errors=True):
|
||||
|
|
|
@ -75,13 +75,10 @@ from ansible.module_utils.six import PY3, binary_type
|
|||
# Note: on py2, this zip is izip not the list based zip() builtin
|
||||
from ansible.module_utils.six.moves import zip
|
||||
from ansible.module_utils._text import to_bytes, to_text, to_native
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.path import makedirs_safe
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
b_HEADER = b'$ANSIBLE_VAULT'
|
||||
|
|
|
@ -27,12 +27,9 @@ from ansible.parsing.yaml.objects import AnsibleMapping, AnsibleSequence, Ansibl
|
|||
from ansible.parsing.yaml.objects import AnsibleVaultEncryptedUnicode
|
||||
from ansible.utils.unsafe_proxy import wrap_var
|
||||
from ansible.parsing.vault import VaultLib
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class AnsibleConstructor(SafeConstructor):
|
||||
|
|
|
@ -27,12 +27,9 @@ from ansible.module_utils._text import to_text, to_native
|
|||
from ansible.playbook.play import Play
|
||||
from ansible.playbook.playbook_include import PlaybookInclude
|
||||
from ansible.plugins.loader import get_all_plugin_loaders
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
__all__ = ['Playbook']
|
||||
|
|
|
@ -21,12 +21,9 @@ from ansible.module_utils._text import to_text, to_native
|
|||
from ansible.playbook.attribute import Attribute, FieldAttribute
|
||||
from ansible.parsing.dataloader import DataLoader
|
||||
from ansible.utils.vars import combine_vars, isidentifier, get_unique_id
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
def _generic_g(prop_name, self):
|
||||
|
|
|
@ -22,12 +22,9 @@ __metaclass__ = type
|
|||
from ansible import constants as C
|
||||
from ansible.errors import AnsibleParserError
|
||||
from ansible.playbook.attribute import FieldAttribute
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class Become:
|
||||
|
|
|
@ -29,13 +29,9 @@ from ansible.errors import AnsibleError, AnsibleUndefinedVariable
|
|||
from ansible.module_utils.six import text_type
|
||||
from ansible.module_utils._text import to_native
|
||||
from ansible.playbook.attribute import FieldAttribute
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
|
||||
display = Display()
|
||||
|
||||
DEFINED_REGEX = re.compile(r'(hostvars\[.+\]|[\w_]+)\s+(not\s+is|is|is\s+not)\s+(defined|undefined)')
|
||||
LOOKUP_REGEX = re.compile(r'lookup\s*\(')
|
||||
|
|
|
@ -25,12 +25,9 @@ from ansible.errors import AnsibleParserError, AnsibleUndefinedVariable, Ansible
|
|||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.parsing.mod_args import ModuleArgsParser
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
def load_list_of_blocks(ds, play, parent_block=None, role=None, task_include=None, use_handlers=False, variable_manager=None, loader=None):
|
||||
|
|
|
@ -24,12 +24,9 @@ import os
|
|||
from ansible.playbook.task_include import TaskInclude
|
||||
from ansible.playbook.role_include import IncludeRole
|
||||
from ansible.template import Templar
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class IncludedFile:
|
||||
|
|
|
@ -30,12 +30,9 @@ from ansible.playbook.helpers import load_list_of_blocks, load_list_of_roles
|
|||
from ansible.playbook.role import Role
|
||||
from ansible.playbook.taggable import Taggable
|
||||
from ansible.vars.manager import preprocess_vars
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
__all__ = ['Play']
|
||||
|
|
|
@ -37,14 +37,11 @@ from ansible.module_utils.parsing.convert_bool import boolean
|
|||
from ansible.playbook.attribute import FieldAttribute
|
||||
from ansible.playbook.base import Base
|
||||
from ansible.plugins import get_plugin_class
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.ssh_functions import check_for_controlpersist
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
__all__ = ['PlayContext']
|
||||
|
|
|
@ -32,16 +32,12 @@ from ansible.playbook.conditional import Conditional
|
|||
from ansible.playbook.taggable import Taggable
|
||||
from ansible.template import Templar
|
||||
from ansible.utils.path import unfrackpath
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
|
||||
from ansible.utils.display import Display
|
||||
|
||||
__all__ = ['RoleDefinition']
|
||||
|
||||
display = Display()
|
||||
|
||||
|
||||
class RoleDefinition(Base, Become, Conditional, Taggable):
|
||||
|
||||
|
|
|
@ -31,11 +31,10 @@ from ansible.module_utils._text import to_native
|
|||
from ansible.module_utils.common.process import get_bin_path
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.playbook.role.definition import RoleDefinition
|
||||
|
||||
from ansible.utils.display import Display
|
||||
|
||||
__all__ = ['RoleRequirement']
|
||||
|
||||
|
||||
VALID_SPEC_KEYS = [
|
||||
'name',
|
||||
'role',
|
||||
|
@ -44,11 +43,7 @@ VALID_SPEC_KEYS = [
|
|||
'version',
|
||||
]
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class RoleRequirement(RoleDefinition):
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#
|
||||
# This file is part of Ansible
|
||||
#
|
||||
|
@ -27,15 +26,12 @@ from ansible.playbook.block import Block
|
|||
from ansible.playbook.task_include import TaskInclude
|
||||
from ansible.playbook.role import Role
|
||||
from ansible.playbook.role.include import RoleInclude
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
from ansible.utils.display import Display
|
||||
|
||||
__all__ = ['IncludeRole']
|
||||
|
||||
display = Display()
|
||||
|
||||
|
||||
class IncludeRole(TaskInclude):
|
||||
|
||||
|
|
|
@ -36,16 +36,12 @@ from ansible.playbook.conditional import Conditional
|
|||
from ansible.playbook.loop_control import LoopControl
|
||||
from ansible.playbook.role import Role
|
||||
from ansible.playbook.taggable import Taggable
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
from ansible.utils.display import Display
|
||||
|
||||
__all__ = ['Task']
|
||||
|
||||
display = Display()
|
||||
|
||||
|
||||
class Task(Base, Conditional, Taggable, Become):
|
||||
|
||||
|
|
|
@ -24,15 +24,12 @@ from ansible.errors import AnsibleParserError
|
|||
from ansible.playbook.attribute import FieldAttribute
|
||||
from ansible.playbook.block import Block
|
||||
from ansible.playbook.task import Task
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
from ansible.utils.display import Display
|
||||
|
||||
__all__ = ['TaskInclude']
|
||||
|
||||
display = Display()
|
||||
|
||||
|
||||
class TaskInclude(Task):
|
||||
|
||||
|
|
|
@ -25,12 +25,9 @@ from abc import ABCMeta
|
|||
|
||||
from ansible import constants as C
|
||||
from ansible.module_utils.six import with_metaclass, string_types
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
# Global so that all instances of a PluginLoader will share the caches
|
||||
MODULE_CACHE = {}
|
||||
|
|
|
@ -26,15 +26,12 @@ from ansible.module_utils.six.moves import shlex_quote
|
|||
from ansible.module_utils._text import to_bytes, to_native, to_text
|
||||
from ansible.parsing.utils.jsonify import jsonify
|
||||
from ansible.release import __version__
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.unsafe_proxy import wrap_var
|
||||
from ansible.vars.clean import remove_internal_keys
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionBase(with_metaclass(ABCMeta, object)):
|
||||
|
|
|
@ -24,12 +24,9 @@ from ansible.errors import AnsibleError
|
|||
from ansible.module_utils.six import string_types
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.parsing.utils.addresses import parse_address
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
|
|
@ -28,13 +28,9 @@ from ansible.module_utils.connection import Connection
|
|||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.aireos.aireos import aireos_provider_spec
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -28,12 +28,9 @@ from ansible.module_utils.connection import Connection
|
|||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.aruba.aruba import aruba_provider_spec
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -27,13 +27,9 @@ from ansible import constants as C
|
|||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.asa.asa import asa_provider_spec
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -28,17 +28,14 @@ from ansible.module_utils._text import to_text
|
|||
from ansible.module_utils.connection import Connection
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from library.module_utils.network.f5.common import f5_provider_spec
|
||||
except:
|
||||
from ansible.module_utils.network.f5.common import f5_provider_spec
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -28,17 +28,14 @@ from ansible.module_utils._text import to_text
|
|||
from ansible.module_utils.connection import Connection
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from library.module_utils.network.f5.common import f5_provider_spec
|
||||
except:
|
||||
from ansible.module_utils.network.f5.common import f5_provider_spec
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -28,13 +28,9 @@ from ansible.module_utils.connection import Connection
|
|||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.cloudengine.ce import ce_provider_spec
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
CLI_SUPPORTED_MODULES = ['ce_config', 'ce_command']
|
||||
|
||||
|
|
|
@ -26,13 +26,9 @@ from ansible.module_utils.network.cnos.cnos import cnos_provider_spec
|
|||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.module_utils.connection import Connection
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -30,12 +30,9 @@ from ansible.module_utils.connection import Connection
|
|||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.module_utils.network.dellos10.dellos10 import dellos10_provider_spec
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -30,12 +30,9 @@ from ansible.module_utils.connection import Connection
|
|||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.dellos6.dellos6 import dellos6_provider_spec
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -30,12 +30,9 @@ from ansible.module_utils.connection import Connection
|
|||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.module_utils.network.dellos9.dellos9 import dellos9_provider_spec
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -26,13 +26,9 @@ from ansible.module_utils.network.enos.enos import enos_provider_spec
|
|||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.module_utils.connection import Connection
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -28,12 +28,9 @@ from ansible.module_utils.connection import Connection
|
|||
from ansible.module_utils.network.eos.eos import eos_provider_spec
|
||||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -25,14 +25,11 @@ from ansible.module_utils._text import to_bytes
|
|||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.hashing import checksum, checksum_s, md5, secure_hash
|
||||
from ansible.utils.path import makedirs_safe
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
|
|
@ -28,12 +28,9 @@ from ansible.module_utils.connection import Connection, ConnectionError
|
|||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.module_utils.network.ios.ios import ios_provider_spec
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -28,12 +28,9 @@ from ansible.module_utils.connection import Connection
|
|||
from ansible.module_utils.network.iosxr.iosxr import iosxr_provider_spec
|
||||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -28,12 +28,9 @@ from ansible.module_utils.connection import Connection, ConnectionError
|
|||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.module_utils.network.ironware.ironware import ironware_provider_spec
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -29,13 +29,9 @@ from ansible.module_utils.network.common.utils import load_provider
|
|||
from ansible.module_utils.network.junos.junos import junos_provider_spec
|
||||
from ansible.plugins.loader import connection_loader, module_loader
|
||||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
CLI_SUPPORTED_MODULES = ['junos_netconf', 'junos_command']
|
||||
|
||||
|
|
|
@ -28,14 +28,11 @@ from ansible.plugins.action import ActionBase
|
|||
from ansible.plugins.action.nxos import ActionModule as _NxosActionModule
|
||||
from ansible.plugins.action.eos import ActionModule as _EosActionModule
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.utils.display import Display
|
||||
|
||||
from imp import find_module, load_module
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
_CLI_ONLY_MODULES = frozenset(['junos_netconf', 'iosxr_netconf', 'iosxr_config', 'iosxr_command'])
|
||||
_NETCONF_SUPPORTED_PLATFORMS = frozenset(['junos', 'iosxr'])
|
||||
|
|
|
@ -29,12 +29,9 @@ from ansible.module_utils.connection import Connection
|
|||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlsplit
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
|
|
@ -30,12 +30,9 @@ from ansible.module_utils.connection import Connection
|
|||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlsplit
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
|
|
@ -23,12 +23,9 @@ import copy
|
|||
import sys
|
||||
|
||||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -29,12 +29,9 @@ from ansible.module_utils.connection import Connection
|
|||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.module_utils.network.nxos.nxos import nxos_provider_spec
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -19,12 +19,9 @@ __metaclass__ = type
|
|||
|
||||
from ansible.errors import AnsibleAction, AnsibleActionFail
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
|
|
@ -30,12 +30,9 @@ from ansible.module_utils._text import to_text, to_native
|
|||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
from ansible.module_utils.six import PY3
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
try:
|
||||
import curses
|
||||
|
|
|
@ -13,13 +13,9 @@ from datetime import datetime, timedelta
|
|||
from ansible.errors import AnsibleError, AnsibleConnectionFailure
|
||||
from ansible.module_utils._text import to_native, to_text
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class TimedOutException(Exception):
|
||||
|
|
|
@ -26,12 +26,9 @@ from ansible import constants as C
|
|||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.module_utils.network.sros.sros import sros_provider_spec
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -11,12 +11,9 @@ from time import sleep
|
|||
from ansible.module_utils._text import to_native, to_bytes
|
||||
from ansible.module_utils.six import text_type
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
|
|
@ -28,12 +28,9 @@ from ansible.module_utils._text import to_text
|
|||
from ansible.module_utils.connection import Connection
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.module_utils.network.vyos.vyos import vyos_provider_spec
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
|
|
|
@ -24,12 +24,9 @@ from datetime import datetime, timedelta
|
|||
|
||||
from ansible.module_utils._text import to_text
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class TimedOutException(Exception):
|
||||
|
|
|
@ -10,12 +10,9 @@ from ansible.errors import AnsibleError
|
|||
from ansible.module_utils._text import to_native
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.plugins.action.reboot import ActionModule as RebootActionModule
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class TimedOutException(Exception):
|
||||
|
|
|
@ -8,12 +8,9 @@ from ansible.module_utils._text import to_text
|
|||
from ansible.module_utils.parsing.convert_bool import boolean
|
||||
from ansible.parsing.yaml.objects import AnsibleUnicode
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
|
|
@ -18,12 +18,9 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
|
|
7
lib/ansible/plugins/cache/__init__.py
vendored
7
lib/ansible/plugins/cache/__init__.py
vendored
|
@ -28,12 +28,9 @@ from ansible.module_utils.six import with_metaclass
|
|||
from ansible.module_utils._text import to_bytes
|
||||
from ansible.module_utils.common._collections_compat import MutableMapping
|
||||
from ansible.plugins.loader import cache_loader
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class BaseCacheModule(with_metaclass(ABCMeta, object)):
|
||||
|
|
|
@ -32,13 +32,10 @@ from ansible.module_utils.common._collections_compat import MutableMapping
|
|||
from ansible.parsing.ajson import AnsibleJSONEncoder
|
||||
from ansible.plugins import AnsiblePlugin, get_plugin_class
|
||||
from ansible.utils.color import stringc
|
||||
from ansible.utils.display import Display
|
||||
from ansible.vars.clean import strip_internal_keys
|
||||
|
||||
try:
|
||||
from __main__ import display as global_display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
global_display = Display()
|
||||
global_display = Display()
|
||||
|
||||
try:
|
||||
from __main__ import cli
|
||||
|
|
|
@ -31,15 +31,13 @@ from ansible.module_utils.six import binary_type, text_type
|
|||
from ansible.module_utils.common._collections_compat import MutableMapping, MutableSequence
|
||||
from ansible.plugins.callback.default import CallbackModule as CallbackModule_default
|
||||
from ansible.utils.color import colorize, hostcolor
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
from ansible.utils.display import Display
|
||||
|
||||
import sys
|
||||
|
||||
display = Display()
|
||||
|
||||
|
||||
# Design goals:
|
||||
#
|
||||
# + On screen there should only be relevant stuff
|
||||
|
|
|
@ -25,7 +25,7 @@ from functools import wraps
|
|||
from ansible.plugins import AnsiblePlugin
|
||||
from ansible.errors import AnsibleError, AnsibleConnectionFailure
|
||||
from ansible.module_utils._text import to_bytes, to_text
|
||||
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from scp import SCPClient
|
||||
|
@ -33,11 +33,7 @@ try:
|
|||
except ImportError:
|
||||
HAS_SCP = False
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
def enable_mode(func):
|
||||
|
|
|
@ -27,12 +27,9 @@ from itertools import chain
|
|||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.module_utils.network.common.utils import to_list
|
||||
from ansible.plugins.cliconf import CliconfBase, enable_mode
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class Cliconf(CliconfBase):
|
||||
|
|
|
@ -18,13 +18,10 @@ from ansible.module_utils.six import string_types
|
|||
from ansible.module_utils._text import to_bytes, to_text
|
||||
from ansible.plugins import AnsiblePlugin
|
||||
from ansible.plugins.loader import shell_loader, connection_loader
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.path import unfrackpath
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
__all__ = ['ConnectionBase', 'ensure_connect']
|
||||
|
|
|
@ -49,13 +49,9 @@ import subprocess
|
|||
import ansible.constants as C
|
||||
from ansible.module_utils._text import to_bytes, to_native
|
||||
from ansible.plugins.connection import ConnectionBase, ensure_connect
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
# this _has to be_ named Connection
|
||||
|
|
|
@ -46,13 +46,9 @@ from ansible.module_utils.basic import is_executable
|
|||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.module_utils._text import to_bytes
|
||||
from ansible.plugins.connection import ConnectionBase, BUFSIZE
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class Connection(ConnectionBase):
|
||||
|
|
|
@ -52,13 +52,9 @@ from ansible.errors import AnsibleError, AnsibleFileNotFound
|
|||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.module_utils._text import to_bytes, to_native, to_text
|
||||
from ansible.plugins.connection import ConnectionBase, BUFSIZE
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class Connection(ConnectionBase):
|
||||
|
|
|
@ -38,12 +38,9 @@ import tempfile
|
|||
import shutil
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class Connection(object):
|
||||
|
|
|
@ -156,12 +156,9 @@ from ansible.module_utils.urls import open_url
|
|||
from ansible.playbook.play_context import PlayContext
|
||||
from ansible.plugins.loader import cliconf_loader, httpapi_loader
|
||||
from ansible.plugins.connection import NetworkConnectionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class Connection(NetworkConnectionBase):
|
||||
|
|
|
@ -35,12 +35,9 @@ import subprocess
|
|||
from ansible.plugins.connection.jail import Connection as Jail
|
||||
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class Connection(Jail):
|
||||
|
|
|
@ -42,12 +42,9 @@ from ansible.errors import AnsibleError
|
|||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.module_utils._text import to_bytes, to_native, to_text
|
||||
from ansible.plugins.connection import ConnectionBase, BUFSIZE
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class Connection(ConnectionBase):
|
||||
|
|
|
@ -167,13 +167,9 @@ from ansible.errors import AnsibleError, AnsibleFileNotFound
|
|||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.module_utils._text import to_bytes
|
||||
from ansible.plugins.connection import ConnectionBase, BUFSIZE
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
CONNECTION_TRANSPORT = 'kubectl'
|
||||
|
|
|
@ -36,13 +36,9 @@ from ansible.errors import AnsibleError
|
|||
from ansible.module_utils.six.moves import shlex_quote
|
||||
from ansible.module_utils._text import to_bytes
|
||||
from ansible.plugins.connection import ConnectionBase, BUFSIZE
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class Connection(ConnectionBase):
|
||||
|
|
|
@ -28,13 +28,9 @@ from ansible.errors import AnsibleError, AnsibleFileNotFound
|
|||
from ansible.module_utils.six import text_type, binary_type
|
||||
from ansible.module_utils._text import to_bytes, to_native, to_text
|
||||
from ansible.plugins.connection import ConnectionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class Connection(ConnectionBase):
|
||||
|
|
|
@ -131,6 +131,7 @@ options:
|
|||
|
||||
from ansible.errors import AnsibleConnectionFailure, AnsibleError
|
||||
from ansible.plugins.connection import NetworkConnectionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from napalm import get_network_driver
|
||||
|
@ -142,11 +143,7 @@ except ImportError:
|
|||
'Please run pip install napalm'
|
||||
)
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class Connection(NetworkConnectionBase):
|
||||
|
|
|
@ -181,6 +181,7 @@ from ansible.module_utils._text import to_bytes, to_native, to_text
|
|||
from ansible.module_utils.parsing.convert_bool import BOOLEANS_TRUE, BOOLEANS_FALSE
|
||||
from ansible.plugins.loader import netconf_loader
|
||||
from ansible.plugins.connection import NetworkConnectionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from ncclient import manager
|
||||
|
@ -190,11 +191,7 @@ try:
|
|||
except ImportError:
|
||||
raise AnsibleError("ncclient is not installed")
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
logging.getLogger('ncclient').setLevel(logging.INFO)
|
||||
|
||||
|
|
|
@ -192,12 +192,9 @@ from ansible.module_utils._text import to_bytes, to_text
|
|||
from ansible.playbook.play_context import PlayContext
|
||||
from ansible.plugins.connection import NetworkConnectionBase
|
||||
from ansible.plugins.loader import cliconf_loader, terminal_loader, connection_loader
|
||||
from ansible.utils.display import Display
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
class AnsibleCmdRespRecv(Exception):
|
||||
|
|
|
@ -144,14 +144,11 @@ from ansible.errors import AnsibleError, AnsibleConnectionFailure, AnsibleFileNo
|
|||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.six.moves import input
|
||||
from ansible.plugins.connection import ConnectionBase
|
||||
from ansible.utils.display import Display
|
||||
from ansible.utils.path import makedirs_safe
|
||||
from ansible.module_utils._text import to_bytes, to_native, to_text
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
display = Display()
|
||||
|
||||
|
||||
AUTHENTICITY_MSG = """
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue