refs #6617
authorManoj <jonam33@gmail.com>
Mon, 20 Jul 2015 13:29:04 +0000 (09:29 -0400)
committerManoj <jonam33@gmail.com>
Mon, 20 Jul 2015 13:29:04 +0000 (09:29 -0400)
Merge branch '6617-display-https-url'

apps/workbench/app/controllers/application_controller.rb
apps/workbench/config/load_config.rb
apps/workbench/test/integration/application_layout_test.rb
services/api/config/initializers/load_config.rb

index db00be390a7e6846c2c8983efb90c2f213fd4336..db3d43040c416bef846a19d8ee0b4009a9e8f622 100644 (file)
@@ -707,6 +707,7 @@ class ApplicationController < ActionController::Base
   @@notification_tests = []
 
   @@notification_tests.push lambda { |controller, current_user|
+    return nil if Rails.configuration.shell_in_a_box_url
     AuthorizedKey.limit(1).where(authorized_user_uuid: current_user.uuid).each do
       return nil
     end
index 51fc81ab753d844ae020cda455220d1619a21cbd..f14c3ca8456b3b252574027f3b4ba53ad501ff85 100644 (file)
@@ -23,11 +23,17 @@ ArvadosWorkbench::Application.configure do
     ks.each do |kk|
       cfg = cfg.send(kk)
     end
-    if cfg.respond_to?(k.to_sym) and !cfg.send(k).nil?
-      # Config must have been set already in environments/*.rb.
+    if v.nil? and cfg.respond_to?(k) and !cfg.send(k).nil?
+      # Config is nil in *.yml, but has been set already in
+      # environments/*.rb (or has a Rails default). Don't overwrite
+      # the default/upstream config with nil.
       #
       # After config files have been migrated, this mechanism should
-      # be deprecated, then removed.
+      # be removed.
+      Rails.logger.warn <<EOS
+DEPRECATED: Inheriting config.#{ks.join '.'} from Rails config.
+            Please move this config into config/application.yml.
+EOS
     elsif v.nil?
       # Config variables are not allowed to be nil. Make a "naughty"
       # list, and present it below.
index daf2b09bbb1717b50bd472a54cda8e13a0e63db1..1f9edd422babfbf2906821fd4e0f1fa4cf805552 100644 (file)
@@ -201,4 +201,12 @@ class ApplicationLayoutTest < ActionDispatch::IntegrationTest
       assert page.has_link?('Report a problem ...'), 'No link - Report a problem'
     end
   end
+
+  test "no SSH public key notification when shell_in_a_box_url is configured" do
+    Rails.configuration.shell_in_a_box_url = 'example.com'
+    visit page_with_token('job_reader')
+    click_link 'notifications-menu'
+    assert_no_selector 'a', text:'Click here to set up an SSH public key for use with Arvados.'
+    assert_selector 'a', text:'Click here to learn how to run an Arvados Crunch pipeline'
+  end
 end
index de9770d7b7d1b45d7466b87b93f1e2fee9e9afab..cb31a24784f4bb71842cbd8fc905cf413ba9dee6 100644 (file)
@@ -46,11 +46,17 @@ Server::Application.configure do
     ks.each do |kk|
       cfg = cfg.send(kk)
     end
-    if cfg.respond_to?(k.to_sym) and !cfg.send(k).nil?
-      # Config must have been set already in environments/*.rb.
+    if v.nil? and cfg.respond_to?(k) and !cfg.send(k).nil?
+      # Config is nil in *.yml, but has been set already in
+      # environments/*.rb (or has a Rails default). Don't overwrite
+      # the default/upstream config with nil.
       #
       # After config files have been migrated, this mechanism should
-      # be deprecated, then removed.
+      # be removed.
+      Rails.logger.warn <<EOS
+DEPRECATED: Inheriting config.#{ks.join '.'} from Rails config.
+            Please move this config into config/application.yml.
+EOS
     elsif v.nil?
       # Config variables are not allowed to be nil. Make a "naughty"
       # list, and present it below.