Documentation ¶
Index ¶
- Constants
- func CBufToGoPtr(s [C.PART_INFO_BUF_SIZE]C.char) *string
- func CBufToGoStr(s [C.PART_INFO_BUF_SIZE]C.char) string
- func CreateDeviceAlias(path string) (string, error)
- func DeviceAlias(path string) string
- func DumpPartitionTable(device string) ([]types.Partition, error)
- func FilesystemLabel(device string) (string, error)
- func FilesystemType(device string) (string, error)
- func FilesystemUUID(device string) (string, error)
- func MkdirForFile(path string) error
- func NetworkdDropinsPath(unitName string) string
- func NetworkdUnitsPath() string
- func SystemdDropinsPath(unitName string) string
- func SystemdRuntimeDropinsPath(unitName string) string
- func SystemdRuntimeUnitWantsPath(unitName string) string
- func SystemdRuntimeUnitsPath() string
- func SystemdUnitsPath() string
- type FetchOp
- func FileFromNetworkdUnit(unit types.Networkdunit) (*FetchOp, error)
- func FileFromNetworkdUnitDropin(unit types.Networkdunit, dropin types.NetworkdDropin) (*FetchOp, error)
- func FileFromSystemdUnit(unit types.Unit, runtime bool) (*FetchOp, error)
- func FileFromSystemdUnitDropin(unit types.Unit, dropin types.SystemdDropin, runtime bool) (*FetchOp, error)
- type Util
- func (u Util) AuthorizeSSHKeys(c types.PasswdUser) error
- func (u Util) CheckIfUserExists(c types.PasswdUser) (bool, error)
- func (u Util) CreateGroup(g types.PasswdGroup) error
- func (u Util) DeletePathOnOverwrite(n types.Node) error
- func (u Util) DisableUnit(unit types.Unit) error
- func (u Util) EnableRuntimeUnit(unit types.Unit, target string) error
- func (u Util) EnableUnit(unit types.Unit) error
- func (u Util) EnsureUser(c types.PasswdUser) error
- func (u Util) JoinPath(path ...string) (string, error)
- func (u Util) MaskUnit(unit types.Unit) error
- func (u Util) PathExists(path string) (bool, error)
- func (u Util) PerformFetch(f *FetchOp) error
- func (u Util) PrepareFetch(l *log.Logger, f types.File) *FetchOp
- func (u Util) ResolveNodeUidAndGid(n types.Node, defaultUid, defaultGid int) (int, int, error)
- func (u Util) SetPasswordHash(c types.PasswdUser) error
- func (u Util) WriteLink(s types.Link) error
Constants ¶
const ( DefaultDirectoryPermissions os.FileMode = 0755 DefaultFilePermissions os.FileMode = 0644 )
const ( PresetPath string = "/etc/systemd/system-preset/20-ignition.preset" DefaultPresetPermissions os.FileMode = 0644 )
Variables ¶
This section is empty.
Functions ¶
func CBufToGoPtr ¶
func CBufToGoPtr(s [C.PART_INFO_BUF_SIZE]C.char) *string
func CBufToGoStr ¶
func CBufToGoStr(s [C.PART_INFO_BUF_SIZE]C.char) string
func CreateDeviceAlias ¶
CreateDeviceAlias creates a device alias for the supplied path. On success the canonicalized path used as the alias target is returned.
func DeviceAlias ¶
DeviceAlias returns the aliased form of the supplied path. Note device paths in ignition are always absolute.
func DumpPartitionTable ¶
DumpPartitionTable returns a list of all partitions on device (e.g. /dev/vda). The list of partitions returned is unordered.
func FilesystemLabel ¶
func FilesystemType ¶
func FilesystemUUID ¶
func MkdirForFile ¶
MkdirForFile helper creates the directory components of path.
func NetworkdDropinsPath ¶
func NetworkdUnitsPath ¶
func NetworkdUnitsPath() string
func SystemdDropinsPath ¶
func SystemdRuntimeUnitsPath ¶
func SystemdRuntimeUnitsPath() string
func SystemdUnitsPath ¶
func SystemdUnitsPath() string
Types ¶
type FetchOp ¶
type FetchOp struct { Hash hash.Hash Path string Url url.URL Mode *int FetchOptions resource.FetchOptions Overwrite *bool Append bool Node types.Node }
func FileFromNetworkdUnit ¶
func FileFromNetworkdUnit(unit types.Networkdunit) (*FetchOp, error)
func FileFromNetworkdUnitDropin ¶
func FileFromNetworkdUnitDropin(unit types.Networkdunit, dropin types.NetworkdDropin) (*FetchOp, error)
func FileFromSystemdUnit ¶
type Util ¶
type Util struct { DestDir string // directory prefix to use in applying fs paths. Root string // path to rootfs for resolving uids and gids IsRoot bool // whether or not DestDir is the root filesystem 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 ¶
func (u Util) CheckIfUserExists(c types.PasswdUser) (bool, error)
CheckIfUserExists will return Info log when user is empty
func (Util) CreateGroup ¶
func (u Util) CreateGroup(g types.PasswdGroup) error
CreateGroup creates the group as described.
func (Util) EnableRuntimeUnit ¶
presets link in /etc, which doesn't make sense for runtime units Related: https://github.com/deeliciouscode/ignition/issues/588
func (Util) EnsureUser ¶
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) JoinPath ¶
JoinPath returns a path into the context ala filepath.Join(d, args) If u.IsRoot is true, it resolves symlinks as if they were rooted at u.DestDir. This means that the resulting path will always be under u.DestDir. If u.IsRoot is false, it fails if a symlink resolves such that it would escape u.DestDir. The last element of the path is never followed.
func (Util) PathExists ¶
PathExists returns true if a node exists within DestDir, false otherwise. Any error other than ENOENT is treated as fatal.
func (Util) PerformFetch ¶
PerformFetch performs a fetch operation generated by PrepareFetch, retrieving the file and writing it to disk. Any encountered errors are returned.
func (Util) PrepareFetch ¶
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) ResolveNodeUidAndGid ¶
ResolveNodeUidAndGid attempts to convert a types.Node into a concrete uid and gid. If the node has the User.ID field set, that's used for the uid. If the node has the User.Name field set, a username -> uid lookup is performed. If neither are set, it returns the passed in defaultUid. The logic is identical for gids with equivalent fields.
func (Util) SetPasswordHash ¶
func (u Util) SetPasswordHash(c types.PasswdUser) error
SetPasswordHash sets the password hash of the specified user.