mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
Minor changes and fixes
This commit is contained in:
parent
6bf9035d96
commit
b873613939
4 changed files with 17 additions and 6 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
magellan "github.com/OpenCHAMI/magellan/internal"
|
magellan "github.com/OpenCHAMI/magellan/internal"
|
||||||
"github.com/OpenCHAMI/magellan/internal/api/smd"
|
"github.com/OpenCHAMI/magellan/internal/api/smd"
|
||||||
"github.com/OpenCHAMI/magellan/internal/db/sqlite"
|
"github.com/OpenCHAMI/magellan/internal/db/sqlite"
|
||||||
|
|
@ -37,6 +39,10 @@ var collectCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if verbose {
|
||||||
|
fmt.Printf("access token: %v\n", accessToken)
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
if threads <= 0 {
|
if threads <= 0 {
|
||||||
threads = mathutil.Clamp(len(probeStates), 1, 255)
|
threads = mathutil.Clamp(len(probeStates), 1, 255)
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,11 @@ func LoadAccessToken() (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: try to load token from config
|
// TODO: try to load token from config
|
||||||
return "", fmt.Errorf("could not load from environment variable or file")
|
testToken = viper.GetString("access_token")
|
||||||
|
if testToken != "" {
|
||||||
|
return testToken, nil
|
||||||
|
}
|
||||||
|
return "", fmt.Errorf("could not load token from environment variable, file, or config")
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
||||||
10
config.yaml
10
config.yaml
|
|
@ -1,12 +1,12 @@
|
||||||
scan:
|
scan:
|
||||||
hosts:
|
hosts:
|
||||||
- "172.16.1.15"
|
- "172.16.1.15"
|
||||||
subnets:
|
subnets:
|
||||||
- "172.16.0.0"
|
- "172.16.0.0"
|
||||||
- "172.16.0.0/24"
|
- "172.16.0.0/24"
|
||||||
subnet-masks:
|
subnet-masks:
|
||||||
ports:
|
ports:
|
||||||
- 433
|
- 433
|
||||||
disable-probing: false
|
disable-probing: false
|
||||||
collect:
|
collect:
|
||||||
# host: smd-host
|
# host: smd-host
|
||||||
|
|
@ -21,7 +21,7 @@ collect:
|
||||||
secure-tls: false
|
secure-tls: false
|
||||||
cert-pool:
|
cert-pool:
|
||||||
drivers:
|
drivers:
|
||||||
- "redfish"
|
- "redfish"
|
||||||
ipmitool:
|
ipmitool:
|
||||||
path: "/usr/bin/ipmitool"
|
path: "/usr/bin/ipmitool"
|
||||||
update:
|
update:
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ func CreateProbeResultsIfNotExists(path string) (*sqlx.DB, error) {
|
||||||
PRIMARY KEY (host, port)
|
PRIMARY KEY (host, port)
|
||||||
);
|
);
|
||||||
`
|
`
|
||||||
|
// TODO: it may help with debugging to check for file permissions here first
|
||||||
db, err := sqlx.Open("sqlite3", path)
|
db, err := sqlx.Open("sqlite3", path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not open database: %v", err)
|
return nil, fmt.Errorf("could not open database: %v", err)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue