Commit e1e328bf authored by Michael R's avatar Michael R
Browse files

Fix workflow migrate command

-add missing profile parameter for migrate's objects query
-extend possible for migration profiles list
parent c2eeb742
Pipeline #37252 passed with stages
in 27 minutes and 17 seconds
......@@ -19,7 +19,21 @@ from noc.wf.models.wfmigration import WFMigration
class Command(BaseCommand):
help = "Workflow maintenance"
PROFILE_MAP = {"crm.SubscriberProfile": "crm.Subscriber", "crm.SupplierProfile": "crm.Supplier"}
PROFILE_MAP = {
"crm.SubscriberProfile": "crm.Subscriber",
"crm.SupplierProfile": "crm.Supplier",
"ip.AddressProfile": "ip.Address",
"ip.PrefixProfile": "ip.Prefix",
"phone.PhoneNumberProfile": "phone.PhoneNumber",
"phone.PhoneRangeProfile": "phone.PhoneRange",
"vc.L2DomainProfile": "vc.L2Domain",
"vc.VLANProfile": "vc.VLAN",
"vc.VPNProfile": "vc.VPN",
"inv.SensorProfile": "inv.Sensor",
"pm.AgentProfile": "pm.Agent",
"sa.ServiceProfile": "sa.Service",
"sla.SLAProfile": "sla.SLAProbe",
}
EXPIRE_MODELS = ["vc.VLAN"]
......@@ -73,10 +87,10 @@ class Command(BaseCommand):
self.print("No translations")
continue
for ostate in tr:
c = imodel.objects.filter(state=ostate.id).count()
c = imodel.objects.filter(state=ostate.id, profile=pid).count()
self.print(" %s -> %s: %d records" % (ostate, tr[ostate], c))
if c and not dry_run:
for o in imodel.objects.filter(state=ostate.id):
for o in imodel.objects.filter(state=ostate.id, profile=pid):
o.set_state(tr[ostate])
def handle_expire(self, dry_run=False, model=None, *args, **kwargs):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment