system

package
v0.10.7 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2014 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizeSSHKeys

func AuthorizeSSHKeys(user string, keysName string, keys []string) error

Add the provide SSH public key to the core user's list of authorized keys

func CreateUser

func CreateUser(u *User) error

func EnsureDirectoryExists

func EnsureDirectoryExists(dir string) error

func ExecuteScript

func ExecuteScript(scriptPath string) (string, error)

func Hostname

func Hostname() (string, error)

func MachineID

func MachineID(root string) string

func RestartNetwork added in v0.7.4

func RestartNetwork(interfaces []network.InterfaceGenerator) (err error)

func SetHostname

func SetHostname(hostname string) error

func SetUserPassword

func SetUserPassword(user, hash string) error

func UserExists

func UserExists(u *User) bool

func WriteEnvFile added in v0.8.8

func WriteEnvFile(ef *EnvFile, root string) error

WriteEnvFile updates an existing env `KEY=value` formated file with new values provided in EnvFile.Vars; File.Content is ignored. Existing ordering and any unknown formatting such as comments are preserved. If no changes are required the file is untouched.

func WriteFile

func WriteFile(f *File, root string) (string, error)

func WriteNetworkdConfigs added in v0.7.4

func WriteNetworkdConfigs(interfaces []network.InterfaceGenerator) error

Types

type EnvFile added in v0.8.8

type EnvFile struct {
	Vars map[string]string
	// mask File.Content, it shouldn't be used.
	Content interface{} `json:"-" yaml:"-"`
	*File
}

type File

type File struct {
	Encoding           string
	Content            string
	Owner              string
	Path               string
	RawFilePermissions string `yaml:"permissions"`
}

func (*File) Permissions

func (f *File) Permissions() (os.FileMode, error)

type Script

type Script []byte

type Unit

type Unit struct {
	Name    string
	Mask    bool
	Enable  bool
	Runtime bool
	Content string
	Command string

	// For drop-in units, a cloudinit.conf is generated.
	// This is currently unbound in YAML (and hence unsettable in cloud-config files)
	// until the correct behaviour for multiple drop-in units is determined.
	DropIn bool `yaml:"-"`
}

func (*Unit) Destination added in v0.7.5

func (u *Unit) Destination(root string) string

Destination builds the appropriate absolute file path for the Unit. The root argument indicates the effective base directory of the system (similar to a chroot).

func (*Unit) Group

func (u *Unit) Group() (group string)

func (*Unit) Type

func (u *Unit) Type() string

type UnitManager added in v0.9.0

type UnitManager interface {
	PlaceUnit(unit *Unit, dst string) error
	EnableUnitFile(unit string, runtime bool) error
	RunUnitCommand(command, unit string) (string, error)
	DaemonReload() error
	MaskUnit(unit *Unit) error
	UnmaskUnit(unit *Unit) error
}

func NewUnitManager added in v0.9.0

func NewUnitManager(root string) UnitManager

type User

type User struct {
	Name                string   `yaml:"name"`
	PasswordHash        string   `yaml:"passwd"`
	SSHAuthorizedKeys   []string `yaml:"ssh-authorized-keys"`
	SSHImportGithubUser string   `yaml:"coreos-ssh-import-github"`
	SSHImportURL        string   `yaml:"coreos-ssh-import-url"`
	GECOS               string   `yaml:"gecos"`
	Homedir             string   `yaml:"homedir"`
	NoCreateHome        bool     `yaml:"no-create-home"`
	PrimaryGroup        string   `yaml:"primary-group"`
	Groups              []string `yaml:"groups"`
	NoUserGroup         bool     `yaml:"no-user-group"`
	System              bool     `yaml:"system"`
	NoLogInit           bool     `yaml:"no-log-init"`
}

Jump to

Keyboard shortcuts

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