Now passing ansible sanity tests

This commit is contained in:
Mark J. Horninger 2024-02-15 10:39:23 -05:00
parent 76642d2703
commit 166e281700
2 changed files with 14 additions and 6 deletions

View File

@ -60,18 +60,21 @@ DOCUMENTATION = r"""
EXAMPLES = r"""
"""
from ansible.errors import AnsibleError, AnsibleParserError
from ansible.errors import AnsibleError
# TODO: Re-enable if necessary
# , AnsibleParserError
from ansible.utils.display import Display
from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cacheable
# Specific for the NetbirdAPI Class
import requests
import json
# import json
display = Display()
class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
NAME="dominion_solutions.netbird"
NAME = "dominion_solutions.netbird"
def _build_client(self, loader):
"""Build the Netbird API Client"""
@ -148,11 +151,13 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
peer.label,
strict=strict)
### This is a very limited wrapper for the netbird API.
# This is a very limited wrapper for the netbird API.
class NetbirdApi:
def __init__ (self, api_key, api_url):
def __init__(self, api_key, api_url):
self.api_key = api_key
self.api_url = api_url
def ListPeers(self):
url = f"{self.api_url}/peers"
@ -163,6 +168,7 @@ class NetbirdApi:
response = requests.request("GET", url, headers=headers)
return response.text
class Peer:
def __init__(self, name, id, data):
self.name = name

View File

@ -6,7 +6,9 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
import sys
# TODO: Reenable this if needed.
# import sys
from ansible.errors import AnsibleError
from ansible.parsing.dataloader import DataLoader