couchpotato.core.softchroot module

class couchpotato.core.softchroot.SoftChroot[source]

Soft Chroot module

Provides chroot feature for interation with Web-UI. Since it is not real chroot, so the name is SOFT CHROOT. The module prevents access to entire file-system, allowing access only to subdirs of SOFT-CHROOT directory.

abs2chroot(path, force=False)[source]

Converts absolute path to chrooted path

chroot2abs(path)[source]

Converts chrooted path to absolute path

get_chroot()[source]

Returns root in chrooted environment

Raises:
RuntimeError: when SoftChroot is not initialized OR enabled
initialize(chdir)[source]

initialize module, by setting soft-chroot-directory

Sets soft-chroot directory and ‘enabled’-flag

Args:
self (SoftChroot) : self chdir (string) : absolute path to soft-chroot
Raises:
SoftChrootInitError: when chdir doesn’t exist
is_root_abs(abspath)[source]

Checks whether absolute path @abspath is the root in the soft-chrooted environment

is_subdir(abspath)[source]

Checks whether @abspath is subdir (on any level) of soft-chroot

exception couchpotato.core.softchroot.SoftChrootInitError[source]

Bases: exceptions.IOError

Error during soft-chroot initialization