Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HACKING: Add a section about Python bridge and debugging #18995

Merged
merged 2 commits into from
Aug 24, 2023

Conversation

jelly
Copy link
Member

@jelly jelly commented Jun 22, 2023

Explain the COCKPIT_DEBUG environment variable.

@jelly jelly added the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Jun 22, 2023
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this is nice! I was previously hacking bridge.py. This should work in Debian etc. with pam_env, but I'm not sure if all distros use /etc/environment?

HACKING.md Outdated Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
@jelly
Copy link
Member Author

jelly commented Jun 26, 2023

Ah, this is nice! I was previously hacking bridge.py. This should work in Debian etc. with pam_env, but I'm not sure if all distros use /etc/environment?

Works on Arch and Fedora so I suppose so? 🤔

@jelly
Copy link
Member Author

jelly commented Jun 26, 2023

Ah, this is nice! I was previously hacking bridge.py. This should work in Debian etc. with pam_env, but I'm not sure if all distros use /etc/environment?

facepalm totally forgot about

  -e NAME=VAL, --env NAME=VAL
                        Add a line to /etc/environment (default: None)
  -d, --debug           Equivalent to --env=COCKPIT_DEBUG=all (default: None)

HACKING.md Outdated

A test image with the Python image can be created with `image-prepare` for the operating systems which don't enable it yet.

./test/image-prepare --python
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is now outdated, where do we not have the bridge yet? Just RHEL 9/8?

Copy link
Member

@martinpitt martinpitt Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RHEL/CentOS 8, debian-stable, ubuntu-2204. The rest has it.

HACKING.md Outdated
@@ -182,14 +182,33 @@ 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`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still experimental?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's been live for a while :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave that for a follow up.

HACKING.md Outdated
To enable debug logging, you can set `COCKPIT_DEBUG`. In a test virtual
machine this can be done by setting it in the global environment:

echo 'COCKPIT_DEBUG=all' >> /etc/environment
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or uhh python3 -m cockpit.bridge --debug

@martinpitt how do you develop with the bridge locally? I usually create a wrapper script and then:

./cockpit-ws --local-session=./foo.sh --port 9999

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually develop in a VM, and iterate with something like

scp -r src/cockpit c:/usr/lib/python3.11/site-packages/; ssh c pkill -e cockpit-bridge

Copy link
Member Author

@jelly jelly Aug 23, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm can we do something silly and use systemd-ctypes to make a ./build.js -w variant for Python.

HACKING.md Outdated Show resolved Hide resolved
HACKING.md Show resolved Hide resolved
@jelly jelly force-pushed the document-cockpit-bridge-hacking branch 2 times, most recently from cc45248 to d5c340e Compare August 23, 2023 09:39
@jelly jelly marked this pull request as ready for review August 23, 2023 09:39
@jelly jelly requested a review from martinpitt August 23, 2023 11:37
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers!

HACKING.md Outdated Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
HACKING.md Outdated Show resolved Hide resolved
HACKING.md Show resolved Hide resolved
@jelly jelly force-pushed the document-cockpit-bridge-hacking branch from dcb91c2 to e66e2ca Compare August 24, 2023 09:09
@jelly jelly requested a review from martinpitt August 24, 2023 09:16
Copy link
Member

@martinpitt martinpitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cheers!

@martinpitt
Copy link
Member

Triggered fcos/other

@jelly jelly merged commit f18b652 into cockpit-project:main Aug 24, 2023
35 checks passed
@jelly jelly deleted the document-cockpit-bridge-hacking branch August 24, 2023 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-test For doc/workflow changes, or experiments which don't need a full CI run,
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants