util

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2016 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDirectoryPermissions os.FileMode = 0755
	DefaultFilePermissions      os.FileMode = 0644
)
View Source
const (
	DefaultPresetPermissions os.FileMode = 0644
)

Variables

View Source
var (
	ErrSchemeUnsupported = errors.New("unsupported source scheme")
	ErrStatusBad         = errors.New("bad HTTP response status")
)

Functions

func NetworkdUnitsPath

func NetworkdUnitsPath() string

func SystemdDropinsPath

func SystemdDropinsPath(unitName string) string

func SystemdUnitsPath

func SystemdUnitsPath() string

Types

type File

type File struct {
	Path     types.Path
	Contents []byte
	Mode     os.FileMode
	Uid      int
	Gid      int
}

func FileFromNetworkdUnit

func FileFromNetworkdUnit(unit types.NetworkdUnit) *File

func FileFromSystemdUnit

func FileFromSystemdUnit(unit types.SystemdUnit) *File

func FileFromUnitDropin

func FileFromUnitDropin(unit types.SystemdUnit, dropin types.SystemdUnitDropIn) *File

func RenderFile

func RenderFile(l *log.Logger, f types.File) *File

type Util

type Util struct {
	DestDir string // directory prefix to use in applying fs paths.
	*log.Logger
}

Util encapsulates logging and destdir indirection for the util methods.

func (Util) AuthorizeSSHKeys

func (u Util) AuthorizeSSHKeys(c types.User) error

Add the provided SSH public keys to the user's authorized keys.

func (Util) CreateGroup

func (u Util) CreateGroup(g types.Group) error

CreateGroup creates the group as described.

func (Util) CreateUser

func (u Util) CreateUser(c types.User) error

CreateUser creates the user as described.

func (Util) EnableUnit

func (u Util) EnableUnit(unit types.SystemdUnit) error

func (Util) JoinPath

func (u Util) JoinPath(path ...string) string

JoinPath returns a path into the context ala filepath.Join(d, args)

func (Util) MaskUnit

func (u Util) MaskUnit(unit types.SystemdUnit) error

func (Util) SetPasswordHash

func (u Util) SetPasswordHash(c types.User) error

SetPasswordHash sets the password hash of the specified user.

func (Util) WriteFile

func (u Util) WriteFile(f *File) error

WriteFile creates and writes the file described by f using the provided context

Jump to

Keyboard shortcuts

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