Skip to content

Commit a68da7e

Browse files
committed
doc: update documentation with new uv usage
- Also add sudo config docs which fixes #66 Signed-off-by: Christian Hopps <chopps@labn.net>
1 parent 9c1333d commit a68da7e

File tree

3 files changed

+34
-25
lines changed

3 files changed

+34
-25
lines changed

README.org

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -324,32 +324,36 @@ For most users, it is recommended to install munet through pip (see:
324324
https://munet.readthedocs.io/en/latest/usage.html). However, if you want to run
325325
the unit tests, then you will need to set up your local enviornment:
326326

327-
*** Dependencies
328-
329-
μNET requires the following packages:
327+
*** `sudo -E` configuration
330328

331-
python3 python3-venv
329+
To allow munet to be found when running with `sudo -E` the `secure_path` config
330+
should be disabled in /etc/sudoers:
332331

333-
Automate tests require the following system packages:
332+
#+begin_src shell
333+
$ sudo sed -i -e '/secure_path/s/^/# /' /etc/sudoers
334+
#+end_src
334335

335-
podman
336+
*** Dependencies
336337

337-
Install the [[https://docs.astral.sh/uv/][uv]] package manager (either through
338-
your system's package manager or directly via the official installer):
338+
Install the [[https://docs.astral.sh/uv/][uv]] python project
339+
manager (either through your system's package manager or directly via the
340+
official installer):
339341

340342
#+begin_src shell
341343
curl -LsSf https://astral.sh/uv/install.sh | sh
342344
#+end_src
343345

346+
Some of the munet unit tests will require the following system packages which
347+
you should install according to your OS procedures:
348+
349+
podman
350+
344351
Install μNET with dependencies:
345352

346353
#+begin_src shell
347354
make install
348355
#+end_src
349356

350-
NOTE: After syncing the environment with =uv sync=, you can either activate the
351-
virtual environment (in =.venv= by default) or prefix commands with =uv run=.
352-
353357
*** Check your install
354358

355359
make
@@ -358,11 +362,11 @@ virtual environment (in =.venv= by default) or prefix commands with =uv run=.
358362

359363
The following uses FRR (see https://frrouting.org)
360364

361-
sudo uv run munet -c examples/frr/ospf/ospf/munet.yaml
365+
uv run sudo -E munet -c examples/frr/ospf/ospf/munet.yaml
362366

363367
For example:
364368
#+begin_src shell
365-
munet$ sudo uv run munet -c examples/frr/ospf/ospf/munet.yaml
369+
munet$ uv run sudo -E munet -c examples/frr/ospf/ospf/munet.yaml
366370
2022-09-16 13:37:05,603: INFO: Loaded logging config /home/lberger/Code/github/labn/munet/munet/logconf.yaml
367371
2022-09-16 13:37:05,609: INFO: Loaded config from /home/lberger/Code/github/labn/munet/examples/frr/ospf/ospf/munet.yaml
368372
2022-09-16 13:37:05,623: INFO: Loaded kinds config /home/lberger/Code/github/labn/munet/munet/kinds.yaml

doc/source/api/unshare.rst

Lines changed: 0 additions & 12 deletions
This file was deleted.

doc/source/usage.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@ Or if you need the latest changes from master:
2323
2424
$ pip install git+https://github.com/LabNConsulting/munet.git#egg=munet
2525
26+
`sudo -E` configuration
27+
-----------------------
28+
29+
sudo/root is required for most uses of munet and mutest; however, when you
30+
install munet as a non-root user (typical) either in your default
31+
environment or in a virtual environment, it may not be found when you `sudo`.
32+
33+
First you should always run with `sudo -E` which carries the user environment
34+
over into the new process running as root. However, it is also common for sudo
35+
to be configured to override the user's `$PATH` even when the `-E` flag is
36+
specified. To make sure this isn't the case you should disable the `Default
37+
secure_path` configuration if present. One way to do that is:
38+
39+
.. code-block:: console
40+
41+
$ sudo sed -i -e '/secure_path/s/^/#/' /etc/sudoers
42+
2643
Running
2744
-------
2845

0 commit comments

Comments
 (0)