Documentation
¶
Index ¶
- 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 Context)
- 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) error
- func (b *BaseAction) PostMachine(_ *Context) error
- func (b *BaseAction) PostMachineCleanup(_ *Context) error
- func (b *BaseAction) PreMachine(_ *Context, _ *fakemachine.Machine, _ *[]string) error
- func (b *BaseAction) PreNoMachine(_ *Context) error
- func (b *BaseAction) Run(_ *Context) error
- func (b *BaseAction) String() string
- func (b *BaseAction) Verify(_ *Context) error
- type ChrootEnterMethod
- type Command
- type CommonContext
- type Context
- type Partition
- type ServiceHelper
- type ServicesManager
- type State
- type Unpacker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanPathAt ¶
func DebugShell ¶ added in v1.1.0
func DebugShell(context Context)
DebugShell function launches an interactive shell for debug and problems investigation.
func DownloadHTTPURL ¶ added in v1.1.6
Function for downloading single file object with http(s) protocol
func RestrictedPath ¶ added in v1.1.0
Types ¶
type Action ¶
type Action interface {
/* FIXME verify should probably be prepare or somesuch */
Verify(context *Context) error
PreMachine(context *Context, m *fakemachine.Machine, args *[]string) error
PreNoMachine(context *Context) error
Run(context *Context) 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 *Context) error
PostMachine(context *Context) 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 *Context) error
String() string
}
type Archive ¶ added in v1.1.0
type Archive struct {
Archiver
}
func NewArchive ¶ added in v1.1.0
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 ¶ added in v1.1.0
type ArchiveBase struct {
// contains filtered or unexported fields
}
func (*ArchiveBase) AddOption ¶ added in v1.1.0
func (arc *ArchiveBase) AddOption(key, value interface{}) error
func (*ArchiveBase) RelaxedUnpack ¶ added in v1.1.0
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 ¶ added in v1.1.0
func (arc *ArchiveBase) Type() ArchiveType
func (*ArchiveBase) Unpack ¶ added in v1.1.0
func (arc *ArchiveBase) Unpack(_ string) error
Unpack archive as is
type ArchiveDeb ¶ added in v1.1.0
type ArchiveDeb struct {
ArchiveBase
}
func (*ArchiveDeb) RelaxedUnpack ¶ added in v1.1.0
func (deb *ArchiveDeb) RelaxedUnpack(destination string) error
func (*ArchiveDeb) Unpack ¶ added in v1.1.0
func (deb *ArchiveDeb) Unpack(destination string) error
type ArchiveTar ¶ added in v1.1.0
type ArchiveTar struct {
ArchiveBase
}
func (*ArchiveTar) AddOption ¶ added in v1.1.0
func (tar *ArchiveTar) AddOption(key, value interface{}) error
func (*ArchiveTar) RelaxedUnpack ¶ added in v1.1.0
func (tar *ArchiveTar) RelaxedUnpack(destination string) error
func (*ArchiveTar) Unpack ¶ added in v1.1.0
func (tar *ArchiveTar) Unpack(destination string) error
type ArchiveType ¶ added in v1.1.0
type ArchiveType int
const ( Tar ArchiveType Zip Deb )
Supported types
type ArchiveZip ¶ added in v1.1.0
type ArchiveZip struct {
ArchiveBase
}
func (*ArchiveZip) RelaxedUnpack ¶ added in v1.1.0
func (zip *ArchiveZip) RelaxedUnpack(destination string) error
func (*ArchiveZip) Unpack ¶ added in v1.1.0
func (zip *ArchiveZip) Unpack(destination string) error
type Archiver ¶ added in v1.1.0
type Archiver interface {
Type() ArchiveType
AddOption(key, value interface{}) error
Unpacker
}
type BaseAction ¶
func (*BaseAction) Cleanup ¶
func (b *BaseAction) Cleanup(_ *Context) error
func (*BaseAction) PostMachine ¶
func (b *BaseAction) PostMachine(_ *Context) error
func (*BaseAction) PostMachineCleanup ¶ added in v1.1.0
func (b *BaseAction) PostMachineCleanup(_ *Context) error
func (*BaseAction) PreMachine ¶
func (b *BaseAction) PreMachine(_ *Context, _ *fakemachine.Machine, _ *[]string) error
func (*BaseAction) PreNoMachine ¶
func (b *BaseAction) PreNoMachine(_ *Context) error
func (*BaseAction) Run ¶
func (b *BaseAction) Run(_ *Context) error
func (*BaseAction) String ¶
func (b *BaseAction) String() string
func (*BaseAction) Verify ¶
func (b *BaseAction) Verify(_ *Context) error
type ChrootEnterMethod ¶
type ChrootEnterMethod int
const ( ChrootMethodNone ChrootEnterMethod = iota // No chroot in use ChrootMethodNspawn // use nspawn to create the chroot environment ChrootMethodChroot // use chroot to create the chroot environment )
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 ¶ added in v1.1.0
func (*Command) AddBindMount ¶
type CommonContext ¶ added in v1.1.0
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 State
EnvironVars map[string]string
PrintRecipe bool
Verbose bool
}
type Context ¶ added in v1.1.6
type Context struct {
*CommonContext
RecipeDir string
Architecture string
SectorSize int
}
type Partition ¶
Mapping from partition name as configured in the image-partition action to device path for usage by other actions
type ServiceHelper ¶ added in v1.1.0
type ServiceHelper struct {
Rootdir string
}
func (*ServiceHelper) Allow ¶ added in v1.1.0
func (s *ServiceHelper) Allow() error
Allow() allows to start/stop services on OS level.
func (*ServiceHelper) Deny ¶ added in v1.1.0
func (s *ServiceHelper) Deny() error
Deny() prohibits to start/stop services on OS level.