mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
feat: store machine id on connection entries in Uncloud config so it can be removed with machine (#182)
* fix: Store machine id on connection entries so it can be removed when machine is * Add "GetContextOverrideOrCurrent" helper method to cli and use in `uc machine rm` to clean up connections
This commit is contained in:
@@ -25,6 +25,7 @@ type MachineConnection struct {
|
||||
TCP *netip.AddrPort `yaml:"tcp,omitempty"`
|
||||
Host string `yaml:"host,omitempty"`
|
||||
PublicKey secret.Secret `yaml:"public_key,omitempty"`
|
||||
MachineID string `yaml:"machine_id,omitempty"`
|
||||
}
|
||||
|
||||
func (c MachineConnection) String() string {
|
||||
|
||||
@@ -58,6 +58,15 @@ func TestMachineConnection_String(t *testing.T) {
|
||||
conn: MachineConnection{},
|
||||
want: "unknown connection",
|
||||
},
|
||||
{
|
||||
name: "ssh connection with machine id",
|
||||
conn: MachineConnection{
|
||||
SSH: "user@host.com",
|
||||
MachineID: "ed98b9f7575308c340263cd279e3b568",
|
||||
},
|
||||
// String() does not use MachineID; just verifying entry with it is valid
|
||||
want: "ssh://user@host.com",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in New Issue
Block a user