You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2018/07/23 15:12:55 UTC

[incubator-openwhisk-runtime-ruby] 17/19: Add another boundary for sentinel handling to make testInitCannotBeCalledMoreThanOnce work

This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-runtime-ruby.git

commit dc1f9580413009bce6172e75d4eb1e4068f2216d
Author: Kei Sawada <k...@swd.cc>
AuthorDate: Sun Jul 15 01:38:29 2018 +0900

    Add another boundary for sentinel handling to make testInitCannotBeCalledMoreThanOnce work
---
 core/ruby2.5Action/rackapp/init.rb                        | 1 +
 core/ruby2.5Action/rackapp/middleware/sentinel_handler.rb | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/core/ruby2.5Action/rackapp/init.rb b/core/ruby2.5Action/rackapp/init.rb
index 55f7151..4b9dcf4 100644
--- a/core/ruby2.5Action/rackapp/init.rb
+++ b/core/ruby2.5Action/rackapp/init.rb
@@ -8,6 +8,7 @@ class InitApp
   def call(env)
     # Make sure that this action is not initialised more than once
     if File.exist? CONFIG then
+      puts "Error: Cannot initialize the action more than once."
       return ErrorResponse.new 'Cannot initialize the action more than once.', 403
     end
 
diff --git a/core/ruby2.5Action/rackapp/middleware/sentinel_handler.rb b/core/ruby2.5Action/rackapp/middleware/sentinel_handler.rb
index 3d1d1bf..2161bde 100644
--- a/core/ruby2.5Action/rackapp/middleware/sentinel_handler.rb
+++ b/core/ruby2.5Action/rackapp/middleware/sentinel_handler.rb
@@ -3,7 +3,7 @@ require "#{__dir__}/base.rb"
 class SentinelHandler < MiddlewareBase
   def call(env)
     response = @app.call(env)
-    if !(env['REQUEST_PATH'] == '/init' && response.status == 200) then
+    if !(env['REQUEST_PATH'] == '/init' && [200,403].include?(response.status)) then
       puts response.body if response.status!=200
       puts "XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX"
       warn "XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX"