[CHANGE REQUEST] Update country-code script on bapp01

Kevin Fenzi kevin at scrye.com
Tue Feb 28 17:51:25 UTC 2012


On Tue, 28 Feb 2012 17:01:19 +0000 (UTC)
Toshio Kuratomi <toshio at 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. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/infrastructure/attachments/20120228/720fec76/attachment.sig>


More information about the infrastructure mailing list