diff options
author | Julien Dessaux | 2020-02-24 23:05:45 +0100 |
---|---|---|
committer | Julien Dessaux | 2020-02-25 09:46:38 +0100 |
commit | cadb15f7afb5e7c88667eb4006209efca17744af (patch) | |
tree | 7e8e9e55c22bd4d195caf2b1dc1123500443ce75 /config/statefile.go | |
parent | Added tests to the spool package, and reworked the code around that. (diff) | |
download | bareos-zabbix-check-cadb15f7afb5e7c88667eb4006209efca17744af.tar.gz bareos-zabbix-check-cadb15f7afb5e7c88667eb4006209efca17744af.tar.bz2 bareos-zabbix-check-cadb15f7afb5e7c88667eb4006209efca17744af.zip |
Added tests to the main package and completely reworked the code around that1.0
Diffstat (limited to 'config/statefile.go')
-rw-r--r-- | config/statefile.go | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/config/statefile.go b/config/statefile.go deleted file mode 100644 index 22fd214..0000000 --- a/config/statefile.go +++ /dev/null @@ -1,39 +0,0 @@ -package config - -import ( - "fmt" - "log" - "os" - "path/filepath" -) - -const ( - bareosStateFile = "bareos-fd.9102.state" - baculaStateFile = "bacula-fd.9102.state" -) - -func (c *Config) checkStateFile() { - // Finds the state file to parse - if c.stateFile != "" { - c.stateFile = filepath.Join(c.workDir, c.stateFile) - info, err := os.Stat(c.stateFile) - if os.IsNotExist(err) || info.IsDir() { - fmt.Printf("INFO The state file %s does not exist.\n", c.stateFile) - os.Exit(0) - } - } else { - c.stateFile = filepath.Join(c.workDir, bareosStateFile) - info, err := os.Stat(c.stateFile) - if os.IsNotExist(err) || info.IsDir() { - c.stateFile = filepath.Join(c.workDir, baculaStateFile) - info, err = os.Stat(c.stateFile) - if os.IsNotExist(err) || info.IsDir() { - fmt.Println("INFO Could not find a suitable state file. Has a job ever run?") - os.Exit(0) - } - } - } - if c.verbose { - log.Println("Using state file ", c.stateFile) - } -} |