This is an automated email from the ASF dual-hosted git repository. alexkli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/openwhisk-wskdebug.git
commit b903c368137f32acaf3aab17f3e2b721e536faa0 Author: Alexander Klimetschek <[email protected]> AuthorDate: Mon Apr 13 23:44:45 2020 -0700 performance: move `docker info` check out of critical path --- src/debugger.js | 4 ---- src/invoker.js | 5 ++++- test/install/Dockerfile | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/debugger.js b/src/debugger.js index 2cce15f..434f71f 100644 --- a/src/debugger.js +++ b/src/debugger.js @@ -60,10 +60,6 @@ class Debugger { this.agentMgr = new AgentMgr(this.argv, this.wsk, this.actionName); this.watcher = new Watcher(this.argv, this.wsk); - // quick fail for missing requirements such as docker not running - await OpenWhiskInvoker.checkIfAvailable(); - debug("verified that docker is available and running"); - // get the action metadata const actionMetadata = await this.agentMgr.peekAction(); debug("fetched action metadata from openwhisk"); diff --git a/src/invoker.js b/src/invoker.js index 9a92318..35fff0e 100644 --- a/src/invoker.js +++ b/src/invoker.js @@ -83,7 +83,7 @@ class OpenWhiskInvoker { this.containerName = this.asContainerName(`wskdebug-${this.action.name}-${Date.now()}`); } - static async checkIfAvailable() { + async checkIfDockerAvailable() { try { execute("docker info", {stdio: 'ignore'}); } catch (e) { @@ -189,6 +189,9 @@ class OpenWhiskInvoker { let showDockerRunOutput = this.verbose; + // quick fail for missing requirements such as docker not running + await this.checkIfDockerAvailable(); + try { execute(`docker inspect --type=image ${this.image} 2> /dev/null`); } catch (e) { diff --git a/test/install/Dockerfile b/test/install/Dockerfile index a45d187..029ba79 100644 --- a/test/install/Dockerfile +++ b/test/install/Dockerfile @@ -38,4 +38,4 @@ RUN wskdebug --ngrok myaction 2>&1 | grep -A 10 "ngrok dependency required for - RUN npm install -g ngrok --unsafe-perm=true # then we should get another error (as we can't run it without docker) -RUN wskdebug --ngrok myaction 2>&1 | grep -A 10 "Docker not running on local system. A local docker environment is required for the debugger." +RUN wskdebug --ngrok myaction 2>&1 | grep -A 10 -E "(Error: Unknown Error From API: socket hang up|Docker not running on local system. A local docker environment is required for the debugger.)"
