[WIP] v0.7.0 almost ready to release
Some checks failed
ci/woodpecker/push/go-lint Pipeline failed

This commit is contained in:
2025-02-10 16:55:54 -06:00
parent e20141043c
commit c3de4386ab
3 changed files with 22 additions and 2 deletions

View File

@ -15,8 +15,10 @@ var (
}
)
// Holds command list to run
// Holds list of hosts to run commands on
var hostsList []string
// Holds command list to run
var cmdList []string
func init() {
@ -48,7 +50,13 @@ func Host(cmd *cobra.Command, args []string) {
for _, h := range hostsList {
_, hostFound := backyConfOpts.Hosts[h]
if !hostFound {
logging.ExitWithMSG("host "+h+" not found", 1, &backyConfOpts.Logger)
// check if h exists in the config file
hostFoundInConfig, s := backy.CheckIfHostHasHostName(h)
if !hostFoundInConfig {
logging.ExitWithMSG("host "+h+" not found", 1, &backyConfOpts.Logger)
}
// create host with hostname and host
backyConfOpts.Hosts[h] = &backy.Host{Host: h, HostName: s}
}
}
if cmdList == nil {