Changed some functions names and added _print_debug for all modules

This commit is contained in:
Enrique Martin 2023-08-10 14:07:57 +02:00
parent 6d62c38ee1
commit 0fed9f8749
9 changed files with 135 additions and 10 deletions

View File

@ -27,6 +27,20 @@ BSD = FREEBSD or OPENBSD or NETBSD
SUNOS = sys.platform.startswith(("sunos", "solaris")) SUNOS = sys.platform.startswith(("sunos", "solaris"))
AIX = sys.platform.startswith("aix") AIX = sys.platform.startswith("aix")
####
# Internal: Alias for output.print_debug function
#########################################################################################
def _print_debug(
var = "",
print_errors: bool = False
):
"""
Prints any list, dict, string, float or integer as a json
"""
from .output import print_debug
print_debug(var, print_errors)
#### ####
# Set a global variable with the specified name and assigns a value to it. # Set a global variable with the specified name and assigns a value to it.
######################################################################################### #########################################################################################

View File

@ -10,10 +10,24 @@ SUMMARY = {}
INFO = "" INFO = ""
MONITORING_DATA = [] MONITORING_DATA = []
####
# Internal: Alias for output.print_debug function
#########################################################################################
def _print_debug(
var = "",
print_errors: bool = False
):
"""
Prints any list, dict, string, float or integer as a json
"""
from .output import print_debug
print_debug(var, print_errors)
#### ####
# Set error level to value # Set error level to value
######################################################################################### #########################################################################################
def set_error_level( def set_disco_error_level(
value: int = 0 value: int = 0
): ):
""" """
@ -29,7 +43,7 @@ def set_error_level(
#### ####
# Set fixed value to summary key # Set fixed value to summary key
######################################################################################### #########################################################################################
def set_summary_value( def set_disco_summary_value(
key: str = "", key: str = "",
value = None value = None
): ):
@ -47,7 +61,7 @@ def set_summary_value(
#### ####
# Add value to summary key # Add value to summary key
######################################################################################### #########################################################################################
def add_summary_value( def add_disco_summary_value(
key: str = "", key: str = "",
value = None value = None
): ):
@ -70,7 +84,7 @@ def add_summary_value(
#### ####
# Set fixed value to info # Set fixed value to info
######################################################################################### #########################################################################################
def set_info_value( def set_disco_info_value(
value: str = "" value: str = ""
): ):
""" """
@ -86,7 +100,7 @@ def set_info_value(
#### ####
# Add data to info # Add data to info
######################################################################################### #########################################################################################
def add_info_value( def add_disco_info_value(
value: str = "" value: str = ""
): ):
""" """
@ -102,7 +116,7 @@ def add_info_value(
#### ####
# Set fixed value to monitoring data # Set fixed value to monitoring data
######################################################################################### #########################################################################################
def set_monitoring_data( def set_disco_monitoring_data(
data: list = [] data: list = []
): ):
""" """
@ -115,7 +129,7 @@ def set_monitoring_data(
#### ####
# Add value to monitoring data # Add value to monitoring data
######################################################################################### #########################################################################################
def add_monitoring_data( def add_disco_monitoring_data(
data: dict = {} data: dict = {}
): ):
""" """
@ -128,7 +142,7 @@ def add_monitoring_data(
#### ####
# Print JSON output and exit script # Print JSON output and exit script
######################################################################################### #########################################################################################
def print_output(): def disco_output():
""" """
Prints the JSON output and exits the script. Prints the JSON output and exits the script.

View File

@ -18,6 +18,20 @@ from binascii import unhexlify
_PASSWORD = "default_salt" _PASSWORD = "default_salt"
####
# Internal: Alias for output.print_debug function
#########################################################################################
def _print_debug(
var = "",
print_errors: bool = False
):
"""
Prints any list, dict, string, float or integer as a json
"""
from .output import print_debug
print_debug(var, print_errors)
#### ####
# Internal use only: Get AES cipher # Internal use only: Get AES cipher
######################################################################################### #########################################################################################

View File

@ -291,6 +291,20 @@ _ENT2CHR = {
# Construct the character to entity mapping. # Construct the character to entity mapping.
_CHR2ENT = {v: "&" + k + ";" for k, v in _ENT2CHR.items()} _CHR2ENT = {v: "&" + k + ";" for k, v in _ENT2CHR.items()}
####
# Internal: Alias for output.print_debug function
#########################################################################################
def _print_debug(
var = "",
print_errors: bool = False
):
"""
Prints any list, dict, string, float or integer as a json
"""
from .output import print_debug
print_debug(var, print_errors)
#### ####
# Convert the input_string encoded in html entity to clear char string. # Convert the input_string encoded in html entity to clear char string.
######################################################################################### #########################################################################################
@ -367,8 +381,8 @@ def generate_md5(
######################################################################################### #########################################################################################
def now( def now(
print_flag: bool = False, utimestamp: bool = False,
utimestamp: bool = False print_flag: bool = False
) -> str: ) -> str:
""" """
Returns time in yyyy/mm/dd HH:MM:SS format by default. Use 1 as an argument Returns time in yyyy/mm/dd HH:MM:SS format by default. Use 1 as an argument

View File

@ -3,6 +3,20 @@ from requests.auth import HTTPBasicAuth
from requests.auth import HTTPDigestAuth from requests.auth import HTTPDigestAuth
from requests.sessions import Session from requests.sessions import Session
####
# Internal: Alias for output.print_debug function
#########################################################################################
def _print_debug(
var = "",
print_errors: bool = False
):
"""
Prints any list, dict, string, float or integer as a json
"""
from .output import print_debug
print_debug(var, print_errors)
#### ####
# Auth URL session # Auth URL session
######################################################################################### #########################################################################################

View File

@ -1,3 +1,17 @@
####
# Internal: Alias for output.print_debug function
#########################################################################################
def _print_debug(
var = "",
print_errors: bool = False
):
"""
Prints any list, dict, string, float or integer as a json
"""
from .output import print_debug
print_debug(var, print_errors)
#### ####
# Init module template # Init module template
######################################################################################### #########################################################################################

View File

@ -2,6 +2,19 @@ import sys
import os import os
import json import json
####
# Internal: Alias for output.print_debug function
#########################################################################################
def _print_debug(
var = "",
print_errors: bool = False
):
"""
Prints any list, dict, string, float or integer as a json
"""
print_debug(var, print_errors)
#### ####
# Prints message in stdout # Prints message in stdout
######################################################################################### #########################################################################################

View File

@ -11,6 +11,20 @@ _MANAGER = Manager()
_SHARED_DICT = _MANAGER.dict() _SHARED_DICT = _MANAGER.dict()
_SHARED_DICT_LOCK = _MANAGER.Lock() _SHARED_DICT_LOCK = _MANAGER.Lock()
####
# Internal: Alias for output.print_debug function
#########################################################################################
def _print_debug(
var = "",
print_errors: bool = False
):
"""
Prints any list, dict, string, float or integer as a json
"""
from .output import print_debug
print_debug(var, print_errors)
#### ####
# Internal use only: Run a given function in a thread # Internal use only: Run a given function in a thread
######################################################################################### #########################################################################################

View File

@ -20,6 +20,20 @@ GLOBAL_VARIABLES = {
'tentacle_extra_opts' : '' 'tentacle_extra_opts' : ''
} }
####
# Internal: Alias for output.print_debug function
#########################################################################################
def _print_debug(
var = "",
print_errors: bool = False
):
"""
Prints any list, dict, string, float or integer as a json
"""
from .output import print_debug
print_debug(var, print_errors)
#### ####
# Set a global variable with the specified name and assigns a value to it. # Set a global variable with the specified name and assigns a value to it.
######################################################################################### #########################################################################################