forked from toolshed/abra
fix: set default logger on kadabra
This commit is contained in:
parent
4ccb4198d6
commit
f2e076b35f
@ -16,6 +16,7 @@ import (
|
|||||||
"coopcloud.tech/abra/pkg/upstream/convert"
|
"coopcloud.tech/abra/pkg/upstream/convert"
|
||||||
"coopcloud.tech/abra/pkg/upstream/stack"
|
"coopcloud.tech/abra/pkg/upstream/stack"
|
||||||
"coopcloud.tech/tagcmp"
|
"coopcloud.tech/tagcmp"
|
||||||
|
charmLog "github.com/charmbracelet/log"
|
||||||
composetypes "github.com/docker/cli/cli/compose/types"
|
composetypes "github.com/docker/cli/cli/compose/types"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
@ -187,7 +188,7 @@ func getBoolLabel(cl *dockerclient.Client, stackName string, label string) (bool
|
|||||||
return value, nil
|
return value, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Boolean label %s could not be found for %s, set default to false.", label, stackName)
|
log.Debugf("boolean label %s could not be found for %s, set default to false.", label, stackName)
|
||||||
|
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
@ -213,7 +214,7 @@ func getEnv(cl *dockerclient.Client, stackName string) (envfile.AppEnv, error) {
|
|||||||
}
|
}
|
||||||
k := splitString[0]
|
k := splitString[0]
|
||||||
v := splitString[1]
|
v := splitString[1]
|
||||||
log.Debugf("For %s read env %s with value: %s from docker service", stackName, k, v)
|
log.Debugf("for %s read env %s with value: %s from docker service", stackName, k, v)
|
||||||
envMap[k] = v
|
envMap[k] = v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -250,7 +251,7 @@ func getLatestUpgrade(cl *dockerclient.Client, stackName string, recipeName stri
|
|||||||
|
|
||||||
// getDeployedVersion returns the currently deployed version of an app.
|
// getDeployedVersion returns the currently deployed version of an app.
|
||||||
func getDeployedVersion(cl *dockerclient.Client, stackName string, recipeName string) (string, error) {
|
func getDeployedVersion(cl *dockerclient.Client, stackName string, recipeName string) (string, error) {
|
||||||
log.Debugf("Retrieve deployed version whether %s is already deployed", stackName)
|
log.Debugf("retrieve deployed version whether %s is already deployed", stackName)
|
||||||
|
|
||||||
isDeployed, deployedVersion, err := stack.IsDeployed(context.Background(), cl, stackName)
|
isDeployed, deployedVersion, err := stack.IsDeployed(context.Background(), cl, stackName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -310,7 +311,7 @@ func getAvailableUpgrades(cl *dockerclient.Client, stackName string, recipeName
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Available updates for %s: %s", stackName, availableUpgrades)
|
log.Debugf("available updates for %s: %s", stackName, availableUpgrades)
|
||||||
|
|
||||||
return availableUpgrades, nil
|
return availableUpgrades, nil
|
||||||
}
|
}
|
||||||
@ -482,6 +483,7 @@ func newAbraApp(version, commit string) *cli.App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.Before = func(c *cli.Context) error {
|
app.Before = func(c *cli.Context) error {
|
||||||
|
charmLog.SetDefault(log.Logger)
|
||||||
log.Debugf("kadabra version %s, commit %s", version, commit)
|
log.Debugf("kadabra version %s, commit %s", version, commit)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user