mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
New base class for HttpApi plugins (#41915)
This commit is contained in:
parent
a8d4bf8642
commit
97ffb4c4d2
4 changed files with 83 additions and 50 deletions
|
@ -9,6 +9,7 @@ import json
|
|||
from ansible.module_utils._text import to_text
|
||||
from ansible.module_utils.connection import ConnectionError
|
||||
from ansible.module_utils.network.common.utils import to_list
|
||||
from ansible.plugins.httpapi import HttpApiBase
|
||||
|
||||
try:
|
||||
from __main__ import display
|
||||
|
@ -17,14 +18,12 @@ except ImportError:
|
|||
display = Display()
|
||||
|
||||
|
||||
class HttpApi:
|
||||
def __init__(self, connection):
|
||||
self.connection = connection
|
||||
|
||||
class HttpApi(HttpApiBase):
|
||||
def _run_queue(self, queue, output):
|
||||
if self._become:
|
||||
display.vvvv('firing event: on_become')
|
||||
queue.insert(0, 'enable')
|
||||
|
||||
request = request_builder(queue, output)
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
|
||||
|
@ -74,10 +73,6 @@ class HttpApi:
|
|||
return responses[0]
|
||||
return responses
|
||||
|
||||
def set_become(self, play_context):
|
||||
self._become = play_context.become
|
||||
self._become_pass = getattr(play_context, 'become_pass') or ''
|
||||
|
||||
# Migrated from module_utils
|
||||
def edit_config(self, command):
|
||||
resp = list()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue