system

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2014 License: Apache-2.0 Imports: 13 Imported by: 109

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 DaemonReload

func DaemonReload() error

func EnableUnitFile

func EnableUnitFile(file string, runtime bool) 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 PlaceUnit

func PlaceUnit(u *Unit, dst string) error

PlaceUnit writes a unit file at the provided destination, creating parent directories as necessary.

func RunUnitCommand

func RunUnitCommand(command, unit string) (string, error)

func SetHostname

func SetHostname(hostname string) error

func SetUserPassword

func SetUserPassword(user, hash string) error

func UnitDestination

func UnitDestination(u *Unit, root string) string

UnitDestination builds the appropriate absolte file path for the given unit. The root argument indicates the effective base directory of the system (similar to a chroot).

func UserExists

func UserExists(u *User) bool

func WriteFile

func WriteFile(f *File) error

Types

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
	Enable  bool
	Runtime bool
	Content string
	Command string
}

func (*Unit) Group

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

func (*Unit) Type

func (u *Unit) Type() string

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