os

package
v0.3.15 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: Apache-2.0 Imports: 7 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host interface {
	Upload(source string, destination string) error
	Exec(string, ...exec.Option) error
	ExecOutput(string, ...exec.Option) (string, error)
	Execf(string, ...interface{}) error
	ExecOutputf(string, ...interface{}) (string, error)
	String() string
}

Host is an interface to a host object that has the functions needed by the various OS support packages

type Linux

type Linux struct {
	// contains filtered or unexported fields
}

Linux is a base module for various linux OS support packages

func (Linux) CheckPrivilege

func (c Linux) CheckPrivilege(h Host) error

CheckPrivilege returns an error if the user does not have passwordless sudo enabled

func (Linux) CleanupEnvironment

func (c Linux) CleanupEnvironment(h Host, env map[string]string) error

CleanupEnvironment removes environment variable configuration

func (Linux) CommandExist

func (c Linux) CommandExist(h Host, cmd string) bool

CommandExist returns true if the command exists

func (Linux) DaemonReload

func (c Linux) DaemonReload(h Host) error

DaemonReload performs an init system config reload

func (Linux) DeleteFile

func (c Linux) DeleteFile(h Host, path string) error

DeleteFile deletes a file from the host.

func (Linux) DisableService

func (c Linux) DisableService(h Host, s string) error

DisableService disables a service on the host

func (Linux) EnableService

func (c Linux) EnableService(h Host, s string) error

EnableService enables a service on the host

func (Linux) FileExist

func (c Linux) FileExist(h Host, path string) bool

FileExist checks if a file exists on the host

func (Linux) FixContainer

func (c Linux) FixContainer(h Host) error

FixContainer makes a container work like a real host

func (Linux) Hostname

func (c Linux) Hostname(h Host) string

Hostname resolves the short hostname

func (Linux) IsContainer

func (c Linux) IsContainer(h Host) bool

IsContainer returns true if the host is actually a container

func (Linux) JoinPath

func (c Linux) JoinPath(parts ...string) string

JoinPath joins a path

func (Linux) Kind

func (c Linux) Kind() string

Kind returns "linux"

func (Linux) LineIntoFile

func (c Linux) LineIntoFile(h Host, path, matcher, newLine string) error

LineIntoFile tries to find a matching line in a file and replace it with a new entry TODO refactor this into go because it's too magical.

func (Linux) LongHostname

func (c Linux) LongHostname(h Host) string

LongHostname resolves the FQDN (long) hostname

func (Linux) Pwd

func (c Linux) Pwd(h Host) string

Pwd returns the current working directory of the session

func (Linux) ReadFile

func (c Linux) ReadFile(h Host, path string) (string, error)

ReadFile reads a files contents from the host.

func (Linux) Reboot

func (c Linux) Reboot(h Host) error

Reboot executes the reboot command

func (Linux) RestartService

func (c Linux) RestartService(h Host, s string) error

RestartService restarts a service on the host

func (Linux) SELinuxEnabled

func (c Linux) SELinuxEnabled(h Host) bool

SELinuxEnabled is true when SELinux is enabled

func (Linux) ServiceIsRunning

func (c Linux) ServiceIsRunning(h Host, s string) bool

ServiceIsRunning returns true if the service is running on the host

func (Linux) ServiceScriptPath

func (c Linux) ServiceScriptPath(h Host, s string) (string, error)

ServiceScriptPath returns the service definition file path on the host

func (Linux) StartService

func (c Linux) StartService(h Host, s string) error

StartService starts a service on the host

func (Linux) StopService

func (c Linux) StopService(h Host, s string) error

StopService stops a service on the host

func (Linux) UpdateEnvironment

func (c Linux) UpdateEnvironment(h Host, env map[string]string) error

UpdateEnvironment updates the hosts's environment variables

func (Linux) WriteFile

func (c Linux) WriteFile(h Host, path string, data string, permissions string) error

WriteFile writes file to host with given contents. Do not use for large files.

type Windows

type Windows struct{}

Windows is the base package for windows OS support

func (Windows) CheckPrivilege

func (c Windows) CheckPrivilege(h Host) error

CheckPrivilege returns an error if the user does not have admin access to the host

func (Windows) CleanupEnvironment

func (c Windows) CleanupEnvironment(h Host, env map[string]string) error

CleanupEnvironment removes environment variable configuration

func (Windows) CommandExist

func (c Windows) CommandExist(h Host, cmd string) bool

CommandExist returns true if the provided command exists

func (Windows) DaemonReload

func (c Windows) DaemonReload(_ Host) error

DaemonReload reloads init system configuration

func (Windows) DeleteFile

func (c Windows) DeleteFile(h Host, path string) error

DeleteFile deletes a file from the host.

func (Windows) DisableService

func (c Windows) DisableService(h Host, s string) error

DisableService disables a a service

func (Windows) EnableService

func (c Windows) EnableService(h Host, s string) error

EnableService enables a a service

func (Windows) FileExist

func (c Windows) FileExist(h Host, path string) bool

FileExist checks if a file exists on the host

func (Windows) FixContainer

func (c Windows) FixContainer(_ Host) error

FixContainer makes a container work like a real host (does nothing on windows for now)

func (Windows) Hostname

func (c Windows) Hostname(h Host) string

Hostname resolves the short hostname

func (Windows) InstallPackage

func (c Windows) InstallPackage(h Host, s ...string) error

InstallPackage enables an optional windows feature

func (Windows) IsContainer

func (c Windows) IsContainer(_ Host) bool

IsContainer returns true if the host is actually a container (always false on windows for now)

func (Windows) JoinPath

func (c Windows) JoinPath(parts ...string) string

JoinPath joins a path

func (Windows) Kind

func (c Windows) Kind() string

Kind returns "windows"

func (Windows) LongHostname

func (c Windows) LongHostname(h Host) string

LongHostname resolves the FQDN (long) hostname

func (Windows) Pwd

func (c Windows) Pwd(h Host) string

Pwd returns the current working directory

func (Windows) ReadFile

func (c Windows) ReadFile(h Host, path string) (string, error)

ReadFile reads a files contents from the host.

func (Windows) Reboot

func (c Windows) Reboot(h Host) error

Reboot executes the reboot command

func (Windows) RestartService

func (c Windows) RestartService(h Host, s string) error

RestartService restarts a a service

func (Windows) SELinuxEnabled

func (c Windows) SELinuxEnabled(_ Host) bool

SELinuxEnabled is true when SELinux is enabled (always false on windows for now)

func (Windows) ServiceIsRunning

func (c Windows) ServiceIsRunning(h Host, s string) bool

ServiceIsRunning returns true if a service is running

func (Windows) ServiceScriptPath

func (c Windows) ServiceScriptPath(h Host, s string) (string, error)

ServiceScriptPath returns the path to a service configuration file

func (Windows) StartService

func (c Windows) StartService(h Host, s string) error

StartService starts a a service

func (Windows) StopService

func (c Windows) StopService(h Host, s string) error

StopService stops a a service

func (Windows) UpdateEnvironment

func (c Windows) UpdateEnvironment(h Host, env map[string]string) error

UpdateEnvironment updates the hosts's environment variables

func (Windows) WriteFile

func (c Windows) WriteFile(h Host, path string, data string, permissions string) error

WriteFile writes file to host with given contents. Do not use for large files. The permissions argument is ignored on windows.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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