mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-04 23:44:00 -07:00
Port action plugins to global display
This commit is contained in:
parent
186e034515
commit
4c7128da17
4 changed files with 68 additions and 42 deletions
|
@ -24,6 +24,13 @@ from ansible.plugins.action import ActionBase
|
|||
from ansible.parsing.utils.addresses import parse_address
|
||||
from ansible.errors import AnsibleError
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
display = display
|
||||
except ImportError:
|
||||
from ansible.utils.display import Display
|
||||
display = Display()
|
||||
|
||||
|
||||
class ActionModule(ActionBase):
|
||||
''' Create inventory hosts and groups in the memory inventory'''
|
||||
|
@ -45,7 +52,7 @@ class ActionModule(ActionBase):
|
|||
|
||||
# Parse out any hostname:port patterns
|
||||
new_name = self._task.args.get('name', self._task.args.get('hostname', None))
|
||||
self._display.vv("creating host via 'add_host': hostname=%s" % new_name)
|
||||
display.vv("creating host via 'add_host': hostname=%s" % new_name)
|
||||
|
||||
name, port = parse_address(new_name, allow_ranges=False)
|
||||
if not name:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue