more logs
This commit is contained in:
parent
47ed1b4562
commit
2cf8923d95
@ -10,6 +10,8 @@ import (
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
oclib "cloud.o-forge.io/core/oc-lib"
|
||||
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
jwt "github.com/golang-jwt/jwt/v5"
|
||||
"gopkg.in/yaml.v2"
|
||||
@ -315,7 +317,6 @@ func (c *AdmiraltyController) CreateKubeSecret() {
|
||||
// @router /node/:execution [get]
|
||||
func (c *AdmiraltyController) GetNodeReady(){
|
||||
var secret v1.Secret
|
||||
|
||||
execution := c.Ctx.Input.Param(":execution")
|
||||
|
||||
|
||||
@ -339,7 +340,7 @@ func (c *AdmiraltyController) GetNodeReady(){
|
||||
if node == nil {
|
||||
c.Ctx.Output.SetStatus(404)
|
||||
c.Data["json"] = map[string]string{
|
||||
"error" : "the node for " + execution + " can't be found, make sure both target and source resources are set up on local and remote hosts",
|
||||
"node" : "the node for " + execution + " can't be found, make sure both target and source resources are set up on local and remote hosts",
|
||||
}
|
||||
c.ServeJSON()
|
||||
return
|
||||
@ -428,6 +429,8 @@ func retrieveTokenFromKonfig(editedKubeconfig map[string]interface{}) (string,er
|
||||
}
|
||||
|
||||
func isTokenExpired(token string) (*bool, error){
|
||||
logger := oclib.GetLogger()
|
||||
|
||||
t, _, err := new(jwt.Parser).ParseUnverified(token, jwt.MapClaims{})
|
||||
if err != nil {
|
||||
fmt.Println("couldn't decode token")
|
||||
@ -439,7 +442,11 @@ func isTokenExpired(token string) (*bool, error){
|
||||
fmt.Println("Error while checking token's expiration time")
|
||||
return nil, err
|
||||
}
|
||||
fmt.Println("Expiration date : " + expiration.UTC().Format("2006-01-02T15:04:05"))
|
||||
|
||||
logger.Debug().Msg("Expiration date : " + expiration.UTC().Format("2006-01-02T15:04:05"))
|
||||
logger.Debug().Msg(fmt.Sprint("Now : ", time.Now().Unix()))
|
||||
logger.Debug().Msg(fmt.Sprint("Token : ", expiration.Unix()))
|
||||
|
||||
|
||||
expired := expiration.Unix() < time.Now().Unix()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user