Documentation
¶
Index ¶
- Constants
- func CleanPath(path string) string
- func CleanPathAt(path, at string) string
- func CopyFile(src, dst string, mode os.FileMode) error
- func CopyTree(sourcetree, desttree string) error
- func DebugShell(context DebosContext)
- func DownloadHttpUrl(url, filename string) error
- func RealPath(path string) (string, error)
- func RestrictedPath(prefix, dest string) (string, error)
- type Action
- type Archive
- type ArchiveBase
- type ArchiveDeb
- type ArchiveTar
- type ArchiveType
- type ArchiveZip
- type Archiver
- type BaseAction
- func (b *BaseAction) Cleanup(context *DebosContext) error
- func (b *BaseAction) PostMachine(context *DebosContext) error
- func (b *BaseAction) PostMachineCleanup(context *DebosContext) error
- func (b *BaseAction) PreMachine(context *DebosContext, m *fakemachine.Machine, args *[]string) error
- func (b *BaseAction) PreNoMachine(context *DebosContext) error
- func (b *BaseAction) Run(context *DebosContext) error
- func (b *BaseAction) String() string
- func (b *BaseAction) Verify(context *DebosContext) error
- type ChrootEnterMethod
- type Command
- type CommonContext
- type DebosContext
- type DebosState
- type Partition
- type ServiceHelper
- type ServicesManager
- type Unpacker
Constants ¶
const ( CHROOT_METHOD_NONE = iota // No chroot in use //CHROOT_METHOD_NSPAWN // use nspawn to create the chroot environment CHROOT_METHOD_CHROOT // use chroot to create the chroot environment )
Variables ¶
This section is empty.
Functions ¶
func CleanPathAt ¶
func DebugShell ¶
func DebugShell(context DebosContext)
DebugShell function launches an interactive shell for debug and problems investigation.
func DownloadHttpUrl ¶
Function for downloading single file object with http(s) protocol
func RestrictedPath ¶
Types ¶
type Action ¶
type Action interface {
/* FIXME verify should probably be prepare or somesuch */
Verify(context *DebosContext) error
PreMachine(context *DebosContext, m *fakemachine.Machine, args *[]string) error
PreNoMachine(context *DebosContext) error
Run(context *DebosContext) error
// Cleanup() method gets called only if the Run for an action
// was started and in the same machine (host or fake) as Run has run
Cleanup(context *DebosContext) error
PostMachine(context *DebosContext) error
// PostMachineCleanup() gets called for all actions if Pre*Machine() method
// has run for Action. This method is always executed on the host with user's permissions.
PostMachineCleanup(context *DebosContext) error
String() string
}
type Archive ¶
type Archive struct {
Archiver
}
func NewArchive ¶
func NewArchive(file string, arcType ...ArchiveType) (Archive, error)
NewArchive associate correct structure and methods according to archive type. If ArchiveType is omitted -- trying to guess the type. Return ArchiveType or nil in case of error.
type ArchiveBase ¶
type ArchiveBase struct {
// contains filtered or unexported fields
}
func (*ArchiveBase) AddOption ¶
func (arc *ArchiveBase) AddOption(key, value interface{}) error
func (*ArchiveBase) RelaxedUnpack ¶
func (arc *ArchiveBase) RelaxedUnpack(destination string) error
RelaxedUnpack unpack archive in relaxed mode allowing to ignore or avoid minor issues with unpacker tool or framework.
func (*ArchiveBase) Type ¶
func (arc *ArchiveBase) Type() ArchiveType
func (*ArchiveBase) Unpack ¶
func (arc *ArchiveBase) Unpack(destination string) error
Unpack archive as is
type ArchiveDeb ¶
type ArchiveDeb struct {
ArchiveBase
}
func (*ArchiveDeb) RelaxedUnpack ¶
func (deb *ArchiveDeb) RelaxedUnpack(destination string) error
func (*ArchiveDeb) Unpack ¶
func (deb *ArchiveDeb) Unpack(destination string) error
type ArchiveTar ¶
type ArchiveTar struct {
ArchiveBase
}
func (*ArchiveTar) AddOption ¶
func (tar *ArchiveTar) AddOption(key, value interface{}) error
func (*ArchiveTar) RelaxedUnpack ¶
func (tar *ArchiveTar) RelaxedUnpack(destination string) error
func (*ArchiveTar) Unpack ¶
func (tar *ArchiveTar) Unpack(destination string) error
type ArchiveZip ¶
type ArchiveZip struct {
ArchiveBase
}
func (*ArchiveZip) RelaxedUnpack ¶
func (zip *ArchiveZip) RelaxedUnpack(destination string) error
func (*ArchiveZip) Unpack ¶
func (zip *ArchiveZip) Unpack(destination string) error
type Archiver ¶
type Archiver interface {
Type() ArchiveType
AddOption(key, value interface{}) error
Unpacker
}
type BaseAction ¶
func (*BaseAction) Cleanup ¶
func (b *BaseAction) Cleanup(context *DebosContext) error
func (*BaseAction) PostMachine ¶
func (b *BaseAction) PostMachine(context *DebosContext) error
func (*BaseAction) PostMachineCleanup ¶
func (b *BaseAction) PostMachineCleanup(context *DebosContext) error
func (*BaseAction) PreMachine ¶
func (b *BaseAction) PreMachine(context *DebosContext, m *fakemachine.Machine, args *[]string) error
func (*BaseAction) PreNoMachine ¶
func (b *BaseAction) PreNoMachine(context *DebosContext) error
func (*BaseAction) Run ¶
func (b *BaseAction) Run(context *DebosContext) error
func (*BaseAction) String ¶
func (b *BaseAction) String() string
func (*BaseAction) Verify ¶
func (b *BaseAction) Verify(context *DebosContext) error
type ChrootEnterMethod ¶
type ChrootEnterMethod int
type Command ¶
type Command struct {
Architecture string // Architecture of the chroot, nil if same as host
Dir string // Working dir to run command in
Chroot string // Run in the chroot at path
ChrootMethod ChrootEnterMethod // Method to enter the chroot
// contains filtered or unexported fields
}
func NewChrootCommandForContext ¶
func NewChrootCommandForContext(context DebosContext) Command
func (*Command) AddBindMount ¶
type CommonContext ¶
type CommonContext struct {
Scratchdir string
Rootdir string
Artifactdir string
Downloaddir string
Image string
ImagePartitions []Partition
ImageMntDir string
ImageFSTab bytes.Buffer // Fstab as per partitioning
ImageKernelRoot string // Kernel cmdline root= snippet for the / of the image
DebugShell string
Origins map[string]string
State DebosState
EnvironVars map[string]string
PrintRecipe bool
Verbose bool
}
type DebosContext ¶
type DebosContext struct {
*CommonContext
RecipeDir string
Architecture string
}
type DebosState ¶
type DebosState int
const ( Success DebosState = iota Failed )
Represent the current state of Debos
type Partition ¶
Mapping from partition name as configured in the image-partition action to device path for usage by other actions
type ServiceHelper ¶
type ServiceHelper struct {
Rootdir string
}
func (*ServiceHelper) Allow ¶
func (s *ServiceHelper) Allow() error
Allow() allows to start/stop services on OS level.
func (*ServiceHelper) Deny ¶
func (s *ServiceHelper) Deny() error
Deny() prohibits to start/stop services on OS level.