etesync-dav icon indicating copy to clipboard operation
etesync-dav copied to clipboard

Unfriendly interface when certificate is already exists

Open sergeyklay opened this issue 4 years ago • 0 comments

Hello,

This is what is see when I try to generate certificate:

$ etesync-dav certgen
Skipping key generation as already exists.
security: SecKeychainItemImport: The specified item already exists in the keychain.
Traceback (most recent call last):
  File "etesync-dav", line 89, in <module>
  File "etesync-dav", line 80, in certgen
  File "etesync_dav/mac_helpers.py", line 117, in trust_cert
  File "etesync_dav/mac_helpers.py", line 103, in macos_trust_cert
  File "subprocess.py", line 364, in check_call
subprocess.CalledProcessError: Command '['security', 'import', '/Users/serghei/Library/Application Support/etesync-dav/etesync.crt']' returned non-zero exit status 1.
[74884] Failed to execute script etesync-dav

There is no even help:

$ etesync-dav certgen --help
Skipping key generation as already exists.
security: SecKeychainItemImport: The specified item already exists in the keychain.
Traceback (most recent call last):
  File "etesync-dav", line 89, in <module>
  File "etesync-dav", line 80, in certgen
  File "etesync_dav/mac_helpers.py", line 117, in trust_cert
  File "etesync_dav/mac_helpers.py", line 103, in macos_trust_cert
  File "subprocess.py", line 364, in check_call
subprocess.CalledProcessError: Command '['security', 'import', '/Users/serghei/Library/Application Support/etesync-dav/etesync.crt']' returned non-zero exit status 1.
[74890] Failed to execute script etesync-dav

Yes, I can get certificate path from the traceback and remove it by hand but this is unfriendly. Anyway end users should not see Python tracebacks when working with etesync-dav. It would be nice to have --help and --force options IMO.

P.S. After removing file by hand:

$ etesync-dav certgen
security: SecKeychainItemImport: The specified item already exists in the keychain.
Traceback (most recent call last):
  File "etesync-dav", line 89, in <module>
  File "etesync-dav", line 80, in certgen
  File "etesync_dav/mac_helpers.py", line 117, in trust_cert
  File "etesync_dav/mac_helpers.py", line 103, in macos_trust_cert
  File "subprocess.py", line 364, in check_call
subprocess.CalledProcessError: Command '['security', 'import', '/Users/serghei/Library/Application Support/etesync-dav/etesync.crt']' returned non-zero exit status 1.
[74926] Failed to execute script etesync-dav

The specified item already exists in the keychain.

Hmmm... Which one? I have hundreds of items in the keychain.

sergeyklay avatar Jun 22 '21 17:06 sergeyklay