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

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new d1fc03d5 Add support for notice file
d1fc03d5 is described below

commit d1fc03d53267596d527cf55e8cddf3c2d78b90d2
Author: Sebb <[email protected]>
AuthorDate: Wed Sep 25 00:14:11 2024 +0100

    Add support for notice file
---
 lib/whimsy/asf/status.rb | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/whimsy/asf/status.rb b/lib/whimsy/asf/status.rb
index 38f72861..bf4f078d 100644
--- a/lib/whimsy/asf/status.rb
+++ b/lib/whimsy/asf/status.rb
@@ -52,8 +52,8 @@ module Status
   # - or testnode
   def self.updates_disallowed_reason
     return nil if testnode?
-    return 'Service temporarily unavailable due to migration.' if migrating?
-    return 'Service unavailable on this node. Please ensure you have logged in 
to the correct host.' unless active?
+    return 'Updates unavailable due to migration.' if migrating?
+    return 'Updates unavailable on this node. Please ensure you have logged in 
to the correct host.' unless active?
 
     nil
   end
@@ -73,6 +73,16 @@ module Status
     Resolv::DNS.open.getaddress(ACTIVE_HOSTNAME)
   end
 
+  # return notice file header and href path or nil
+  def self.notice
+    path =  '/srv/whimsy/www/notice.txt'
+    if File.exist? path
+      File.open(path) do |fh|
+        return fh.readline, '/notice.txt'
+      end
+    end
+    nil
+  end
 end
 
 # for debugging purposes

Reply via email to