Documentation ¶
Index ¶
- func CopyFile(dest string, src string) error
- func CopyFileNoOverwrite(dest string, src string) error
- func CreateCertTemplate() *x509.Certificate
- func CreateKeyPair() (*rsa.PrivateKey, error)
- func DownloadFile(url string, filePath string) error
- func DownloadFileAsString(url string) (string, error)
- func GenerateCertificate(cert string, template, parent *x509.Certificate, pubkey interface{}, ...) error
- func Git(args ...string) error
- func ListVisibleFiles(dirname string) ([]string, error)
- func ReadFileAndSplit(filename string) ([]string, error)
- func RunCommand(cmdname string, args ...string) error
- func RunCommandInput(in io.Reader, cmdname string, args ...string) error
- func RunCommandOutput(cmdname string, args ...string) (*bytes.Buffer, error)
- func RunCommandOutputEnv(cmdname string, args []string, envs []string) (*bytes.Buffer, error)
- func RunCommandSilent(cmdname string, args ...string) error
- func RunCommandTimeout(timeout int, cmdname string, args ...string) error
- func UnpackFile(file string, dest string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyFileNoOverwrite ¶
CopyFileNoOverwrite copies a file only if the destination file does not exist.
func CreateCertTemplate ¶
func CreateCertTemplate() *x509.Certificate
CreateCertTemplate will construct the template for needed openssl metadata instead of using an attributes.cnf file
func CreateKeyPair ¶
func CreateKeyPair() (*rsa.PrivateKey, error)
CreateKeyPair constructs an RSA keypair in memory
func DownloadFile ¶
DownloadFile will download a file from the passed URL and write that file to the supplied file path. If the path is left empty, the file name will be inferred from the source and written to PWD.
func DownloadFileAsString ¶
DownloadFileAsString will download a file from the passed URL and return the result as a string.
func GenerateCertificate ¶
func GenerateCertificate(cert string, template, parent *x509.Certificate, pubkey interface{}, privkey interface{}) error
GenerateCertificate will create the private signing key and public certificate for clients to use and writes them to disk
func Git ¶
Git runs git with arguments and returns in case of failure. IMPORTANT: the 'args' passed to this function _must_ be validated, as to avoid cases where input is received from a third party source. Such inputs could be something the likes of 'status; rm -rf .*' and need to be escaped or avoided properly.
func ListVisibleFiles ¶
ListVisibleFiles reads the directory named by dirname and returns a sorted list of names
func ReadFileAndSplit ¶
ReadFileAndSplit tokenizes the given file and converts in into a slice split by the newline character.
func RunCommand ¶
RunCommand runs the given command with args and prints output
func RunCommandInput ¶
RunCommandInput runs the given command with args and input from an io.Reader, and prints output
func RunCommandOutput ¶
RunCommandOutput executes the command with arguments and stores its output in memory. If the command succeeds returns that output, if it fails, return err that contains both the out and err streams from the execution.
func RunCommandOutputEnv ¶
RunCommandOutputEnv executes the command with arguments and environment and stores its output in memory. If the command succeeds returns that output, if it fails, return err that contains both the out and err streams from the execution.
func RunCommandSilent ¶
RunCommandSilent runs the given command with args and does not print output
func RunCommandTimeout ¶
RunCommandTimeout runs the given command with timeout + args and does not print command output
func UnpackFile ¶
UnpackFile unpacks a .tar or .tar.gz/.tgz file to a given directory. Should be roughly equivalent to "tar -x[z]f file -C dest". Does not overwrite; returns error if file being unpacked already exists.
Types ¶
This section is empty.