LinuxMonitor 1.3.8__tar.gz → 1.3.10__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LinuxMonitor
3
- Version: 1.3.8
3
+ Version: 1.3.10
4
4
  Summary: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)
5
5
  Home-page: https://github.com/QuentinCG/Linux-Monitor-Python-Library
6
6
  Author: Quentin Comte-Gaz
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: LinuxMonitor
3
- Version: 1.3.8
3
+ Version: 1.3.10
4
4
  Summary: Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)
5
5
  Home-page: https://github.com/QuentinCG/Linux-Monitor-Python-Library
6
6
  Author: Quentin Comte-Gaz
@@ -33,7 +33,7 @@ __email__ = "quentin@comte-gaz.com"
33
33
  __license__ = "MIT License"
34
34
  __copyright__ = "Copyright Quentin Comte-Gaz (2024)"
35
35
  __python_version__ = "3.+"
36
- __version__ = "1.3.8 (2024/09/19)"
36
+ __version__ = "1.3.10 (2024/09/23)"
37
37
  __status__ = "Usable for any Linux project"
38
38
 
39
39
  import json
@@ -196,6 +196,9 @@ class LinuxMonitor:
196
196
  md: str = ""
197
197
  indent: str = " " * level # type: ignore # Indentation for markdown headings
198
198
 
199
+ # Preprocess the input to convert single quotes to double quotes
200
+ json_string = re.sub(r"'", '"', json_string)
201
+
199
202
  # Parse the JSON string to a Python object
200
203
  try:
201
204
  data = json.loads(json_string)
@@ -212,11 +215,13 @@ class LinuxMonitor:
212
215
  md += f"{indent}- {key}\n"
213
216
  process_data(value, level + 1) # type: ignore
214
217
  elif isinstance(data, list):
215
- for index, item in enumerate(data): # type: ignore
216
- md += f"{indent}- Item {index + 1}\n"
217
- process_data(item, level + 1) # type: ignore
218
+ if not data: # Show "nothing" for empty lists
219
+ md += f"{indent}- Nothing\n"
220
+ else:
221
+ for item in data: # type: ignore
222
+ process_data(item, level) # Skip "Item" label # type: ignore
218
223
  else:
219
- md += f"{indent} - {data}\n"
224
+ md += f"{indent}- {data}\n"
220
225
 
221
226
  process_data(data, level)
222
227
 
@@ -295,6 +300,15 @@ class LinuxMonitor:
295
300
  if not display_only_if_critical:
296
301
  if not show_only_std_and_exception:
297
302
  out_msg = f" - ✅ **{display_name} executed successfully**"
303
+ else:
304
+ if stdout_str != "":
305
+ msg_stout: str = stdout_str
306
+ if is_stdout_json:
307
+ msg_stout = self._json_to_md(stdout_str)
308
+ if msg_stout != "":
309
+ if out_msg != "":
310
+ out_msg += "\n"
311
+ out_msg += f"```sh\n{msg_stout}\n```"
298
312
 
299
313
  if res == True:
300
314
  logging.info(msg=f"Command {display_name} (command {command}) executed successfully")
@@ -1873,14 +1887,16 @@ class LinuxMonitor:
1873
1887
  logging.info(msg=out_msg)
1874
1888
 
1875
1889
  if show_content_if_success:
1876
- out_msg += f"\n{res_msg}"
1890
+ if res_msg != "":
1891
+ out_msg += f"\n{res_msg}"
1877
1892
 
1878
1893
  elif res == False:
1879
1894
  out_msg = f"⚠️ **{display_name} failed to execute**."
1880
1895
  logging.warning(msg=out_msg)
1881
1896
 
1882
1897
  if show_content_if_issue:
1883
- out_msg += f"\n{res_msg}"
1898
+ if res_msg != "":
1899
+ out_msg += f"\n{res_msg}"
1884
1900
 
1885
1901
  else:
1886
1902
  out_msg = f"⚠️ **{display_name} expired**."
@@ -6,7 +6,7 @@ with io.open(file='README.md', mode='r', encoding='utf-8') as readme_file:
6
6
 
7
7
  setup(
8
8
  name="LinuxMonitor",
9
- version="1.3.8",
9
+ version="1.3.10",
10
10
  description="Get information and warning status of Linux server like service, port, ping, ssl certificate, disk/folder/cpu/ram/swap usage, ip connection, ... (Python and shell library, Linux ONLY)",
11
11
  long_description=readme,
12
12
  long_description_content_type="text/markdown",
File without changes
File without changes
File without changes