exec

package
v5.1.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(ctx context.Context) log.Logger

Types

type Executor

type Executor interface {
	CreateBtrfsSubvolume(ctx context.Context, id int) error
	FinaliseImage(ctx context.Context, image models.Image) error
	CreateInstance(ctx context.Context, imageID int, instanceID int, port int) error
	RetrieveInstanceCredentials(ctx context.Context, id int) (map[string][]byte, error)
	DestroyImage(ctx context.Context, id int) error
	DestroyInstance(ctx context.Context, id int) error
}

type OSExecutor

type OSExecutor struct {
	DataPath string
}

func (OSExecutor) CreateBtrfsSubvolume

func (e OSExecutor) CreateBtrfsSubvolume(ctx context.Context, id int) error

CreateBtrfsSubvolume creates a BTRFS subvolume in $(DataPath)/image_uploads and sets its permissions to 775 so that 'upload' can write to it.

func (OSExecutor) CreateInstance

func (e OSExecutor) CreateInstance(ctx context.Context, imageID int, instanceID int, port int) error

func (OSExecutor) DestroyImage

func (e OSExecutor) DestroyImage(ctx context.Context, id int) error

func (OSExecutor) DestroyInstance

func (e OSExecutor) DestroyInstance(ctx context.Context, id int) error

func (OSExecutor) FinaliseImage

func (e OSExecutor) FinaliseImage(ctx context.Context, image models.Image) error

FinaliseImage runs draupnir-finalise_image against the image This does the following things: - Gives ownership of the image directory to postgres - Sets the permissions to 700 so postgres will start - Removes postmaster.* files - Starts postgres - Runs anonymisation function - Stops postgres - Creates a snapshot of the image directory This snapshot is the finalised image

draupnir-finalise-image is a separate script because it has to run with sudo.

func (OSExecutor) RetrieveInstanceCredentials

func (e OSExecutor) RetrieveInstanceCredentials(ctx context.Context, id int) (map[string][]byte, error)

RetrieveInstanceCredentials reads the certificate and key files from the instance directory and returns them in a map

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL