[CHANGE REQUEST] Update country-code script on bapp01

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On bapp01 we have a script that checks whether the country code that people have
in FAS is known to GeoIP.  This script runs once a week.  The script sends out
email if the country code is not known to GeoIP (this happens if we update GeoIP
and a previous country code is removed).

I'd like to update this script in puppet so that it doesn't notify inactive
accounts as we're currently sending out nagmail to accounts which are no longer
used (but may point to valid email addresses):

diff --git a/modules/fas/files/fas-invalid-cc.py
b/modules/fas/files/fas-invalid-cc.py
index 2e7d309..186049a 100755
--- a/modules/fas/files/fas-invalid-cc.py
+++ b/modules/fas/files/fas-invalid-cc.py
@@ -86,14 +86,14 @@ def getusers():
   country_codes = GeoIP.country_codes
 
   data = []
-  data = fas.people_by_key(key='id', fields=['human_name', 'username',
'country_code', 'email'])
+  data = fas.people_by_key(key='id', fields=['human_name', 'username',
'country_code', 'email', 'status'])
   
   if not email: 
 
     print '\nSummary of accounts without valid Country Codes.'
     print '\n------------------------------------------------'
 
-  for user_info in data.values():
+  for user_info in [d for d in data.itervalues() if d['status'] == 'active']:
     if user_info['country_code'] and user_info['country_code'] not in
country_codes:
       if email:



Could I get two +1s?

-Toshio

_______________________________________________
infrastructure mailing list
infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/infrastructure



[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux