Changes a few more variables
This commit is contained in:
parent
4b4a5a4b93
commit
bd6adfaec6
1 changed files with 7 additions and 7 deletions
|
@ -204,8 +204,8 @@ var shareMachineCmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
|
|
||||||
err = h.AddSharedMachineToNamespace(machine, destinationNamespace)
|
err = h.AddSharedMachineToNamespace(machine, destinationNamespace)
|
||||||
if strings.HasPrefix(o, "json") {
|
if strings.HasPrefix(output, "json") {
|
||||||
JsonOutput(map[string]string{"Result": "Node shared"}, err, o)
|
JsonOutput(map[string]string{"Result": "Node shared"}, err, output)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -222,21 +222,21 @@ func nodesToPtables(currentNamespace headscale.Namespace, machines []headscale.M
|
||||||
|
|
||||||
for _, machine := range machines {
|
for _, machine := range machines {
|
||||||
var ephemeral bool
|
var ephemeral bool
|
||||||
if m.AuthKey != nil && m.AuthKey.Ephemeral {
|
if machine.AuthKey != nil && machine.AuthKey.Ephemeral {
|
||||||
ephemeral = true
|
ephemeral = true
|
||||||
}
|
}
|
||||||
var lastSeen time.Time
|
var lastSeen time.Time
|
||||||
if m.LastSeen != nil {
|
if machine.LastSeen != nil {
|
||||||
lastSeen = *m.LastSeen
|
lastSeen = *machine.LastSeen
|
||||||
}
|
}
|
||||||
nKey, err := wgkey.ParseHex(m.NodeKey)
|
nKey, err := wgkey.ParseHex(machine.NodeKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
nodeKey := tailcfg.NodeKey(nKey)
|
nodeKey := tailcfg.NodeKey(nKey)
|
||||||
|
|
||||||
var online string
|
var online string
|
||||||
if m.LastSeen.After(time.Now().Add(-5 * time.Minute)) { // TODO: Find a better way to reliably show if online
|
if machine.LastSeen.After(time.Now().Add(-5 * time.Minute)) { // TODO: Find a better way to reliably show if online
|
||||||
online = pterm.LightGreen("true")
|
online = pterm.LightGreen("true")
|
||||||
} else {
|
} else {
|
||||||
online = pterm.LightRed("false")
|
online = pterm.LightRed("false")
|
||||||
|
|
Loading…
Reference in a new issue