From 259312bb977c3cb87daf79cd679625aeb72b17e7 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Mon, 26 Mar 2018 13:19:06 +0200
Subject: [PATCH] fix: catch Host key verification error for all lock file
 types

---
 lib/workers/branch/lock-files.js | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/lib/workers/branch/lock-files.js b/lib/workers/branch/lock-files.js
index befbd60593..52055146dd 100644
--- a/lib/workers/branch/lock-files.js
+++ b/lib/workers/branch/lock-files.js
@@ -480,6 +480,11 @@ async function getUpdatedLockFiles(config) {
           }
         }
       }
+      // istanbul ignore if
+      if (res.stderr && res.stderr.includes('Host key verification failed')) {
+        logger.info({ stderr: res.stderr }, 'Host key verification failed');
+        throw new Error('internal-error');
+      }
       lockFileErrors.push({
         lockFile: lockFileName,
         stderr: res.stderr,
@@ -527,6 +532,11 @@ async function getUpdatedLockFiles(config) {
           /* eslint-enable no-useless-escape */
         }
       }
+      // istanbul ignore if
+      if (res.stderr && res.stderr.includes('Host key verification failed')) {
+        logger.info({ stderr: res.stderr }, 'Host key verification failed');
+        throw new Error('internal-error');
+      }
       lockFileErrors.push({
         lockFile: lockFileName,
         stderr: res.stderr,
@@ -572,6 +582,11 @@ async function getUpdatedLockFiles(config) {
           }
         }
       }
+      // istanbul ignore if
+      if (res.stdout && res.stdout.includes('Host key verification failed')) {
+        logger.info({ stdout: res.stdout }, 'Host key verification failed');
+        throw new Error('internal-error');
+      }
       lockFileErrors.push({
         lockFile: lockFileName,
         stderr: res.stderr,
@@ -614,6 +629,11 @@ async function getUpdatedLockFiles(config) {
       ) {
         throw new Error('Out of disk space when generating yarn.lock');
       }
+      // istanbul ignore if
+      if (res.stderr && res.stderr.includes('Host key verification failed')) {
+        logger.info({ stderr: res.stderr }, 'Host key verification failed');
+        throw new Error('internal-error');
+      }
       lockFileErrors.push({
         lockFile,
         stderr: res.stderr,
-- 
GitLab