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 2fea34f0 Add twice daily checks against UIDs as well as when files 
change
2fea34f0 is described below

commit 2fea34f0ea3dc28dc1498e4f1e50cee11b0ee231
Author: Sebb <[email protected]>
AuthorDate: Thu Jan 23 17:52:52 2025 +0000

    Add twice daily checks against UIDs as well as when files change
---
 www/roster/public_committee_info.rb  | 2 +-
 www/roster/public_json_common.rb     | 6 ++++++
 www/roster/public_ldap_authgroups.rb | 2 +-
 www/roster/public_ldap_groups.rb     | 2 +-
 www/roster/public_ldap_projects.rb   | 2 +-
 www/roster/public_ldap_roles.rb      | 2 +-
 www/roster/public_ldap_services.rb   | 2 +-
 www/roster/public_member_info.rb     | 2 +-
 www/roster/public_nonldap_groups.rb  | 2 +-
 9 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/www/roster/public_committee_info.rb 
b/www/roster/public_committee_info.rb
index 823fb5ca..b898617b 100644
--- a/www/roster/public_committee_info.rb
+++ b/www/roster/public_committee_info.rb
@@ -106,7 +106,7 @@ public_json_output(info)
 
 # Check if there is an unexpected entry date
 # we only do this if the file has changed to avoid excessive reports
-if changed? and @old_file
+if check_now?
   # Note: symbolize_names=false to avoid symbolising variable keys such as pmc 
and user names
   # However the current JSON (info) uses symbols for fixed keys - beware!
   previous = JSON.parse(@old_file, :symbolize_names => false)
diff --git a/www/roster/public_json_common.rb b/www/roster/public_json_common.rb
index 9a01d431..6b1764ee 100644
--- a/www/roster/public_json_common.rb
+++ b/www/roster/public_json_common.rb
@@ -46,6 +46,12 @@ def new?
   return @changed == ChangeStatus::NEW
 end
 
+# Time to check for discrepancies?
+def check_now?
+  # Check for discrepancies from time to time regardless
+  return ([6, 18].include?(Time.now.hour) or (changed? and @old_file))
+end
+
 # Pretty-prints the JSON input and writes it to the output.
 # If the output is not STDOUT, then it is checked to see
 # if it has changed. If not, the output file is not touched.
diff --git a/www/roster/public_ldap_authgroups.rb 
b/www/roster/public_ldap_authgroups.rb
index 1f1e6caa..e606ea22 100644
--- a/www/roster/public_ldap_authgroups.rb
+++ b/www/roster/public_ldap_authgroups.rb
@@ -68,7 +68,7 @@ info = {
 
 public_json_output(info)
 
-if changed? and @old_file
+if check_now?
   # for validating UIDs
   uids = ASF::Person.list().map(&:id)
   entries.each do |name, entry|
diff --git a/www/roster/public_ldap_groups.rb b/www/roster/public_ldap_groups.rb
index 27daa8d9..bdefc7a1 100644
--- a/www/roster/public_ldap_groups.rb
+++ b/www/roster/public_ldap_groups.rb
@@ -62,7 +62,7 @@ info = {
 
 public_json_output(info)
 
-if changed? and @old_file
+if check_now?
   # for validating UIDs
   uids = ASF::Person.list().map(&:id)
   entries.each do |name, entry|
diff --git a/www/roster/public_ldap_projects.rb 
b/www/roster/public_ldap_projects.rb
index 45b27268..6f7fbfac 100644
--- a/www/roster/public_ldap_projects.rb
+++ b/www/roster/public_ldap_projects.rb
@@ -110,7 +110,7 @@ info = {
 
 public_json_output(info)
 
-if changed? and @old_file
+if check_now?
   # for validating UIDs
   uids = ASF::Person.list().map(&:id)
   entries.each do |name, entry|
diff --git a/www/roster/public_ldap_roles.rb b/www/roster/public_ldap_roles.rb
index bfb26115..eee8de50 100644
--- a/www/roster/public_ldap_roles.rb
+++ b/www/roster/public_ldap_roles.rb
@@ -78,7 +78,7 @@ if role_group
   end
 end
 
-if changed? and @old_file
+if check_now?
   # for validating UIDs
   uids = ASF::Person.list().map(&:id)
   entries.each do |name, entry|
diff --git a/www/roster/public_ldap_services.rb 
b/www/roster/public_ldap_services.rb
index c38a0358..a8945fd8 100644
--- a/www/roster/public_ldap_services.rb
+++ b/www/roster/public_ldap_services.rb
@@ -61,7 +61,7 @@ info = {
 
 public_json_output(info)
 
-if changed? and @old_file
+if check_now?
   # for validating UIDs
   uids = ASF::Person.list().map(&:id)
   entries.each do |name, entry|
diff --git a/www/roster/public_member_info.rb b/www/roster/public_member_info.rb
index c8d9cdcc..635a998a 100644
--- a/www/roster/public_member_info.rb
+++ b/www/roster/public_member_info.rb
@@ -68,7 +68,7 @@ end
 
 public_json_output(info)
 
-if changed? and @old_file
+if check_now?
   # for validating UIDs
   uids = ASF::Person.list().map(&:id)
   info[:members].each do |id|
diff --git a/www/roster/public_nonldap_groups.rb 
b/www/roster/public_nonldap_groups.rb
index 7f9f2f8a..12b3084e 100644
--- a/www/roster/public_nonldap_groups.rb
+++ b/www/roster/public_nonldap_groups.rb
@@ -58,7 +58,7 @@ public_json_output(
   #pitgroups: pitgroups
 )
 
-if changed? and @old_file
+if check_now?
   # for validating UIDs
   uids = ASF::Person.list().map(&:id)
   groups.each do |name, entry|

Reply via email to