napalm-linux 0.15.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.
@@ -0,0 +1,191 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other transformations
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and incorporated
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combined Contribution(s) and the Work
78
+ to which such Contribution(s) was submitted. If You institute patent
79
+ litigation against any entity (including a cross-claim or counterclaim
80
+ in a lawsuit) alleging that the Work or any Contribution embodied
81
+ within the Work constitutes direct or contributory patent infringement,
82
+ then any patent licenses granted to You under this License for that
83
+ Work shall terminate as of the date such litigation is filed.
84
+
85
+ 4. Redistribution. You may reproduce and distribute copies of the
86
+ Work or Derivative Works thereof in any medium, with or without
87
+ modifications, and in Source or Object form, provided that You
88
+ meet the following conditions:
89
+
90
+ (a) You must give any other recipients of the Work or Derivative
91
+ Works a copy of this License; and
92
+
93
+ (b) You must cause any modified files to carry prominent notices
94
+ stating that You changed the files; and
95
+
96
+ (c) You must retain, in the Source form of any Derivative Works
97
+ that You distribute, all copyright, patent, trademark, and
98
+ attribution notices from the Source form of the Work,
99
+ excluding those notices that do not pertain to any part of
100
+ the Derivative Works; and
101
+
102
+ (d) If the Work includes a "NOTICE" text file as part of its
103
+ distribution, You must include a readable copy of the
104
+ attribution notices contained within such NOTICE file, in
105
+ at least one of the following places: within a NOTICE text file
106
+ distributed as part of the Derivative Works; within the Source
107
+ form or documentation, if provided along with the Derivative
108
+ Works; or, within a display generated by the Derivative Works,
109
+ if and wherever such third-party notices normally appear. The
110
+ contents of the NOTICE file are for informational purposes only
111
+ and do not modify the License. You may add Your own attribution
112
+ notices within Derivative Works that You distribute, alongside
113
+ or as an addendum to the NOTICE text from the Work, provided
114
+ that such additional attribution notices cannot be construed
115
+ as modifying the License.
116
+
117
+ You may add Your own license statement for Your modifications and
118
+ may provide additional grant of rights to use, copy, modify, merge,
119
+ publish, distribute, sublicense, and/or sell copies of the Work,
120
+ and to permit persons to whom the Work is furnished to do so,
121
+ subject to the following conditions:
122
+
123
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
124
+ any Contribution intentionally submitted for inclusion in the Work
125
+ by You to the Licensor shall be under the terms and conditions of
126
+ this License, without any additional terms or conditions.
127
+ Notwithstanding the above, nothing herein shall supersede or modify
128
+ the terms of any separate license agreement you may have executed
129
+ with Licensor regarding such Contributions.
130
+
131
+ 6. Trademarks. This License does not grant permission to use the trade
132
+ names, trademarks, service marks, or product names of the Licensor,
133
+ except as required for reasonable and customary use in describing the
134
+ origin of the Work and reproducing the content of the NOTICE file.
135
+
136
+ 7. Disclaimer of Warranty. Unless required by applicable law or
137
+ agreed to in writing, Licensor provides the Work (and each
138
+ Contributor provides its Contributions) on an "AS IS" BASIS,
139
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
140
+ implied, including, without limitation, any conditions of TITLE,
141
+ MERCHANTIBILITY, or FITNESS FOR A PARTICULAR PURPOSE.
142
+ See the License for the specific language governing permissions and
143
+ limitations under the License.
144
+
145
+ 8. Limitation of Liability. In no event and under no legal theory,
146
+ whether in tort (including negligence), contract, or otherwise,
147
+ unless required by applicable law (such as deliberate and grossly
148
+ negligent acts) or agreed to in writing, shall any Contributor be
149
+ liable to You for damages, including any direct, indirect, special,
150
+ incidental, or exemplary damages of any character arising as a
151
+ result of this License or out of the use or inability to use the
152
+ Work (even if such Contributor has been advised of the possibility
153
+ of such damages).
154
+
155
+ 9. Accepting Warranty or Additional Liability. While redistributing
156
+ the Work or Derivative Works thereof, You may choose to offer,
157
+ and charge a fee for, acceptance of support, warranty, indemnity,
158
+ or other liability obligations and/or rights consistent with this
159
+ License. However, in accepting such obligations, You may offer only
160
+ conditions consistent with this License, subject to the following
161
+ additional conditions:
162
+
163
+ (a) You may offer additional warranty, indemnity, or other liability
164
+ terms and conditions; and
165
+
166
+ (b) You may offer support for the Work in return for a fee.
167
+
168
+ END OF TERMS AND CONDITIONS
169
+
170
+ APPENDIX: How to apply the Apache License to your work.
171
+
172
+ To apply the Apache License to your work, attach the following
173
+ boilerplate notice, with the fields enclosed by brackets "[]"
174
+ replaced with your own identifying information. (Don't include
175
+ the brackets!) The text should be enclosed in the appropriate
176
+ comment syntax for the file format in question. It may also be
177
+ possible to make it available with a creative commons license.
178
+
179
+ Copyright 2026 Christian Manivong
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: napalm-linux
3
+ Version: 0.15.0
4
+ Summary: NAPALM driver for generic Linux systems via SSH
5
+ Author-email: Christian Manivong <christian@manivong.de>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Repository, https://git.netork.io/NAPALM/napalm-linux
8
+ Project-URL: Issues, https://git.netork.io/NAPALM/napalm-linux/issues
9
+ Project-URL: Changelog, https://git.netork.io/NAPALM/napalm-linux/src/branch/main/CHANGELOG.md
10
+ Keywords: napalm,network,automation,linux,ssh,driver
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: System Administrators
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: System :: Networking
21
+ Classifier: Topic :: System :: Systems Administration
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: napalm>=4.0
27
+ Requires-Dist: napalm-device-types>=4.22.0
28
+ Requires-Dist: netmiko>=4.0.0
29
+ Requires-Dist: paramiko>=5.0.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=8; extra == "dev"
32
+ Requires-Dist: pytest-cov>=5; extra == "dev"
33
+ Requires-Dist: ruff>=0.6; extra == "dev"
34
+ Requires-Dist: mypy>=1.11; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # napalm-linux
38
+
39
+ NAPALM driver for **generic Linux systems** — Debian, Ubuntu, RHEL, Rocky, Alpine, Arch and any
40
+ other distribution reachable via SSH.
41
+
42
+ Connects over SSH using [Netmiko](https://github.com/ktbyers/netmiko) (`linux` device type) and
43
+ **automatically detects** the installed package manager (`apt`, `dnf`, `yum`, `apk`, `pacman`).
44
+
45
+ ## Requirements
46
+
47
+ | Dependency | Minimum version |
48
+ |---|---|
49
+ | Python | 3.9 |
50
+ | NAPALM | 4.0 |
51
+ | Netmiko | 4.0 |
52
+ | napalm-device-types | 0.2.0 |
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ pip install napalm napalm-linux
58
+ ```
59
+
60
+ Or from source:
61
+
62
+ ```bash
63
+ git clone https://git.netork.io/NAPALM/napalm-linux
64
+ pip install -e napalm-linux/
65
+ ```
66
+
67
+ When working in the NetOrk monorepo, install both packages as editable:
68
+
69
+ ```bash
70
+ pip install -e vendor/napalm-device-types/ -e vendor/napalm-linux/
71
+ ```
72
+
73
+ ## Quick start
74
+
75
+ ```python
76
+ from napalm import get_network_driver
77
+
78
+ Driver = get_network_driver("linux")
79
+
80
+ with Driver(
81
+ "10.0.0.5",
82
+ "admin",
83
+ "s3cr3t",
84
+ optional_args={
85
+ # "port": 22,
86
+ # "pkg_manager": "apt", # force package manager; auto-detected by default
87
+ # "sudo_password": "sudo-pass", # for commands that need root; without it,
88
+ # # `sudo -n` (passwordless sudo) is tried
89
+ # "debugging": True, # enable verbose logging
90
+ },
91
+ ) as dev:
92
+ facts = dev.get_facts()
93
+ print(facts)
94
+
95
+ # OS-specific methods (from napalm-device-types OSDriver)
96
+ packages = dev.get_packages()
97
+ updates = dev.get_pending_updates()
98
+ services = dev.get_services()
99
+ users = dev.get_os_users()
100
+ procs = dev.get_processes()
101
+ jobs = dev.get_cron_jobs()
102
+
103
+ # Upgrade specific packages
104
+ result = dev.apply_updates(["openssh-server", "curl"])
105
+ print(result) # {"success": True, "output": "..."}
106
+
107
+ # Upgrade everything with pending updates
108
+ result = dev.apply_updates([])
109
+
110
+ # Restart a service (start, stop, restart, enable, disable)
111
+ result = dev.manage_service("cron", "restart")
112
+ print(result) # {"success": True, "output": ""}
113
+ ```
114
+
115
+ ## Supported NAPALM methods
116
+
117
+ ### Standard NAPALM
118
+
119
+ | Method | Supported | Notes |
120
+ |---|---|---|
121
+ | `open()` / `close()` | ✅ | SSH via netmiko `linux` |
122
+ | `is_alive()` | ✅ | |
123
+ | `get_facts()` | ✅ | DMI / `/proc/uptime` / `ip link` |
124
+ | `get_interfaces()` | ✅ | `ip link show` |
125
+ | `get_interfaces_ip()` | ✅ | `ip addr show` |
126
+ | `get_arp_table()` | ✅ | `ip neigh show` |
127
+ | `get_config()` | ✅ | Returns `ip addr` + `ip route` output |
128
+ | `ping()` | ✅ | Executes `ping` on the remote host |
129
+ | `load_merge_candidate()` | ❌ | Not applicable for generic Linux |
130
+ | `load_replace_candidate()` | ❌ | Not applicable for generic Linux |
131
+ | `compare_config()` | ❌ | Not applicable for generic Linux |
132
+ | `commit_config()` | ❌ | Not applicable for generic Linux |
133
+ | `discard_config()` | ❌ | Not applicable for generic Linux |
134
+ | `rollback()` | ❌ | Not applicable for generic Linux |
135
+
136
+ ### OSDriver extensions (napalm-device-types)
137
+
138
+ | Method | Supported | Package managers |
139
+ |---|---|---|
140
+ | `get_packages()` | ✅ | apt, dnf, yum, apk, pacman |
141
+ | `get_pending_updates()` | ✅ | apt, dnf, yum, apk, pacman |
142
+ | `apply_updates(packages)` | ✅ | apt, dnf, yum, apk, pacman |
143
+ | `get_services()` | ✅ | systemd, one round trip (fallback: SysV `service`) |
144
+ | `manage_service(name, action)` | ✅ | systemd: start, stop, restart, enable, disable |
145
+ | `get_os_users()` | ✅ | `/etc/passwd` + `/etc/group` |
146
+ | `get_processes()` | ✅ | `ps axo` |
147
+ | `get_cron_jobs()` | ✅ | user crontabs + `/etc/cron.d/` |
148
+
149
+ ## Package manager auto-detection
150
+
151
+ The driver probes for each binary in order via `command -v`:
152
+
153
+ ```
154
+ apt → dnf → yum → apk → pacman
155
+ ```
156
+
157
+ Force a specific package manager:
158
+
159
+ ```python
160
+ optional_args = {"pkg_manager": "dnf"}
161
+ ```
162
+
163
+ ## SSH user permissions
164
+
165
+ The SSH user needs read access to:
166
+
167
+ | Data | Required permission |
168
+ |---|---|
169
+ | `/etc/passwd`, `/etc/group` | world-readable (default) |
170
+ | `/proc/uptime`, `/sys/class/dmi/…` | world-readable (default) |
171
+ | User crontabs (`/var/spool/cron/…`) | `root` or `sudo` required |
172
+ | `systemctl list-unit-files`, `systemctl show` | unprivileged |
173
+ | `systemctl start/stop/restart/enable/disable` | `root`, or `sudo` (with `sudo_password`, or passwordless) |
174
+ | `apt list --upgradable` | may require `apt-get update` (root) |
175
+ | `dnf check-update` / `yum check-update` | unprivileged, but slower without cache |
176
+
177
+ For full functionality it is recommended to run as `root` or grant passwordless `sudo` for
178
+ the above commands.
179
+
180
+ With a `sudo_password`, privileged commands run on an exec channel next to the interactive
181
+ shell: the password reaches `sudo -S` on stdin, never a command line, so it shows neither in
182
+ the process list nor in a shell history. The interactive session switches its history off
183
+ before its first command.
184
+
185
+ `get_services()` and `manage_service()` come from napalm-device-types'
186
+ `SystemdServicesMixin`; this driver supplies only the transport. An action runs as
187
+ `timeout 45 systemctl --no-ask-password <action> -- <unit>.service`, so a unit that hangs
188
+ on its way up or down cannot hold the session, and only the exit status decides whether it
189
+ succeeded. Without a sudo password it uses `sudo -n`, which fails at once instead of
190
+ waiting for a password prompt.
191
+
192
+ On OpenMediaVault (napalm-openmediavault inherits this driver), enabling or disabling a
193
+ unit that OMV manages itself — Samba, NFS, SSH — may be reverted the next time OMV applies
194
+ its configuration.
195
+
196
+ ## Tested distributions
197
+
198
+ | Distribution | Version | Package manager | Tested |
199
+ |---|---|---|---|
200
+ | Debian | 12 (Bookworm) | apt | ✅ |
201
+ | Ubuntu | 22.04 LTS | apt | ✅ |
202
+ | Rocky Linux | 9 | dnf | planned |
203
+ | Alpine Linux | 3.19 | apk | planned |
204
+ | Arch Linux | rolling | pacman | planned |
205
+
206
+ Contributions for additional distributions and versions are welcome.
207
+
208
+ ## Development
209
+
210
+ ```bash
211
+ # Create venv
212
+ python -m venv .venv
213
+ source .venv/bin/activate
214
+
215
+ # Install in editable mode with dev dependencies
216
+ pip install -e ../napalm-device-types/ -e ".[dev]"
217
+
218
+ # Run tests
219
+ pytest tests/ -v
220
+
221
+ # Lint / format
222
+ ruff check napalm_linux/
223
+ ruff format napalm_linux/
224
+ ```
225
+
226
+ ## License
227
+
228
+ Apache 2.0
@@ -0,0 +1,192 @@
1
+ # napalm-linux
2
+
3
+ NAPALM driver for **generic Linux systems** — Debian, Ubuntu, RHEL, Rocky, Alpine, Arch and any
4
+ other distribution reachable via SSH.
5
+
6
+ Connects over SSH using [Netmiko](https://github.com/ktbyers/netmiko) (`linux` device type) and
7
+ **automatically detects** the installed package manager (`apt`, `dnf`, `yum`, `apk`, `pacman`).
8
+
9
+ ## Requirements
10
+
11
+ | Dependency | Minimum version |
12
+ |---|---|
13
+ | Python | 3.9 |
14
+ | NAPALM | 4.0 |
15
+ | Netmiko | 4.0 |
16
+ | napalm-device-types | 0.2.0 |
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install napalm napalm-linux
22
+ ```
23
+
24
+ Or from source:
25
+
26
+ ```bash
27
+ git clone https://git.netork.io/NAPALM/napalm-linux
28
+ pip install -e napalm-linux/
29
+ ```
30
+
31
+ When working in the NetOrk monorepo, install both packages as editable:
32
+
33
+ ```bash
34
+ pip install -e vendor/napalm-device-types/ -e vendor/napalm-linux/
35
+ ```
36
+
37
+ ## Quick start
38
+
39
+ ```python
40
+ from napalm import get_network_driver
41
+
42
+ Driver = get_network_driver("linux")
43
+
44
+ with Driver(
45
+ "10.0.0.5",
46
+ "admin",
47
+ "s3cr3t",
48
+ optional_args={
49
+ # "port": 22,
50
+ # "pkg_manager": "apt", # force package manager; auto-detected by default
51
+ # "sudo_password": "sudo-pass", # for commands that need root; without it,
52
+ # # `sudo -n` (passwordless sudo) is tried
53
+ # "debugging": True, # enable verbose logging
54
+ },
55
+ ) as dev:
56
+ facts = dev.get_facts()
57
+ print(facts)
58
+
59
+ # OS-specific methods (from napalm-device-types OSDriver)
60
+ packages = dev.get_packages()
61
+ updates = dev.get_pending_updates()
62
+ services = dev.get_services()
63
+ users = dev.get_os_users()
64
+ procs = dev.get_processes()
65
+ jobs = dev.get_cron_jobs()
66
+
67
+ # Upgrade specific packages
68
+ result = dev.apply_updates(["openssh-server", "curl"])
69
+ print(result) # {"success": True, "output": "..."}
70
+
71
+ # Upgrade everything with pending updates
72
+ result = dev.apply_updates([])
73
+
74
+ # Restart a service (start, stop, restart, enable, disable)
75
+ result = dev.manage_service("cron", "restart")
76
+ print(result) # {"success": True, "output": ""}
77
+ ```
78
+
79
+ ## Supported NAPALM methods
80
+
81
+ ### Standard NAPALM
82
+
83
+ | Method | Supported | Notes |
84
+ |---|---|---|
85
+ | `open()` / `close()` | ✅ | SSH via netmiko `linux` |
86
+ | `is_alive()` | ✅ | |
87
+ | `get_facts()` | ✅ | DMI / `/proc/uptime` / `ip link` |
88
+ | `get_interfaces()` | ✅ | `ip link show` |
89
+ | `get_interfaces_ip()` | ✅ | `ip addr show` |
90
+ | `get_arp_table()` | ✅ | `ip neigh show` |
91
+ | `get_config()` | ✅ | Returns `ip addr` + `ip route` output |
92
+ | `ping()` | ✅ | Executes `ping` on the remote host |
93
+ | `load_merge_candidate()` | ❌ | Not applicable for generic Linux |
94
+ | `load_replace_candidate()` | ❌ | Not applicable for generic Linux |
95
+ | `compare_config()` | ❌ | Not applicable for generic Linux |
96
+ | `commit_config()` | ❌ | Not applicable for generic Linux |
97
+ | `discard_config()` | ❌ | Not applicable for generic Linux |
98
+ | `rollback()` | ❌ | Not applicable for generic Linux |
99
+
100
+ ### OSDriver extensions (napalm-device-types)
101
+
102
+ | Method | Supported | Package managers |
103
+ |---|---|---|
104
+ | `get_packages()` | ✅ | apt, dnf, yum, apk, pacman |
105
+ | `get_pending_updates()` | ✅ | apt, dnf, yum, apk, pacman |
106
+ | `apply_updates(packages)` | ✅ | apt, dnf, yum, apk, pacman |
107
+ | `get_services()` | ✅ | systemd, one round trip (fallback: SysV `service`) |
108
+ | `manage_service(name, action)` | ✅ | systemd: start, stop, restart, enable, disable |
109
+ | `get_os_users()` | ✅ | `/etc/passwd` + `/etc/group` |
110
+ | `get_processes()` | ✅ | `ps axo` |
111
+ | `get_cron_jobs()` | ✅ | user crontabs + `/etc/cron.d/` |
112
+
113
+ ## Package manager auto-detection
114
+
115
+ The driver probes for each binary in order via `command -v`:
116
+
117
+ ```
118
+ apt → dnf → yum → apk → pacman
119
+ ```
120
+
121
+ Force a specific package manager:
122
+
123
+ ```python
124
+ optional_args = {"pkg_manager": "dnf"}
125
+ ```
126
+
127
+ ## SSH user permissions
128
+
129
+ The SSH user needs read access to:
130
+
131
+ | Data | Required permission |
132
+ |---|---|
133
+ | `/etc/passwd`, `/etc/group` | world-readable (default) |
134
+ | `/proc/uptime`, `/sys/class/dmi/…` | world-readable (default) |
135
+ | User crontabs (`/var/spool/cron/…`) | `root` or `sudo` required |
136
+ | `systemctl list-unit-files`, `systemctl show` | unprivileged |
137
+ | `systemctl start/stop/restart/enable/disable` | `root`, or `sudo` (with `sudo_password`, or passwordless) |
138
+ | `apt list --upgradable` | may require `apt-get update` (root) |
139
+ | `dnf check-update` / `yum check-update` | unprivileged, but slower without cache |
140
+
141
+ For full functionality it is recommended to run as `root` or grant passwordless `sudo` for
142
+ the above commands.
143
+
144
+ With a `sudo_password`, privileged commands run on an exec channel next to the interactive
145
+ shell: the password reaches `sudo -S` on stdin, never a command line, so it shows neither in
146
+ the process list nor in a shell history. The interactive session switches its history off
147
+ before its first command.
148
+
149
+ `get_services()` and `manage_service()` come from napalm-device-types'
150
+ `SystemdServicesMixin`; this driver supplies only the transport. An action runs as
151
+ `timeout 45 systemctl --no-ask-password <action> -- <unit>.service`, so a unit that hangs
152
+ on its way up or down cannot hold the session, and only the exit status decides whether it
153
+ succeeded. Without a sudo password it uses `sudo -n`, which fails at once instead of
154
+ waiting for a password prompt.
155
+
156
+ On OpenMediaVault (napalm-openmediavault inherits this driver), enabling or disabling a
157
+ unit that OMV manages itself — Samba, NFS, SSH — may be reverted the next time OMV applies
158
+ its configuration.
159
+
160
+ ## Tested distributions
161
+
162
+ | Distribution | Version | Package manager | Tested |
163
+ |---|---|---|---|
164
+ | Debian | 12 (Bookworm) | apt | ✅ |
165
+ | Ubuntu | 22.04 LTS | apt | ✅ |
166
+ | Rocky Linux | 9 | dnf | planned |
167
+ | Alpine Linux | 3.19 | apk | planned |
168
+ | Arch Linux | rolling | pacman | planned |
169
+
170
+ Contributions for additional distributions and versions are welcome.
171
+
172
+ ## Development
173
+
174
+ ```bash
175
+ # Create venv
176
+ python -m venv .venv
177
+ source .venv/bin/activate
178
+
179
+ # Install in editable mode with dev dependencies
180
+ pip install -e ../napalm-device-types/ -e ".[dev]"
181
+
182
+ # Run tests
183
+ pytest tests/ -v
184
+
185
+ # Lint / format
186
+ ruff check napalm_linux/
187
+ ruff format napalm_linux/
188
+ ```
189
+
190
+ ## License
191
+
192
+ Apache 2.0
@@ -0,0 +1,5 @@
1
+ """napalm-linux – NAPALM driver for generic Linux systems."""
2
+
3
+ from napalm_linux.linux import LinuxDriver
4
+
5
+ __all__ = ["LinuxDriver"]