Skip to content

Commit

Permalink
Update external docs
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpitt committed Aug 31, 2023
1 parent 23282c2 commit 757894a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
41 changes: 35 additions & 6 deletions external/source/HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,42 @@ git submodules:
Refer to the [testing README](test/README.md) for details on running the Cockpit
integration tests locally.

## Testing the Python bridge
## Python bridge

Cockpit currently has an experimental replacement for `cockpit-bridge`
written in Python. It resides in `src/cockpit` with most of its rules in
`src/Makefile.am`. This directory was chosen because it matches the standard
so-called "src layout" convention for Python packages, where each package
(`cockpit`) is a subdirectory of the `src` directory.
Most distro releases now ship a replacement for the C bridge written in Python.
It resides in `src/cockpit` with most of its rules in `src/Makefile.am`. This
directory was chosen because it matches the standard so-called "src layout"
convention for Python packages, where each package (`cockpit`) is a
subdirectory of the `src` directory.

### Running the bridge

The Python bridge can be used interactively on a local machine:

PYTHONPATH=src python3 -m cockpit.bridge

To make it easy to test out channels without having to write out messages
manually, `cockpit.misc.print` can be used:

PYTHONPATH=src python3 -m cockpit.misc.print open fslist1 path=/etc watch=False | PYTHONPATH=src python3 -m cockpit.bridge

These shell aliases might be useful when experimenting with the protocol:

alias cpy='PYTHONPATH=src python3 -m cockpit.bridge'
alias cpf='PYTHONPATH=src python3 -m cockpit.misc.print'

When working with the Python bridge on test images, note that `RHEL/CentOS 8`,
`debian-stable`, and `ubuntu-2204` still use the C bridge. So if you want to
explicitly have the Python bridge on those images use:

./test/image-prepare --python

To enable debug logging in journal on a test image, you can pass `--debug` to
`image-prepare`. This will set `COCKPIT_DEBUG=all` to `/etc/environment`, if
you are only interested channel debug messages change `all` to
`cockpit.channel`.

### Testing the Python bridge

There are a growing number of Python `unittest` tests being written to test
parts of the new bridge code. You can run these with `make pytest` or
Expand Down
2 changes: 1 addition & 1 deletion external/source/test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ You can set these environment variables to configure the test suite:
"centos-8-stream"
"debian-stable"
"debian-testing"
"fedora-37"
"fedora-38"
"fedora-39"
"fedora-coreos"
"fedora-testing"
"rhel-8-9"
Expand Down

0 comments on commit 757894a

Please sign in to comment.