collection

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PackageManagerRPM    = "rpm"
	PackageManagerDebian = "dpkg"
)
View Source
const (
	ServiceManagerSystemD = "systemd"
	ServiceManagerSysV    = "sysv"
)
View Source
const DefaultTimeout = 5 * time.Second

Variables

View Source
var ErrNoPackageManager = errors.New("could not detect a supported package manager")

ErrNoPackageManager is returned when we could not detect one.

View Source
var ErrNoServiceManager = errors.New("could not detect a supported service manager")

ErrNoServiceManager is returned when we could not detect one.

View Source
var FoundPackageManager string
View Source
var FoundServiceManager string

FoundServiceManager remembers the current service manager found.

Functions

func DetectGitInstalled

func DetectGitInstalled() bool

func DetectPackageManager

func DetectPackageManager() string

func DetectServiceManager

func DetectServiceManager() string

func ExecGitCommand

func ExecGitCommand(dir string, command ...string) ([]byte, error)

func FindServices

func FindServices(pattern string) (map[string]string, error)

func FindServicesSysV

func FindServicesSysV(pattern string) (map[string]string, error)

func FindServicesSystemd

func FindServicesSystemd(pattern string) (map[string]string, error)

func GetServiceStatusRaw

func GetServiceStatusRaw(name string) ([]byte, error)

func IsGitRepository

func IsGitRepository(path string) (string, bool)
func IsSymlink(info os.FileInfo) bool

func ListInstalledPackagesRaw

func ListInstalledPackagesRaw(pattern ...string) ([]byte, error)

func LoadCommandOutput

func LoadCommandOutput(command string, arguments ...string) (output []byte, err error)

func LoadCommandOutputWithTimeout

func LoadCommandOutputWithTimeout(timeout time.Duration, command string, arguments ...string) (
	output []byte, err error)

Types

type Collection

type Collection struct {
	Output  *zip.Writer
	Log     *logrus.Logger
	LogData *bytes.Buffer
}

func New

func New(w io.Writer) (c *Collection)

func (*Collection) AddCommandOutput

func (c *Collection) AddCommandOutput(file, command string, arguments ...string)

func (*Collection) AddCommandOutputWithTimeout

func (c *Collection) AddCommandOutputWithTimeout(file string,
	timeout time.Duration, command string, arguments ...string)

func (*Collection) AddFileData

func (c *Collection) AddFileData(fileName string, data []byte)

func (*Collection) AddFileFromReader

func (c *Collection) AddFileFromReader(name string, r io.Reader) (err error)

func (*Collection) AddFileToOutput

func (c *Collection) AddFileToOutput(file *File) (err error)

func (*Collection) AddFileYAML

func (c *Collection) AddFileYAML(fileName string, data interface{})

func (*Collection) AddFiles

func (c *Collection) AddFiles(prefix, source string)

func (*Collection) AddFilesAtLeastOne

func (c *Collection) AddFilesAtLeastOne(prefix string, sources ...string)

func (*Collection) AddGitRepoInfo

func (c *Collection) AddGitRepoInfo(fileName, path string)

func (*Collection) AddInstalledPackagesRaw

func (c *Collection) AddInstalledPackagesRaw(fileName string, pattern ...string)

func (*Collection) AddLogToOutput

func (c *Collection) AddLogToOutput() (err error)

func (*Collection) AddServiceStatusRaw

func (c *Collection) AddServiceStatusRaw(fileName, name string)

func (*Collection) Close

func (c *Collection) Close() error

type File

type File struct {
	Name     string
	Source   string
	Modified time.Time
	Data     []byte

	io.Writer
}

func LoadFiles

func LoadFiles(prefix, source string) (files []*File, err error)

func LoadFilesFromDirectory

func LoadFilesFromDirectory(prefix, source string) (files []*File, err error)

nolint:nakedret

func LoadFilesFromGlob

func LoadFilesFromGlob(prefix, source string) (files []*File, err error)

func NewFile

func NewFile(name string) *File

func NewFileFromReader

func NewFileFromReader(name string, r io.Reader) (*File, error)

func (*File) Write

func (f *File) Write(p []byte) (n int, err error)

type GitRepoInfo

type GitRepoInfo struct {
	Path       string
	HeadCommit string
	Remotes    string
	Describe   string
	Status     string
}

func LoadGitRepoInfo

func LoadGitRepoInfo(path string) (*GitRepoInfo, error)

Jump to

Keyboard shortcuts

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