aboutsummaryrefslogtreecommitdiff
path: root/zabbix/workdir.go
diff options
context:
space:
mode:
authorJulien Dessaux2021-04-23 16:51:22 +0200
committerJulien Dessaux2021-04-23 16:51:22 +0200
commit38d9c881b3b5ece91f428c87f0b7bb9efb3e88a8 (patch)
treed3f7167fae6388f4db35a63e660d1816c9c2943e /zabbix/workdir.go
parentFixed wrongfully hardcoded path in tests. (diff)
downloadbareos-zabbix-check-38d9c881b3b5ece91f428c87f0b7bb9efb3e88a8.tar.gz
bareos-zabbix-check-38d9c881b3b5ece91f428c87f0b7bb9efb3e88a8.tar.bz2
bareos-zabbix-check-38d9c881b3b5ece91f428c87f0b7bb9efb3e88a8.zip
Updated for go 1.16 modules1.2
Diffstat (limited to 'zabbix/workdir.go')
-rw-r--r--zabbix/workdir.go38
1 files changed, 0 insertions, 38 deletions
diff --git a/zabbix/workdir.go b/zabbix/workdir.go
deleted file mode 100644
index 287c80a..0000000
--- a/zabbix/workdir.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package zabbix
-
-import (
- "fmt"
- "os"
- "path/filepath"
-)
-
-const (
- bareosWorkDir = "/var/lib/bareos"
- baculaWorkDir = "/var/lib/bacula"
-)
-
-var root = "/"
-
-// checkWorkDir checks if a work directory is valid
-func checkWorkDir() error {
- // Determine the work directory to use.
- if workDir != "" {
- workDir = filepath.Join(root, workDir)
- info, err := os.Stat(workDir)
- if os.IsNotExist(err) || !info.IsDir() {
- return fmt.Errorf("Invalid work directory %s : it does not exist or is not a directory", workDir)
- }
- } else {
- workDir = filepath.Join(root, bareosWorkDir)
- info, err := os.Stat(workDir)
- if os.IsNotExist(err) || !info.IsDir() {
- workDir = filepath.Join(root, baculaWorkDir)
- info, err := os.Stat(workDir)
- if os.IsNotExist(err) || !info.IsDir() {
- return fmt.Errorf("Could not find a suitable work directory. Is bareos or bacula installed?")
- }
- }
- }
- workDir = filepath.Clean(workDir)
- return nil
-}