Documentation ¶
Index ¶
- func AuthorizeSSHKeys(user string, keysName string, keys []string) error
- func CreateUser(u *User) error
- func DaemonReload() error
- func EnableUnitFile(unit string, runtime bool) error
- func EnsureDirectoryExists(dir string) error
- func ExecuteScript(scriptPath string) (string, error)
- func Hostname() (string, error)
- func MachineID(root string) string
- func MaskUnit(unit *Unit, root string) error
- func PlaceUnit(u *Unit, dst string) error
- func RestartNetwork(interfaces []network.InterfaceGenerator) (err error)
- func RunUnitCommand(command, unit string) (string, error)
- func SetHostname(hostname string) error
- func SetUserPassword(user, hash string) error
- func UnmaskUnit(unit *Unit, root string) error
- func UserExists(u *User) bool
- func WriteFile(f *File, root string) (string, error)
- func WriteNetworkdConfigs(interfaces []network.InterfaceGenerator) error
- type File
- type Script
- type Unit
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthorizeSSHKeys ¶
Add the provide SSH public key to the core user's list of authorized keys
func CreateUser ¶
func DaemonReload ¶
func DaemonReload() error
func EnableUnitFile ¶
func EnsureDirectoryExists ¶
func ExecuteScript ¶
func MaskUnit ¶ added in v0.6.0
MaskUnit masks the given Unit by symlinking its unit file to /dev/null, analogous to `systemctl mask`. N.B.: Unlike `systemctl mask`, this function will *remove any existing unit file at the location*, to ensure that the mask will succeed.
func PlaceUnit ¶
PlaceUnit writes a unit file at the provided destination, creating parent directories as necessary.
func RestartNetwork ¶ added in v0.7.4
func RestartNetwork(interfaces []network.InterfaceGenerator) (err error)
func RunUnitCommand ¶
func SetHostname ¶
func SetUserPassword ¶
func UnmaskUnit ¶ added in v0.7.5
UnmaskUnit is analogous to systemd's unit_file_unmask. If the file associated with the given Unit is empty or appears to be a symlink to /dev/null, it is removed.
func UserExists ¶
func WriteNetworkdConfigs ¶ added in v0.7.4
func WriteNetworkdConfigs(interfaces []network.InterfaceGenerator) error
Types ¶
type File ¶
type Unit ¶
type Unit struct { Name string Mask bool Enable bool Runtime bool Content string Command string // For drop-in units, a cloudinit.conf is generated. // This is currently unbound in YAML (and hence unsettable in cloud-config files) // until the correct behaviour for multiple drop-in units is determined. DropIn bool `yaml:"-"` }
func (*Unit) Destination ¶ added in v0.7.5
Destination builds the appropriate absolute file path for the Unit. The root argument indicates the effective base directory of the system (similar to a chroot).
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"` }