Skip to content

Conversation

@marsom
Copy link

@marsom marsom commented Oct 20, 2025

like discussed in #311

Signed-off-by: Markus Sommer <markus.sommer@postfinance.ch>
main.go Outdated
Comment on lines 223 to 226
go func() {
<-sigs
cancel()
}()
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed?

Copy link
Author

Choose a reason for hiding this comment

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

i copied it from the login command above. however i think we coud simply all the smae into

ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM) defer cancel()

Copy link
Member

Choose a reason for hiding this comment

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

login needs this because it does some complex stuff with channels that causes the SIGTERM to hang unless we do this. Maybe we need it hear, maybe we don't, I wanted to know if we needed it because I wouldn't expect the sigterm call to hang for this functionality and I'd try to find the source of it.

afs := &afero.Afero{Fs: l.Fs}

// empty config file
err = afs.WriteFile(userOpkSshConfig, []byte{}, 0o600)
Copy link
Member

@EthanHeilman EthanHeilman Oct 20, 2025

Choose a reason for hiding this comment

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

Why is logout creating a config file? Shouldn't it only be deleting keys?

Copy link
Author

Choose a reason for hiding this comment

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

the login --configure adds an include directive to the users .ssh/config file includeing the given file. my intention was that referceing a non existing file in my config is not good. i will test it, if ssh complains. if not, i can remove the file instead.

also cleaning up the user config is not good i think, because the user needs to do the configure again.

Copy link
Member

Choose a reason for hiding this comment

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

I agree we shouldn't be deleting the config, but if no config exists, I don't think we should be creating it.

Copy link
Author

Choose a reason for hiding this comment

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

ok, i changed the code

return fmt.Errorf("key type (%s) has no default output file name; use -i <filePath>", l.KeyTypeArg.String())
}

for _, keyFilename := range keyFileNames {
Copy link
Member

Choose a reason for hiding this comment

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

Can you make this code more clear that we checking if a key is an opkssh before removing it. I initially thought the function removeKeys, based on the name, just deleted the keys without performing any check.

Copy link
Author

Choose a reason for hiding this comment

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

ill rename the function

@EthanHeilman
Copy link
Member

@marsom Thanks for this PR. Very glad to see someone working on this issue. Can you provide a more detailed PR description and also tests? Since you imported the afero.Fs pattern, unittests shouldn't be that difficult to write

@EthanHeilman EthanHeilman added the enhancement New feature or request label Oct 20, 2025
@marsom
Copy link
Author

marsom commented Oct 20, 2025

@marsom Thanks for this PR. Very glad to see someone working on this issue. Can you provide a more detailed PR description and also tests? Since you imported the afero.Fs pattern, unittests shouldn't be that difficult to write

I will update the branch

EthanHeilman and others added 2 commits October 24, 2025 14:50
Signed-off-by: Markus Sommer <markus.sommer@postfinance.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants