Documentation ¶
Overview ¶
Package chroot implements a chroot environment that runs in a separate network namespace from the caller.
Index ¶
- type NetworkChroot
- func (n *NetworkChroot) AddConfigTemplates(templates map[string]string)
- func (n *NetworkChroot) AddConfigValues(values map[string]interface{})
- func (n *NetworkChroot) AddCopiedConfigFiles(files []string)
- func (n *NetworkChroot) AddRootDirectories(directories []string)
- func (n *NetworkChroot) AddStartupCommand(command string)
- func (n *NetworkChroot) BridgeDbusNamespaces()
- func (n *NetworkChroot) GetLogContents(ctx context.Context, logFilePaths []string) (string, error)
- func (n *NetworkChroot) KillPidFile(ctx context.Context, pidFile string, missingOk bool) error
- func (n *NetworkChroot) RunChroot(ctx context.Context, args []string) error
- func (n *NetworkChroot) Shutdown(ctx context.Context) error
- func (n *NetworkChroot) Startup(ctx context.Context) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NetworkChroot ¶
type NetworkChroot struct { NetEnv []string // contains filtered or unexported fields }
NetworkChroot wraps the chroot variables.
func NewNetworkChroot ¶
func NewNetworkChroot() *NetworkChroot
NewNetworkChroot creates a new chroot object.
func (*NetworkChroot) AddConfigTemplates ¶
func (n *NetworkChroot) AddConfigTemplates(templates map[string]string)
AddConfigTemplates add a filename-content dict to the set of templates for the chroot.
func (*NetworkChroot) AddConfigValues ¶
func (n *NetworkChroot) AddConfigValues(values map[string]interface{})
AddConfigValues add a name-value dict to the set of values for the config template.
func (*NetworkChroot) AddCopiedConfigFiles ¶
func (n *NetworkChroot) AddCopiedConfigFiles(files []string)
AddCopiedConfigFiles add |files| to the set to be copied to the chroot.
func (*NetworkChroot) AddRootDirectories ¶
func (n *NetworkChroot) AddRootDirectories(directories []string)
AddRootDirectories add |directories| to the set created within the chroot.
func (*NetworkChroot) AddStartupCommand ¶
func (n *NetworkChroot) AddStartupCommand(command string)
AddStartupCommand add a command to the script run when the chroot starts up.
func (*NetworkChroot) BridgeDbusNamespaces ¶
func (n *NetworkChroot) BridgeDbusNamespaces()
BridgeDbusNamespaces make the system DBus daemon visible inside the chroot.
func (*NetworkChroot) GetLogContents ¶
GetLogContents return the logfiles from the chroot. |logFilePaths| is a list of relative paths to the chroot. An error will be returned if any file in the list does not exist.
func (*NetworkChroot) KillPidFile ¶
KillPidFile kills the process belonging to |pid_file| in the chroot.
func (*NetworkChroot) RunChroot ¶
func (n *NetworkChroot) RunChroot(ctx context.Context, args []string) error
RunChroot runs a command in a chroot, within the network namespace associated with this chroot.