Marco Ricci commited on 2025-08-02 09:06:07
Zeige 4 geänderte Dateien mit 26 Einfügungen und 6 Löschungen.
We retire the error message for missing UNIX domain socket support, in favor of a more general error message indicating that this Python and/or this `derivepassphrase` installation lacks certain functionality. We further delegate the UNIX domain socket-specific message to a warning message. We also introduce a warning message specific to Windows named pipes. (Both warning messages are prepared, but not yet in actual use.) Unfortunately, this entails changing the symbol name for the error message, because it would otherwise be misleading.
... | ... |
@@ -962,7 +962,9 @@ def key_to_phrase( |
962 | 962 |
_msg.TranslatedString(_msg.ErrMsgTemplate.NO_SSH_AGENT_FOUND) |
963 | 963 |
) |
964 | 964 |
except NotImplementedError: |
965 |
- error_callback(_msg.TranslatedString(_msg.ErrMsgTemplate.NO_AF_UNIX)) |
|
965 |
+ error_callback( |
|
966 |
+ _msg.TranslatedString(_msg.ErrMsgTemplate.NO_AGENT_SUPPORT) |
|
967 |
+ ) |
|
966 | 968 |
except OSError as exc: |
967 | 969 |
error_callback( |
968 | 970 |
_msg.TranslatedString( |
... | ... |
@@ -1953,6 +1953,22 @@ class WarnMsgTemplate(enum.Enum): |
1953 | 1953 |
'aborting mid-edit, and because the notes were actually changed.', |
1954 | 1954 |
flags='python-brace-format', |
1955 | 1955 |
) |
1956 |
+ NO_AF_UNIX = commented( |
|
1957 |
+ '', |
|
1958 |
+ )( |
|
1959 |
+ 'Warning message', |
|
1960 |
+ 'Cannot connect to an SSH agent via UNIX domain sockets ' |
|
1961 |
+ 'because this Python version does not support them.', |
|
1962 |
+ ) |
|
1963 |
+ """""" |
|
1964 |
+ NO_ANNOYING_OS_NAMED_PIPES = commented( |
|
1965 |
+ '', |
|
1966 |
+ )( |
|
1967 |
+ 'Warning message', |
|
1968 |
+ 'Cannot connect to an SSH agent via Windows named pipes ' |
|
1969 |
+ 'because this Python version does not support them.', |
|
1970 |
+ ) |
|
1971 |
+ """""" |
|
1956 | 1972 |
PASSPHRASE_NOT_NORMALIZED = commented( |
1957 | 1973 |
'The key is a (vault) configuration key, in JSONPath syntax, ' |
1958 | 1974 |
'typically "$.global" for the global passphrase or ' |
... | ... |
@@ -2203,12 +2219,12 @@ class ErrMsgTemplate(enum.Enum): |
2203 | 2219 |
flags='python-brace-format', |
2204 | 2220 |
) |
2205 | 2221 |
"""""" |
2206 |
- NO_AF_UNIX = commented( |
|
2222 |
+ NO_AGENT_SUPPORT = commented( |
|
2207 | 2223 |
'', |
2208 | 2224 |
)( |
2209 | 2225 |
'Error message', |
2210 | 2226 |
'Cannot connect to an SSH agent because this Python version ' |
2211 |
- 'does not support UNIX domain sockets.', |
|
2227 |
+ 'does not support communicating with it.', |
|
2212 | 2228 |
) |
2213 | 2229 |
"""""" |
2214 | 2230 |
NO_KEY_OR_PHRASE = commented( |
... | ... |
@@ -1154,7 +1154,9 @@ class _VaultContext: # noqa: PLR0904 |
1154 | 1154 |
) |
1155 | 1155 |
) |
1156 | 1156 |
except NotImplementedError: |
1157 |
- self.err(_msg.TranslatedString(_msg.ErrMsgTemplate.NO_AF_UNIX)) |
|
1157 |
+ self.err( |
|
1158 |
+ _msg.TranslatedString(_msg.ErrMsgTemplate.NO_AGENT_SUPPORT) |
|
1159 |
+ ) |
|
1158 | 1160 |
except OSError as exc: |
1159 | 1161 |
self.err( |
1160 | 1162 |
_msg.TranslatedString( |
... | ... |
@@ -4298,7 +4298,7 @@ class TestCLI: |
4298 | 4298 |
catch_exceptions=False, |
4299 | 4299 |
) |
4300 | 4300 |
assert result.error_exit( |
4301 |
- error='does not support UNIX domain sockets' |
|
4301 |
+ error='does not support communicating with it' |
|
4302 | 4302 |
), 'expected error exit and known error message' |
4303 | 4303 |
|
4304 | 4304 |
|
... | ... |
@@ -5230,7 +5230,7 @@ Will replace with spam, okay? (Please say "y" or "n".): Boo. |
5230 | 5230 |
with monkeypatch.context() as mp: |
5231 | 5231 |
mp.delattr(socket, 'AF_UNIX', raising=True) |
5232 | 5232 |
with pytest.raises( |
5233 |
- ErrCallback, match='does not support UNIX domain sockets' |
|
5233 |
+ ErrCallback, match='does not support communicating with it' |
|
5234 | 5234 |
): |
5235 | 5235 |
cli_helpers.key_to_phrase(loaded_key, error_callback=err) |
5236 | 5236 |
with monkeypatch.context() as mp: |
5237 | 5237 |