util

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2017 License: Apache-2.0 Imports: 23 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

This section is empty.

Functions

func AssertValid added in v0.10.1

func AssertValid(verify types.Verification, data []byte) error

func CreateDeviceAlias added in v0.10.1

func CreateDeviceAlias(path string) (string, error)

CreateDeviceAlias creates a device alias for the supplied path. On success the canonicalized path used as the alias target is returned.

func DeviceAlias added in v0.10.1

func DeviceAlias(path string) string

DeviceAlias returns the aliased form of the supplied path. Note device paths in ignition are always absolute.

func FilesystemLabel added in v0.15.0

func FilesystemLabel(device string) (string, error)

func FilesystemType added in v0.15.0

func FilesystemType(device string) (string, error)

func FilesystemUUID added in v0.15.0

func FilesystemUUID(device string) (string, error)

func GetHasher added in v0.10.1

func GetHasher(verify types.Verification) (hash.Hash, error)

func MkdirForFile added in v0.13.0

func MkdirForFile(path string) error

MkdirForFile helper creates the directory components of path.

func NetworkdUnitsPath

func NetworkdUnitsPath() string

func SystemdDropinsPath

func SystemdDropinsPath(unitName string) string

func SystemdUnitsPath

func SystemdUnitsPath() string

Types

type FetchOp added in v0.17.0

type FetchOp struct {
	Hash         hash.Hash
	Path         string
	Mode         os.FileMode
	Uid          int
	Gid          int
	Url          url.URL
	FetchOptions resource.FetchOptions
}

func FileFromNetworkdUnit

func FileFromNetworkdUnit(unit types.Networkdunit) (*FetchOp, error)

func FileFromSystemdUnit

func FileFromSystemdUnit(unit types.Unit) (*FetchOp, error)

func FileFromUnitDropin

func FileFromUnitDropin(unit types.Unit, dropin types.Dropin) (*FetchOp, error)

type Util

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

Util encapsulates logging and destdir indirection for the util methods.

func (Util) AuthorizeSSHKeys

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

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

func (Util) CheckIfUserExists added in v0.15.0

func (u Util) CheckIfUserExists(c types.PasswdUser) (bool, error)

func (Util) CreateGroup

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

CreateGroup creates the group as described.

func (Util) DisableUnit added in v0.17.0

func (u Util) DisableUnit(unit types.Unit) error

func (Util) EnableUnit

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

func (Util) EnsureUser added in v0.15.0

func (u Util) EnsureUser(c types.PasswdUser) error

EnsureUser ensures that the user exists as described. If the user does not yet exist, they will be created, otherwise the existing user will be modified.

func (Util) GetUserGroupID added in v0.18.0

func (u Util) GetUserGroupID(l *log.Logger, user types.NodeUser, group types.NodeGroup) (*int, *int)

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.Unit) error

func (Util) PerformFetch added in v0.17.0

func (u Util) PerformFetch(f *FetchOp) error

PerformFetch performs a fetch operation generated by PrepareFetch, retrieving the file and writing it to disk. Any encountered errors are returned.

func (Util) PrepareFetch added in v0.17.0

func (u Util) PrepareFetch(l *log.Logger, f types.File) *FetchOp

PrepareFetch converts a given logger, http client, and types.File into a FetchOp. This includes operations such as parsing the source URL, generating a hasher, and performing user/group name lookups. If an error is encountered, the issue will be logged and nil will be returned.

func (Util) SetPasswordHash

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

SetPasswordHash sets the password hash of the specified user.

func (u Util) WriteLink(s types.Link) error

Jump to

Keyboard shortcuts

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