pandoraPlugintools-basic 1.0.1__tar.gz → 1.0.2__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.
Files changed (18) hide show
  1. {pandoraplugintools_basic-1.0.1/pandoraPlugintools_basic.egg-info → pandoraplugintools_basic-1.0.2}/PKG-INFO +1 -1
  2. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/pandoraPlugintools/agents.py +5 -1
  3. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/pandoraPlugintools/modules.py +43 -0
  4. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2/pandoraPlugintools_basic.egg-info}/PKG-INFO +1 -1
  5. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/setup.cfg +1 -1
  6. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/setup.py +1 -1
  7. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/LICENSE +0 -0
  8. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/README.md +0 -0
  9. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/pandoraPlugintools/__init__.py +0 -0
  10. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/pandoraPlugintools/discovery.py +0 -0
  11. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/pandoraPlugintools/general.py +0 -0
  12. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/pandoraPlugintools/output.py +0 -0
  13. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/pandoraPlugintools/threads.py +0 -0
  14. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/pandoraPlugintools/transfer.py +0 -0
  15. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/pandoraPlugintools_basic.egg-info/SOURCES.txt +0 -0
  16. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/pandoraPlugintools_basic.egg-info/dependency_links.txt +0 -0
  17. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/pandoraPlugintools_basic.egg-info/top_level.txt +0 -0
  18. {pandoraplugintools_basic-1.0.1 → pandoraplugintools_basic-1.0.2}/tests/test_basic.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pandoraPlugintools-basic
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: A plugin tool set of basic functions for pandorafms
5
5
  Home-page: https://github.com/pandorafms/pandoraPlugintoolsBasic
6
6
  Author: PandoraFMS projects department
@@ -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():
@@ -360,7 +361,7 @@ def print_agent(
360
361
  Returns:
361
362
  str: The XML representation of the agent.
362
363
  """
363
- from .modules import print_log_module, print_module
364
+ from .modules import print_log_module, print_module, print_img_module
364
365
  from .output import print_stdout
365
366
 
366
367
  xml = ""
@@ -383,6 +384,9 @@ def print_agent(
383
384
  modules_xml = print_log_module(log_module, encoding=log_encoding)
384
385
  xml += str(modules_xml)
385
386
 
387
+ for image_module in image_modules:
388
+ xml += str(print_img_module(image_module))
389
+
386
390
  xml += "</agent_data>"
387
391
 
388
392
  if print_flag:
@@ -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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pandoraPlugintools-basic
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: A plugin tool set of basic functions for pandorafms
5
5
  Home-page: https://github.com/pandorafms/pandoraPlugintoolsBasic
6
6
  Author: PandoraFMS projects department
@@ -1,7 +1,7 @@
1
1
  [metadata]
2
2
  license_file = LICENSE
3
3
  description_file = README.md
4
- version = 1.0.1
4
+ version = 1.0.2
5
5
 
6
6
  [egg_info]
7
7
  tag_build =
@@ -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.1",
11
+ version="1.0.2",
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",