Documentation
¶
Index ¶
- func GetLogger(ctx context.Context) log.Logger
- type Executor
- type OSExecutor
- func (e OSExecutor) CreateBtrfsSubvolume(ctx context.Context, id int) error
- func (e OSExecutor) CreateInstance(ctx context.Context, imageID int, instanceID int, port int) error
- func (e OSExecutor) DestroyImage(ctx context.Context, id int) error
- func (e OSExecutor) DestroyInstance(ctx context.Context, id int) error
- func (e OSExecutor) FinaliseImage(ctx context.Context, image models.Image) error
- func (e OSExecutor) RetrieveInstanceCredentials(ctx context.Context, id int) (map[string][]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 (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 ¶
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