helpers

package
v3.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ENOVERSION is returned when an a version is unknown
	ENOVERSION = 24
)

Functions

func CheckRPM

func CheckRPM(rpm string) error

CheckRPM returns nil if file <name>.rpm shows a valid RPM v# output, in order to catch corrupt or invalid RPM files.

func CopyFile

func CopyFile(dest string, src string) error

CopyFile is used during the build process to copy a given file to the target instead of dealing with the particulars of hardlinking.

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 Download

func Download(filename string, url string) (err error)

Download will attempt to download a from URL to the given filename

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 GetDirContents

func GetDirContents(dirname string) []os.FileInfo

GetDirContents is an an assert-style helper to get the contents of a directory, or to exit on failure.

func GetIncludedBundles

func GetIncludedBundles(filename string) ([]string, error)

GetIncludedBundles parses a bundle definition file and returns a list of all bundles it includes.

func Git

func Git(args ...string)

Git runs git with arguments and exits 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 PrintError

func PrintError(e error)

PrintError is a utility function to emit an error to the console

func ReadFileAndSplit

func ReadFileAndSplit(filename string) ([]string, error)

ReadFileAndSplit tokenizes the given file and converts in into a slice split by the newline character.

Types

This section is empty.

Jump to

Keyboard shortcuts

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