coreos

package
v0.0.0-...-a064a87 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the prefix given to all the functions in this module.
	ModuleName = "os"
)
View Source
const (
	// ReadFileFuncName is the name this function is registered as.
	ReadFileFuncName = "readfile"
)
View Source
const (
	// SystemFuncName is the name this function is registered as.
	SystemFuncName = "system"
)

Variables

This section is empty.

Functions

func Args

Args returns the `argv` of the current process. Keep in mind that this will return different values depending on how this is deployed, so don't expect a result on your deploy client to behave the same as a server receiving code. FIXME: Sanitize any command-line secrets we might pass in by cli.

func ExpandHome

func ExpandHome(ctx context.Context, input []types.Value) (types.Value, error)

ExpandHome expands any tilde patterns in the input path according to the currently running user. While most of the time its likely this is `root`, there is no reason the program is necessarily running as root!

func Family

func Family(ctx context.Context, input []types.Value) (types.Value, error)

Family returns the distro family. TODO: Detect OS changes.

func IsFamilyArchLinux

func IsFamilyArchLinux(ctx context.Context, input []types.Value) (types.Value, error)

IsFamilyArchLinux detects if the os family is archlinux. TODO: Detect OS changes.

func IsFamilyDebian

func IsFamilyDebian(ctx context.Context, input []types.Value) (types.Value, error)

IsFamilyDebian detects if the os family is debian. TODO: Detect OS changes.

func IsFamilyRedHat

func IsFamilyRedHat(ctx context.Context, input []types.Value) (types.Value, error)

IsFamilyRedHat detects if the os family is redhat. TODO: Detect OS changes.

func ParseDistroUID

func ParseDistroUID(ctx context.Context, input []types.Value) (types.Value, error)

ParseDistroUID parses a distro UID into its component values. If it cannot parse correctly, all the struct fields have the zero values. NOTE: The UID pattern is subject to change.

Types

type ReadFileFunc

type ReadFileFunc struct {
	// contains filtered or unexported fields
}

ReadFileFunc is a function that reads the full contents from a local file. If the file contents change or the file path changes, a new string will be sent. Please note that this is different from the readfile function in the deploy package.

func (*ReadFileFunc) ArgGen

func (obj *ReadFileFunc) ArgGen(index int) (string, error)

ArgGen returns the Nth arg name for this function.

func (*ReadFileFunc) Info

func (obj *ReadFileFunc) Info() *interfaces.Info

Info returns some static info about itself.

func (*ReadFileFunc) Init

func (obj *ReadFileFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*ReadFileFunc) Stream

func (obj *ReadFileFunc) Stream(ctx context.Context) error

Stream returns the changing values that this func has over time.

func (*ReadFileFunc) String

func (obj *ReadFileFunc) String() string

String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.

func (*ReadFileFunc) Validate

func (obj *ReadFileFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

type SystemFunc

type SystemFunc struct {
	// contains filtered or unexported fields
}

SystemFunc runs a string as a shell command, then produces each line from stdout. If the input string changes, then the commands are executed one after the other and the concatenation of their outputs is produced line by line.

Note that in the likely case in which the process emits several lines one after the other, the downstream resources might not run for every line unless the "Meta:realize" metaparam is set to true.

func (*SystemFunc) ArgGen

func (obj *SystemFunc) ArgGen(index int) (string, error)

ArgGen returns the Nth arg name for this function.

func (*SystemFunc) Info

func (obj *SystemFunc) Info() *interfaces.Info

Info returns some static info about itself.

func (*SystemFunc) Init

func (obj *SystemFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*SystemFunc) Stream

func (obj *SystemFunc) Stream(ctx context.Context) error

Stream returns the changing values that this func has over time.

func (*SystemFunc) String

func (obj *SystemFunc) String() string

String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.

func (*SystemFunc) Validate

func (obj *SystemFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

Jump to

Keyboard shortcuts

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