executor

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: GPL-3.0 Imports: 25 Imported by: 1

Documentation

Overview

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2020 Daniele Rondina <geaaru@sabayonlinux.org> Credits goes also to Gogs authors, some code portions and re-implemented design are also coming from the Gogs project, which is using the go-macaron framework and was really source of ispiration. Kudos to them!

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LxdCEmitter added in v0.5.0

type LxdCEmitter struct {
	HostWriterStdout io.WriteCloser
	HostWriterStderr io.WriteCloser
	LxdWriterStdout  io.WriteCloser
	LxdWriterStderr  io.WriteCloser
}

func NewLxdCEmitter added in v0.5.0

func NewLxdCEmitter() *LxdCEmitter

func (*LxdCEmitter) DebugLog added in v0.5.0

func (e *LxdCEmitter) DebugLog(color bool, args ...interface{})

func (*LxdCEmitter) Emits added in v0.5.0

func (e *LxdCEmitter) Emits(eType LxdCExecutorEvent, data map[string]interface{})

func (*LxdCEmitter) ErrorLog added in v0.5.0

func (e *LxdCEmitter) ErrorLog(color bool, args ...interface{})

func (*LxdCEmitter) GetHostWriterStderr added in v0.6.0

func (e *LxdCEmitter) GetHostWriterStderr() io.WriteCloser

func (*LxdCEmitter) GetHostWriterStdout added in v0.6.0

func (e *LxdCEmitter) GetHostWriterStdout() io.WriteCloser

func (*LxdCEmitter) GetLxdWriterStderr added in v0.6.0

func (e *LxdCEmitter) GetLxdWriterStderr() io.WriteCloser

func (*LxdCEmitter) GetLxdWriterStdout added in v0.6.0

func (e *LxdCEmitter) GetLxdWriterStdout() io.WriteCloser

func (*LxdCEmitter) InfoLog added in v0.5.0

func (e *LxdCEmitter) InfoLog(color bool, args ...interface{})

func (*LxdCEmitter) SetHostWriterStderr added in v0.6.0

func (e *LxdCEmitter) SetHostWriterStderr(w io.WriteCloser)

func (*LxdCEmitter) SetHostWriterStdout added in v0.6.0

func (e *LxdCEmitter) SetHostWriterStdout(w io.WriteCloser)

func (*LxdCEmitter) SetLxdWriterStderr added in v0.6.0

func (e *LxdCEmitter) SetLxdWriterStderr(w io.WriteCloser)

func (*LxdCEmitter) SetLxdWriterStdout added in v0.6.0

func (e *LxdCEmitter) SetLxdWriterStdout(w io.WriteCloser)

func (*LxdCEmitter) WarnLog added in v0.5.0

func (e *LxdCEmitter) WarnLog(color bool, args ...interface{})

type LxdCEmitterWriter added in v0.6.0

type LxdCEmitterWriter struct {
	Type string
}

func NewLxdCEmitterWriter added in v0.6.0

func NewLxdCEmitterWriter(t string) *LxdCEmitterWriter

func (*LxdCEmitterWriter) Close added in v0.6.0

func (e *LxdCEmitterWriter) Close() error

func (*LxdCEmitterWriter) Write added in v0.6.0

func (e *LxdCEmitterWriter) Write(p []byte) (int, error)

type LxdCExecutor

type LxdCExecutor struct {
	LxdClient         lxd.ContainerServer
	LxdConfig         *lxd_config.Config
	ConfigDir         string
	Endpoint          string
	Entrypoint        []string
	Ephemeral         bool
	ShowCmdsOutput    bool
	RuntimeCmdsOutput bool
	P2PMode           bool
	WaitSleep         int
	LocalDisable      bool

	Emitter LxdCExecutorEmitter
}

func NewLxdCExecutor

func NewLxdCExecutor(endpoint, configdir string, entrypoint []string, ephemeral, showCmdsOutput, runtimeCmdsOutput bool) *LxdCExecutor

func NewLxdCExecutorWithEmitter added in v0.6.0

func NewLxdCExecutorWithEmitter(endpoint, configdir string,
	entrypoint []string, ephemeral, showCmdsOutput,
	runtimeCmdsOutput bool, emitter LxdCExecutorEmitter) *LxdCExecutor

func (*LxdCExecutor) AddAlias2Image

func (e *LxdCExecutor) AddAlias2Image(fingerprint string, alias lxd_api.ImageAlias,
	server lxd.ContainerServer) error

func (*LxdCExecutor) CopyImage

func (e *LxdCExecutor) CopyImage(imageFingerprint string, remote lxd.ImageServer, to lxd.ContainerServer) error

func (*LxdCExecutor) CreateContainer

func (e *LxdCExecutor) CreateContainer(name, fingerprint, imageServer string, profiles []string) error

func (*LxdCExecutor) CreateImageFromContainer added in v0.7.0

func (l *LxdCExecutor) CreateImageFromContainer(containerName string, aliases []string, properties map[string]string, compressionAlgorithm string, public bool) (string, error)

func (*LxdCExecutor) CreateNetwork added in v0.7.0

func (e *LxdCExecutor) CreateNetwork(net specs.LxdCNetwork) error

func (*LxdCExecutor) CreateProfile

func (e *LxdCExecutor) CreateProfile(profile specs.LxdCProfile) error

func (*LxdCExecutor) DeleteContainer

func (e *LxdCExecutor) DeleteContainer(containerName string) error

func (*LxdCExecutor) DeleteContainerDir added in v0.7.0

func (e *LxdCExecutor) DeleteContainerDir(name, dir string) error

func (*LxdCExecutor) DeleteImageAliases

func (e *LxdCExecutor) DeleteImageAliases(image *lxd_api.Image, server lxd.ContainerServer) error

Delete all local alias defined on input Image to avoid conflict on pull.

func (*LxdCExecutor) DeleteImageAliases4Alias

func (e *LxdCExecutor) DeleteImageAliases4Alias(imageAlias string, server lxd.ContainerServer) error

Delete alias from image of a specific ContainerServer if available

func (*LxdCExecutor) DoAction2Container

func (e *LxdCExecutor) DoAction2Container(name, action string) error

func (*LxdCExecutor) DownloadImage

func (e *LxdCExecutor) DownloadImage(imageFingerprint string, remote lxd.ImageServer) error

func (*LxdCExecutor) FindImage

func (e *LxdCExecutor) FindImage(image, imageRemoteServer string) (string, lxd.ImageServer, string, error)

func (*LxdCExecutor) GetContainerList

func (e *LxdCExecutor) GetContainerList() ([]string, error)

func (*LxdCExecutor) GetEmitter added in v0.6.0

func (e *LxdCExecutor) GetEmitter() LxdCExecutorEmitter

func (*LxdCExecutor) GetImage

func (e *LxdCExecutor) GetImage(image string, remote lxd.ImageServer) (*lxd_api.Image, error)

Retrieve Image from alias or fingerprint to a specific remote.

func (*LxdCExecutor) GetLocalDisable added in v0.7.0

func (e *LxdCExecutor) GetLocalDisable() bool

func (*LxdCExecutor) GetNetworkList added in v0.7.0

func (e *LxdCExecutor) GetNetworkList() ([]string, error)

func (*LxdCExecutor) GetP2PMode added in v0.7.0

func (e *LxdCExecutor) GetP2PMode() bool

func (*LxdCExecutor) GetProfilesList

func (e *LxdCExecutor) GetProfilesList() ([]string, error)

func (*LxdCExecutor) IsEphemeralContainer added in v0.7.0

func (e *LxdCExecutor) IsEphemeralContainer(containerName string) (bool, error)

func (*LxdCExecutor) IsPresentContainer

func (e *LxdCExecutor) IsPresentContainer(containerName string) (bool, error)

func (*LxdCExecutor) IsPresentNetwork added in v0.7.0

func (e *LxdCExecutor) IsPresentNetwork(name string) (bool, error)

func (*LxdCExecutor) IsPresentProfile

func (e *LxdCExecutor) IsPresentProfile(profileName string) (bool, error)

func (*LxdCExecutor) IsRunningContainer added in v0.14.0

func (e *LxdCExecutor) IsRunningContainer(name string) (bool, error)

func (*LxdCExecutor) LaunchContainer

func (e *LxdCExecutor) LaunchContainer(name, fingerprint string, profiles []string) error

func (*LxdCExecutor) LaunchContainerType added in v0.7.0

func (e *LxdCExecutor) LaunchContainerType(name, fingerprint string, profiles []string, ephemeral bool) error

func (*LxdCExecutor) PullImage

func (e *LxdCExecutor) PullImage(imageAlias, imageRemoteServer string) (string, error)

func (*LxdCExecutor) RecursiveMkdir

func (e *LxdCExecutor) RecursiveMkdir(nameContainer string, dir string, mode *os.FileMode, uid int64, gid int64) error

Based on code of lxc client tool https://github.com/lxc/lxd/blob/master/lxc/file.go

func (*LxdCExecutor) RecursivePullFile added in v0.7.0

func (l *LxdCExecutor) RecursivePullFile(nameContainer string, destPath string, localPath string, localAsTarget bool) error

Based on code of lxc client tool https://github.com/lxc/lxd/blob/master/lxc/file.go

func (*LxdCExecutor) RecursivePushFile

func (e *LxdCExecutor) RecursivePushFile(nameContainer, source, target string) error

Based on code of lxc client tool https://github.com/lxc/lxd/blob/master/lxc/file.go

func (*LxdCExecutor) RunCommand

func (e *LxdCExecutor) RunCommand(containerName, command string, envs map[string]string, entryPoint []string) (int, error)

func (*LxdCExecutor) RunCommandWithOutput

func (e *LxdCExecutor) RunCommandWithOutput(containerName, command string, envs map[string]string, outBuffer, errBuffer io.WriteCloser, entryPoint []string) (int, error)

func (*LxdCExecutor) RunCommandWithOutput4Var

func (e *LxdCExecutor) RunCommandWithOutput4Var(containerName, command, outVar, errVar string, envs *map[string]string, entryPoint []string) (int, error)

func (*LxdCExecutor) RunHostCommand

func (e *LxdCExecutor) RunHostCommand(command string, envs map[string]string, entryPoint []string) (int, error)

func (*LxdCExecutor) RunHostCommandWithOutput

func (e *LxdCExecutor) RunHostCommandWithOutput(command string, envs map[string]string, outBuffer, errBuffer io.WriteCloser, entryPoint []string) (int, error)

func (*LxdCExecutor) RunHostCommandWithOutput4Var

func (e *LxdCExecutor) RunHostCommandWithOutput4Var(command, outVar, errVar string, envs *map[string]string, entryPoint []string) (int, error)

func (*LxdCExecutor) SetEmitter added in v0.6.0

func (e *LxdCExecutor) SetEmitter(emitter LxdCExecutorEmitter)

func (*LxdCExecutor) SetLocalDisable added in v0.7.0

func (e *LxdCExecutor) SetLocalDisable(v bool)

func (*LxdCExecutor) SetP2PMode added in v0.7.0

func (e *LxdCExecutor) SetP2PMode(m bool)

func (*LxdCExecutor) Setup

func (e *LxdCExecutor) Setup() error

func (*LxdCExecutor) StartContainer added in v0.7.0

func (e *LxdCExecutor) StartContainer(name string) error

func (*LxdCExecutor) StopContainer added in v0.7.0

func (e *LxdCExecutor) StopContainer(name string) error

func (*LxdCExecutor) UpdateNetwork added in v0.7.0

func (e *LxdCExecutor) UpdateNetwork(net specs.LxdCNetwork) error

func (*LxdCExecutor) UpdateProfile added in v0.8.0

func (e *LxdCExecutor) UpdateProfile(profile specs.LxdCProfile) error

func (*LxdCExecutor) WaitOperation added in v0.7.0

func (e *LxdCExecutor) WaitOperation(rawOp interface{}, p *lxd_utils.ProgressRenderer) error

type LxdCExecutorEmitter added in v0.5.0

type LxdCExecutorEmitter interface {
	Emits(eType LxdCExecutorEvent, data map[string]interface{})

	DebugLog(color bool, args ...interface{})
	InfoLog(color bool, args ...interface{})
	WarnLog(color bool, args ...interface{})
	ErrorLog(color bool, args ...interface{})
}

type LxdCExecutorEvent added in v0.5.0

type LxdCExecutorEvent string
const (
	LxdClientSetupDone  LxdCExecutorEvent = "client-setup"
	LxdContainerCreated LxdCExecutorEvent = "container-created"
	LxdContainerStarted LxdCExecutorEvent = "container-started"
	LxdContainerStopped LxdCExecutorEvent = "container-stopped"
)

Jump to

Keyboard shortcuts

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