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
On Tue, 28 Feb 2012 17:01:19 +0000 (UTC) Toshio Kuratomi toshio@tiki-lounge.com wrote:
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?
+1 -sv
On Tue, 28 Feb 2012 17:01:19 +0000 (UTC) Toshio Kuratomi toshio@tiki-lounge.com wrote:
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?
+1 here.
I wrote the script and can make the change. I just need to figure out how to tell if an account is inactive.
On Tue, Feb 28, 2012 at 10:51 AM, Kevin Fenzi kevin@scrye.com wrote:
On Tue, 28 Feb 2012 17:01:19 +0000 (UTC) Toshio Kuratomi toshio@tiki-lounge.com wrote:
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?
+1 here.
infrastructure mailing list infrastructure@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/infrastructure
Hah, I should learn to read before responding... +1 your change.
On Tue, Feb 28, 2012 at 11:10 AM, Will will.sterling@gmail.com wrote:
I wrote the script and can make the change. I just need to figure out how to tell if an account is inactive.
On Tue, Feb 28, 2012 at 10:51 AM, Kevin Fenzi kevin@scrye.com wrote:
On Tue, 28 Feb 2012 17:01:19 +0000 (UTC) Toshio Kuratomi toshio@tiki-lounge.com wrote:
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?
+1 here.
infrastructure mailing list infrastructure@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/infrastructure
infrastructure@lists.fedoraproject.org