blob: 1ec45285d1058a410d384b78a25da047bd484722 [file] [log] [blame]
Yunpeng Zhangd01f3ce2017-07-06 20:06:35 -04001import os
2import sys
3from django.db.models import Q, F
4# from services.vbbu.models import MCORDService, VBBUTenant
5from synchronizers.new_base.modelaccessor import *
6from synchronizers.new_base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
7
8parentdir = os.path.join(os.path.dirname(__file__), "..")
9sys.path.insert(0, parentdir)
10
11class SyncVBBUTenant(SyncInstanceUsingAnsible):
12
13
14 provides = [VBBUTenant]
15
16 observes = VBBUTenant
17
18 requested_interval = 0
19
20 template_name = "vbbutenant_playbook.yaml"
21
22 service_key_name = "/opt/xos/configurations/mcord/mcord_private_key"
23
24 def __init__(self, *args, **kwargs):
25 super(SyncVBBUTenant, self).__init__(*args, **kwargs)
26
27 def fetch_pending(self, deleted):
28
29 if (not deleted):
30 objs = VBBUTenant.get_tenant_objects().filter(
31 Q(enacted__lt=F('updated')) | Q(enacted=None), Q(lazy_blocked=False))
32 else:
33
34 objs = VBBUTenant.get_deleted_tenant_objects()
35
36 return objs
37
38 def get_extra_attributes(self, o):
39 return {"display_message": o.display_message, "s1u_tag": o.s1u_tag, "s1mme_tag": o.s1mme_tag, "rru_tag": o.rru_tag}