Documentation ¶
Index ¶
- Constants
- func CheckUser(cfg config.Cfg) bool
- func CleanTmpDir(cfg config.Cfg) bool
- func DirectoryExists(dir string) (bool, os.FileInfo)
- func EnsureConfigDirIsGitRepo(cfg config.Cfg) (bool, error)
- func ExecCommand(fullCommand string, arg ...string) ([]byte, int, error)
- func FileExists(fn string) (bool, os.FileInfo)
- func GetGitConfigSafeDir(cfg config.Cfg) error
- func IsGitLockFileOld(lockFile string, now time.Time, maxAge time.Duration) (bool, error)
- func MakeGitCommitAll(cfg config.Cfg, self bool, success bool) error
- func MkDir(name string, reportOnly bool) bool
- func MkDirWithOwner(name string, reportOnly bool, uid *int, gid *int) bool
- func PackageAction(cmdstr string, name string) (bool, error)
- func PackageInfo(cmdstr string, name string) ([]string, error)
- func RandomDuration(max time.Duration) time.Duration
- func ReadFile(fn string) ([]byte, error)
- func RemoveGitLock(lockFile string) error
- func ServiceStart(service string, cmd string) (bool, error)
- func Touch(fn string) error
- func UpdateMaxmind(maxmindlocation string, tsconfigdir string, reportonly bool) bool
- func WriteFileWithOwner(fn string, data []byte, uid *int, gid *int, perm os.FileMode) (int, error)
- type FileLock
- type ServiceStatus
Constants ¶
const GitChangeIsSelf = true
const GitChangeNotSelf = false
const GitSafeDir = "safe.directory"
const OneWeek = 604800
Variables ¶
This section is empty.
Functions ¶
func CleanTmpDir ¶
func EnsureConfigDirIsGitRepo ¶
EnsureConfigDirIsGitRepo ensures the ATS config directory is a git repo. Returns whether it tried to create a git repo, and any error. Note the return will be (false, nil) if a git repo already exists. Note true and a non-nil error may be returned, if creating a git repo is necessary and attempted and fails.
func GetGitConfigSafeDir ¶
GetGitConfigSafeDir checks that TsConfigDir has been configured as a safe directory. if not it will be added to the git config this will prevent the fatal: detected dubious ownership error
func IsGitLockFileOld ¶
func MakeGitCommitAll ¶
makeGitCommitAll makes a git commit of all changes in cfg.TsConfigDir, including untracked files.
func PackageInfo ¶
runs the rpm command. if the return code from rpm == 0, then a valid package list is returned.
if the return code is 1, the the 'name' queried for is not part of a
package or is not installed.
otherwise, if the return code is not 0 or 1 and error is set, a general rpm command execution error is assumed and the error is returned.
func RemoveGitLock ¶
func ServiceStart ¶
start or restart the service 'service'. cmd is 'start | restart'
func UpdateMaxmind ¶
Types ¶
type FileLock ¶
type FileLock struct {
// contains filtered or unexported fields
}
type ServiceStatus ¶
type ServiceStatus int
const ( SvcNotRunning ServiceStatus = 0 SvcRunning ServiceStatus = 1 SvcUnknown ServiceStatus = 2 )
func GetServiceStatus ¶
func GetServiceStatus(name string) (ServiceStatus, int, error)
func (ServiceStatus) String ¶
func (s ServiceStatus) String() string