blob: 9d889183297aba05c87474bb1bcb4609770c647d [file] [log] [blame]
Sapan Bhatia24836f12013-08-27 10:16:05 -04001import os
2import base64
Sapan Bhatia22e0ffe2013-10-02 01:12:10 -04003import hashlib
Tony Mackae7f30c2013-09-25 12:46:50 -04004from django.db.models import F, Q
Sapan Bhatia24836f12013-08-27 10:16:05 -04005from planetstack.config import Config
Sapan Bhatia04c94ad2013-09-02 18:00:28 -04006from observer.openstacksyncstep import OpenStackSyncStep
Tony Mack91463d92014-06-19 20:42:03 -04007from core.models.user import User
8from core.models.userdeployments import UserDeployments
Sapan Bhatia24836f12013-08-27 10:16:05 -04009
10class SyncUsers(OpenStackSyncStep):
Tony Mackce79de02013-09-24 10:12:33 -040011 provides=[User]
12 requested_interval=0
Tony Mack66646d52013-09-24 21:47:12 -040013
14 def fetch_pending(self):
15 return User.objects.filter(Q(enacted__lt=F('updated')) | Q(enacted=None))
16
Tony Mackce79de02013-09-24 10:12:33 -040017 def sync_record(self, user):
Tony Mackd4a64292014-04-16 19:53:21 -040018 for user_deployment in UserDeployments.objects.filter(user=user):
19 # bump the 'updated' field so user account are updated across
20 # deployments.
21 user_deployment.save()