Skip to content

Conversation

@jabr
Copy link
Contributor

@jabr jabr commented Nov 19, 2025

Spun out of #162 to associate machine id with corresponding connection entry.

Copy link
Owner

@psviderski psviderski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just one comment about updating the handling of the context option.

// the machine with its connection in the config, e.g. by storing the machine name in the connection metadata.
// Remove the connection to the machine from the uncloud config if it exists.
if uncli.Config != nil {
contextName := opts.context
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be updated after #174 has been merged as the --context is now a global flag/option.

Copy link
Contributor Author

@jabr jabr Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. I added a helper function to the cli with that bit of "override or current" logic since it was used in two places now:

func (cli *CLI) GetContextOverrideOrCurrent() string {
  contextName := cli.contextOverride
  if contextName == "" {
    contextName = cli.Config.CurrentContext
  }
  return contextName
}

The cli's ConnectClusterWithOptions also has something similar, but it's mixed in with validation of the name and error logging. It might make sense to refactor that more later, but that would be more involved and seemed better to leave for a separate PR. These other uses have (simpler) error handling of their own already, too.

@jabr jabr force-pushed the add-machine-id-to-connections branch from 525906d to 2f677ec Compare November 20, 2025 05:23
@psviderski psviderski merged commit 76b4369 into psviderski:main Nov 20, 2025
5 of 7 checks passed
@jabr jabr deleted the add-machine-id-to-connections branch November 27, 2025 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants