itamae-kitchen / itamae

Configuration management tool inspired by Chef, but simpler and lightweight. Formerly known as Lightchef.

Home Page:https://itamae.kitchen/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Itamae doesn't raise an error when private-key-file doesn't exist

topstone opened this issue · comments

(必要なら英語でも書きます)

itamae ssh 起動時に --key= で存在しない file を指定しても net-ssh まで error が発生せず、net-ssh までたどり着いてやっと Authentication failed for user xxx@yyy.com (Net::SSH::AuthenticationFailed) が発生します。これは認証の何について問題が発生しているのかの切り分けが難しいと思われます。

lib/itamae/backend.rb の263行目あたりですぐに file の有無を確認する処理を入れておけば便利だと思うのですが、いかがでしょうか。(itamae, specinfra, net-ssh のどの層で扱うと理想的なのか、よく分かっていなくてすみません。)

@topstone I followed the implementation of Itamae, Specinfra, and net-ssh. In my opinion, it is appropriate to implement a file existence check for net-ssh. However, if that change is not acceptable for net-ssh, checking with itamae is acceptable.

(Itamae, Specinfra, net-sshでの処理を追ってみましたが、net-sshに対して存在確認する変更を入れるのが適切なように感じました。ただnet-ssh側でその変更が受け入れられなかった場合は、itamae側でファイルの存在確認を入れるのもいいかなと思っています)

In net-ssh, there is code to check whether the specified key file exists. Hmm....

https://github.com/net-ssh/net-ssh/blob/master/lib/net/ssh/authentication/key_manager.rb#L268-L270

Reported on "net-ssh" repo.

net-ssh/net-ssh#929

If necessary, reopen please.