File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public function addKey($key_file)
4444 'method ' => 'post ' ,
4545 ]
4646 );
47- return ( array ) $ response[ ' data ' ] ;
47+ return $ response ;
4848 }
4949
5050 /**
Original file line number Diff line number Diff line change @@ -24,7 +24,22 @@ class AddCommand extends TerminusCommand
2424 */
2525 public function add ($ file )
2626 {
27- $ this ->session ()->getUser ()->getSSHKeys ()->addKey ($ file );
27+ $ response = $ this ->session ()->getUser ()->getSSHKeys ()->addKey ($ file );
28+ if ($ response ['status_code ' ] !== 200 ) {
29+ $ this ->log ()->error ($ this ->getMessageToLog ($ response ['data ' ]));
30+ return ;
31+ }
2832 $ this ->log ()->notice ('Added SSH key from file {file}. ' , compact ('file ' ));
2933 }
34+
35+ /**
36+ * Get a (maybe) human friendly message to show to the user.
37+ */
38+ private function getMessageToLog ($ response_data )
39+ {
40+ if (trim ($ response_data ) === "SSH validation failed: Unknown SSH key type 'ssh-ed25519'. " ) {
41+ return "SSH keys of type 'ed25519' are not yet supported. Please use a different key type. " ;
42+ }
43+ return $ response_data ;
44+ }
3045}
You can’t perform that action at this time.
0 commit comments