Skip to content

WIP: Python bindings - #14

Open
fabianfreyer wants to merge 21 commits into
fubarnetes:devfrom
fabianfreyer:python-bindings
Open

WIP: Python bindings#14
fabianfreyer wants to merge 21 commits into
fubarnetes:devfrom
fabianfreyer:python-bindings

Conversation

@fabianfreyer

@fabianfreyer fabianfreyer commented Jul 7, 2018

Copy link
Copy Markdown
Contributor

See #13

Includes (merge these first, then rebase):

Features

  • Jail start/stop
  • StoppedJail parameters
    • getter
    • setter
  • StartedJail parameters
    • getter
    • setter
  • RACCT statistics
  • spawn child wrapper
    • wait, try_wait
    • exit code / signal
    • stdio redirection
      • stdio = subprocess.PIPE, subprocess.DEVNULL, subprocess.STDOUT, as well as custom fds
      • read_stdout(count) -> bytearray, read_stderr(count) -> bytearray
      • write_stdin(bytearray) -> bytes_written
      • readall_stdout_str() -> str, readall_stderr_str() -> str blocking until eof
      • write_stdin_str(str)
      • flush_stdin()
  • iteration over RunningJails (Jls)

@fabianfreyer fabianfreyer added the enhancement New feature or request label Jul 7, 2018
@fabianfreyer fabianfreyer added this to the Future milestone Jul 7, 2018
@fabianfreyer fabianfreyer added the help wanted Extra attention is needed label Jul 7, 2018
@fabianfreyer fabianfreyer added the bindings/python Python language bindings label Jul 7, 2018
@fabianfreyer

fabianfreyer commented Jul 8, 2018

Copy link
Copy Markdown
Contributor Author

Adding the parameter set logic will require this to be based off #15. This allows us to do stuff like this:

#!/usr/bin/env python3
import jail
config = jail.StoppedJail("/", parameters={"osrelease": "FnordBSD 42.023"})
running = config.start()
print(running.parameters)

@igalic igalic left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

all of these types look pretty much the same to me, or am i missing something?

Comment thread bindings/python/src/lib.rs Outdated
@fabianfreyer

Copy link
Copy Markdown
Contributor Author

@igalic what types?

@igalic

igalic commented Dec 29, 2018

Copy link
Copy Markdown

the impl StoppedJail and impl RunningJail both looked very similar, but i was also very confused about the lib.rs vs oldlib.rs

@fabianfreyer

Copy link
Copy Markdown
Contributor Author

@igalic thanks for taking a look!

  • oldlib.rs was a mistake - fixed that. Sorry!
  • StoppedJail and RunningJail are things in libjail-rs that I created to attempt to model the jail lifetime using the rust type system and are therefore distinct types. The python wrapper doesn't necessarily need to model those quirks, but they are kept to more closely wrap the libjail-rs rust library API.

@fabianfreyer
fabianfreyer force-pushed the python-bindings branch 9 times, most recently from 64e5f2c to e5563a7 Compare January 2, 2019 12:46
@fabianfreyer fabianfreyer self-assigned this Jan 2, 2019

@igalic igalic left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👀

j.stop()

def test_start_stop_jail(benchmark):
s = StoppedJail('/rescue')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

that's a pretty cool "hack"

Comment thread bindings/python/src/jls.rs Outdated
Comment thread bindings/python/src/jls.rs Outdated
@fabianfreyer
fabianfreyer force-pushed the python-bindings branch 3 times, most recently from 23b24f6 to ffbfab8 Compare January 2, 2019 15:24
@fabianfreyer
fabianfreyer force-pushed the python-bindings branch 2 times, most recently from c02527a to 43f1f8e Compare January 2, 2019 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bindings/python Python language bindings do-not-merge enhancement New feature or request help wanted Extra attention is needed needs-rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants