command_watcher 0.5.0__tar.gz → 0.6.0__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,24 +1,25 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: command_watcher
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: Module to watch the execution of shell scripts. Both streams (`stdout` and `stderr`) are captured.
5
- Home-page: https://github.com/Josef-Friedrich/command-watcher
6
- License: MIT
7
5
  Author: Josef Friedrich
8
- Author-email: josef@friedrich.rocks
9
- Requires-Python: >=3.10,<4.0
6
+ Author-email: Josef Friedrich <josef@friedrich.rocks>
7
+ License-Expression: MIT
10
8
  Classifier: Development Status :: 5 - Production/Stable
11
9
  Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3 :: Only
12
11
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
12
  Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: 3 :: Only
17
- Requires-Dist: conf2levels (>=0,<1)
18
- Requires-Dist: pretiac (>=0,<1)
19
- Requires-Dist: termcolor (>=1,<2)
20
- Requires-Dist: types-requests (>=2,<3)
21
- Requires-Dist: types-termcolor (>=1,<2)
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Programming Language :: Python :: 3.14
15
+ Requires-Dist: pretiac>=0.6.0
16
+ Requires-Dist: pydantic>=2.12.5
17
+ Requires-Dist: pyyaml>=6.0.3
18
+ Requires-Dist: termcolor>=3.3.0
19
+ Requires-Dist: types-pyyaml>=6.0.12.20250915
20
+ Requires-Dist: types-requests>=2.32.4.20260107
21
+ Requires-Dist: types-termcolor>=1.1.6.2
22
+ Requires-Python: >=3.12, <4
22
23
  Project-URL: Repository, https://github.com/Josef-Friedrich/command-watcher
23
24
  Description-Content-Type: text/x-rst
24
25
 
@@ -48,20 +49,22 @@ and `stderr`) are captured.
48
49
 
49
50
  .. code-block:: python
50
51
 
52
+ #! /opt/venvs/command_watcher/bin/python
53
+
51
54
  from command_watcher import Watch
52
55
  watch = Watch(
53
- config_file='/etc/command-watcher.ini',
56
+ config_file='/etc/command-watcher.yml',
54
57
  service_name='texlive_update'
55
58
  )
56
59
 
57
60
  tlmgr = '/usr/local/texlive/bin/x86_64-linux/tlmgr'
58
61
 
59
- watch.run('{} update --self'.format(tlmgr))
60
- watch.run('{} update --all'.format(tlmgr))
62
+ watch.run(f'{tlmgr} update --self')
63
+ watch.run(f'{tlmgr} update --all')
61
64
  installed_packages = watch.run(
62
- '{} info --only-installed'.format(tlmgr), log=False
65
+ f'{tlmgr} info --only-installed', log=False
63
66
  )
64
- all_packages = watch.run('{} info'.format(tlmgr), log=False)
67
+ all_packages = watch.run(f'{tlmgr} info', log=False)
65
68
 
66
69
  watch.final_report(
67
70
  status=0,
@@ -71,28 +74,29 @@ and `stderr`) are captured.
71
74
  },
72
75
  )
73
76
 
74
- .. code-block:: ini
75
-
76
- [email]
77
- subject_prefix = [cwatcher]
78
- from_addr =
79
- to_addr = logs@example.com
80
- to_addr_critical = critical@example.com
81
- smtp_login = mailer
82
- smtp_password = 1234
83
- smtp_server = mail.example.com:587
84
-
85
- [nsca]
86
- remote_host = 1.2.3.4
87
- password = asdf1234
88
- encryption_method = 8
89
- ; port = 5667
90
-
91
- [icinga]
92
- url = https://icinga.example.com:5665
93
- user = user
94
- password = 1234
95
-
96
- [beep]
97
- activated = True
98
-
77
+ .. code-block:: yaml
78
+
79
+ ---
80
+ email:
81
+ from_addr: logs@example.com
82
+ to_addr: logs@example.com
83
+ to_addr_critical: critical@example.com
84
+ smtp_login: mailer@mail.example.com
85
+ smtp_password: abcd
86
+ smtp_server: mail.example.com:587
87
+
88
+ icinga:
89
+ api_endpoint_host: localhost
90
+ api_endpoint_port: 5665
91
+ client_private_key: /etc/pretiac/api-client.key.pem
92
+ client_certificate: /etc/pretiac/api-client.cert.pem
93
+ ca_certificate: /etc/pretiac/ca.crt
94
+ new_host_defaults:
95
+ templates: [passive-host]
96
+ new_service_defaults:
97
+ templates: [passive-service]
98
+ attrs:
99
+ check_interval: monthly
100
+
101
+ beep:
102
+ activated: true
@@ -24,20 +24,22 @@ and `stderr`) are captured.
24
24
 
25
25
  .. code-block:: python
26
26
 
27
+ #! /opt/venvs/command_watcher/bin/python
28
+
27
29
  from command_watcher import Watch
28
30
  watch = Watch(
29
- config_file='/etc/command-watcher.ini',
31
+ config_file='/etc/command-watcher.yml',
30
32
  service_name='texlive_update'
31
33
  )
32
34
 
33
35
  tlmgr = '/usr/local/texlive/bin/x86_64-linux/tlmgr'
34
36
 
35
- watch.run('{} update --self'.format(tlmgr))
36
- watch.run('{} update --all'.format(tlmgr))
37
+ watch.run(f'{tlmgr} update --self')
38
+ watch.run(f'{tlmgr} update --all')
37
39
  installed_packages = watch.run(
38
- '{} info --only-installed'.format(tlmgr), log=False
40
+ f'{tlmgr} info --only-installed', log=False
39
41
  )
40
- all_packages = watch.run('{} info'.format(tlmgr), log=False)
42
+ all_packages = watch.run(f'{tlmgr} info', log=False)
41
43
 
42
44
  watch.final_report(
43
45
  status=0,
@@ -47,27 +49,29 @@ and `stderr`) are captured.
47
49
  },
48
50
  )
49
51
 
50
- .. code-block:: ini
51
-
52
- [email]
53
- subject_prefix = [cwatcher]
54
- from_addr =
55
- to_addr = logs@example.com
56
- to_addr_critical = critical@example.com
57
- smtp_login = mailer
58
- smtp_password = 1234
59
- smtp_server = mail.example.com:587
52
+ .. code-block:: yaml
60
53
 
61
- [nsca]
62
- remote_host = 1.2.3.4
63
- password = asdf1234
64
- encryption_method = 8
65
- ; port = 5667
54
+ ---
55
+ email:
56
+ from_addr: logs@example.com
57
+ to_addr: logs@example.com
58
+ to_addr_critical: critical@example.com
59
+ smtp_login: mailer@mail.example.com
60
+ smtp_password: abcd
61
+ smtp_server: mail.example.com:587
66
62
 
67
- [icinga]
68
- url = https://icinga.example.com:5665
69
- user = user
70
- password = 1234
63
+ icinga:
64
+ api_endpoint_host: localhost
65
+ api_endpoint_port: 5665
66
+ client_private_key: /etc/pretiac/api-client.key.pem
67
+ client_certificate: /etc/pretiac/api-client.cert.pem
68
+ ca_certificate: /etc/pretiac/ca.crt
69
+ new_host_defaults:
70
+ templates: [passive-host]
71
+ new_service_defaults:
72
+ templates: [passive-service]
73
+ attrs:
74
+ check_interval: monthly
71
75
 
72
- [beep]
73
- activated = True
76
+ beep:
77
+ activated: true
@@ -0,0 +1,49 @@
1
+ [project]
2
+ name = "command_watcher"
3
+ version = "0.6.0"
4
+ description = "Module to watch the execution of shell scripts. Both streams (`stdout` and `stderr`) are captured."
5
+ authors = [{ name = "Josef Friedrich", email = "josef@friedrich.rocks" }]
6
+ requires-python = ">=3.12,<4"
7
+ readme = "README.rst"
8
+ license = "MIT"
9
+ classifiers = [
10
+ "Development Status :: 5 - Production/Stable",
11
+ "License :: OSI Approved :: MIT License",
12
+ "Programming Language :: Python :: 3 :: Only",
13
+ "Programming Language :: Python :: 3",
14
+ "Programming Language :: Python :: 3.12",
15
+ "Programming Language :: Python :: 3.13",
16
+ "Programming Language :: Python :: 3.14",
17
+ ]
18
+ dependencies = [
19
+ "pretiac>=0.6.0",
20
+ "pydantic>=2.12.5",
21
+ "pyyaml>=6.0.3",
22
+ "termcolor>=3.3.0",
23
+ "types-pyyaml>=6.0.12.20250915",
24
+ "types-requests>=2.32.4.20260107",
25
+ "types-termcolor>=1.1.6.2",
26
+ ]
27
+
28
+ [project.urls]
29
+ Repository = "https://github.com/Josef-Friedrich/command-watcher"
30
+
31
+ [dependency-groups]
32
+ dev = [
33
+ "pytest>=9.0.2",
34
+ "stdout-stderr-capturing>=0.2.1",
35
+ ]
36
+
37
+ [tool.uv]
38
+
39
+ [tool.uv.sources]
40
+ pretiac = { git = "https://github.com/Josef-Friedrich/PREtty-Typed-Icinga2-Api-Client_py.git" }
41
+
42
+ [build-system]
43
+ requires = ["uv_build>=0.11.1,<0.12.0"]
44
+ build-backend = "uv_build"
45
+
46
+ [tool.pytest.ini_options]
47
+ verbosity_assertions = 2
48
+ truncation_limit_lines = 999999
49
+ truncation_limit_chars = 999999