pandoraPlugintools-basic 1.0.1__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pandoraplugintools_basic-1.0.1/pandoraPlugintools_basic.egg-info → pandoraplugintools_basic-1.0.3}/PKG-INFO +1 -1
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/agents.py +7 -1
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/modules.py +43 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3/pandoraPlugintools_basic.egg-info}/PKG-INFO +1 -1
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/setup.cfg +1 -1
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/setup.py +1 -1
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/LICENSE +0 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/README.md +0 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/__init__.py +0 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/discovery.py +0 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/general.py +0 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/output.py +0 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/threads.py +0 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/transfer.py +0 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools_basic.egg-info/SOURCES.txt +0 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools_basic.egg-info/dependency_links.txt +0 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools_basic.egg-info/top_level.txt +0 -0
- {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/tests/test_basic.py +0 -0
{pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/agents.py
RENAMED
|
@@ -328,6 +328,7 @@ def init_agent(default_values: dict = {}) -> dict:
|
|
|
328
328
|
"group": _GLOBAL_VARIABLES["agents_group_name"],
|
|
329
329
|
"interval": _GLOBAL_VARIABLES["interval"],
|
|
330
330
|
"agent_mode": "1",
|
|
331
|
+
"extra_data": None,
|
|
331
332
|
}
|
|
332
333
|
|
|
333
334
|
for key, value in default_values.items():
|
|
@@ -346,6 +347,7 @@ def print_agent(
|
|
|
346
347
|
log_modules: list = [],
|
|
347
348
|
log_encoding: str = False,
|
|
348
349
|
print_flag: bool = False,
|
|
350
|
+
image_modules: list = []
|
|
349
351
|
) -> str:
|
|
350
352
|
"""
|
|
351
353
|
Print the XML representation of an agent.
|
|
@@ -354,13 +356,14 @@ def print_agent(
|
|
|
354
356
|
agent (dict): A dictionary containing agent configuration.
|
|
355
357
|
modules (list): A list of dictionaries representing modules.
|
|
356
358
|
log_modules (list): A list of dictionaries representing log modules.
|
|
359
|
+
image_modules (list): A list of dictionaries representing image modules.
|
|
357
360
|
log_encoding (str): The encoding format used when printing log modules
|
|
358
361
|
print_flag (bool): A flag indicating whether to print the XML representation.
|
|
359
362
|
|
|
360
363
|
Returns:
|
|
361
364
|
str: The XML representation of the agent.
|
|
362
365
|
"""
|
|
363
|
-
from .modules import print_log_module, print_module
|
|
366
|
+
from .modules import print_log_module, print_module, print_img_module
|
|
364
367
|
from .output import print_stdout
|
|
365
368
|
|
|
366
369
|
xml = ""
|
|
@@ -383,6 +386,9 @@ def print_agent(
|
|
|
383
386
|
modules_xml = print_log_module(log_module, encoding=log_encoding)
|
|
384
387
|
xml += str(modules_xml)
|
|
385
388
|
|
|
389
|
+
for image_module in image_modules:
|
|
390
|
+
xml += str(print_img_module(image_module))
|
|
391
|
+
|
|
386
392
|
xml += "</agent_data>"
|
|
387
393
|
|
|
388
394
|
if print_flag:
|
{pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/modules.py
RENAMED
|
@@ -346,3 +346,46 @@ def print_log_module(
|
|
|
346
346
|
|
|
347
347
|
return module_xml
|
|
348
348
|
|
|
349
|
+
####
|
|
350
|
+
# Returns img module in XML format.
|
|
351
|
+
#########################################################################################
|
|
352
|
+
def print_img_module(
|
|
353
|
+
module: dict = None,
|
|
354
|
+
print_flag: bool = False,
|
|
355
|
+
) -> str:
|
|
356
|
+
"""
|
|
357
|
+
Returns image module in XML format. Accepts only {dict}.
|
|
358
|
+
|
|
359
|
+
- Only works with one module at a time: otherwise iteration is needed.
|
|
360
|
+
- The module "value" field must contain a base64-encoded image string.
|
|
361
|
+
- The function automatically prefixes the value with a valid data URI schema for PNG images.
|
|
362
|
+
- Use print_flag to optionally output the generated XML.
|
|
363
|
+
|
|
364
|
+
Args:
|
|
365
|
+
module (dict, optional): Dictionary representing the image module. Expected keys:
|
|
366
|
+
- source (optional, if used by print_module)
|
|
367
|
+
- value (base64 image string)
|
|
368
|
+
print_flag (bool, optional): Flag indicating whether to print the XML. Defaults to False.
|
|
369
|
+
|
|
370
|
+
Returns:
|
|
371
|
+
str: XML representation of the image module with embedded base64 data URI.
|
|
372
|
+
"""
|
|
373
|
+
from .output import print_stdout
|
|
374
|
+
|
|
375
|
+
if module is None:
|
|
376
|
+
return ""
|
|
377
|
+
|
|
378
|
+
data = dict(module)
|
|
379
|
+
|
|
380
|
+
if "value" in data:
|
|
381
|
+
data["value"] = f"data:image/png;base64,{data['value']}"
|
|
382
|
+
|
|
383
|
+
module_xml = print_module(
|
|
384
|
+
module=data,
|
|
385
|
+
print_flag=False
|
|
386
|
+
)
|
|
387
|
+
|
|
388
|
+
if print_flag:
|
|
389
|
+
print_stdout(module_xml)
|
|
390
|
+
|
|
391
|
+
return module_xml
|
|
@@ -8,7 +8,7 @@ with open("README.md", mode="r", encoding="utf-8") as f:
|
|
|
8
8
|
|
|
9
9
|
setup(
|
|
10
10
|
name="pandoraPlugintools-basic",
|
|
11
|
-
version="1.0.
|
|
11
|
+
version="1.0.3",
|
|
12
12
|
author="PandoraFMS projects department",
|
|
13
13
|
author_email="<info@pandorafms.com>",
|
|
14
14
|
description="A plugin tool set of basic functions for pandorafms",
|
|
File without changes
|
|
File without changes
|
{pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/__init__.py
RENAMED
|
File without changes
|
{pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/discovery.py
RENAMED
|
File without changes
|
{pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/general.py
RENAMED
|
File without changes
|
{pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/output.py
RENAMED
|
File without changes
|
{pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/threads.py
RENAMED
|
File without changes
|
{pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.3}/pandoraPlugintools/transfer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|