Modification to the cron methods to allow arguments to be passed to each call

This commit is contained in:
2010-10-18 12:19:22 +01:00
parent a3cbc5063c
commit ab67c55d90
5 changed files with 21 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ class RemoveInvalidUsers():
self.__logger = logging.getLogger(__name__)
return self.__logger
def job(self):
def job(self, args):
for user in User.objects.all():
# For each user, update access list based on Corp details
user.get_profile().update_access()
@@ -38,8 +38,14 @@ class UpdateServiceGroups():
self.__logger = logging.getLogger(__name__)
return self.__logger
def job(self):
for serv in Service.objects.filter(active=1):
def job(self, args):
if args and len(args) == 1:
services = Service.objects.filter(active=1, id=args[0])
else:
services = Service.objects.filter(active=1)
for serv in services:
self._logger.info('Updating %s service' % serv)
api = serv.api_class
for servacc in ServiceAccount.objects.filter(active=1, service=serv):