django-restit 4.2.120__py3-none-any.whl → 4.2.122__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-restit
3
- Version: 4.2.120
3
+ Version: 4.2.122
4
4
  Summary: A Rest Framework for DJANGO
5
5
  License: MIT
6
6
  Author: Ian Starnes
@@ -114,7 +114,7 @@ incident/migrations/0015_rule_title_template_alter_incident_state.py,sha256=FPUD
114
114
  incident/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
115
115
  incident/models/__init__.py,sha256=NMphuhb0RTMf7Ov4QkNv7iv6_I8Wtr3xQ54yjX_a31M,209
116
116
  incident/models/event.py,sha256=LNKYdqOj_CO4aGvc2dNmy3K-S52Udi_gZ4-wintbs1s,7901
117
- incident/models/incident.py,sha256=pxV7ZPMfYXci5GmRy1EzcLWwcV61UDoqcu4QuQnmZug,20304
117
+ incident/models/incident.py,sha256=0S4HlNCgs0M0b_p7bxcO7rdHoRCSp9x4BFftc_xhLP8,20931
118
118
  incident/models/ossec.py,sha256=eUDRGawzuLWobKEVGKfdZisDnyjS_Hlxi0T_GCSLCCI,2252
119
119
  incident/models/rules.py,sha256=aRkJ0ZnTv87nAUC1sHVkPExfb3OJ8fgHQIhnCIpIbhQ,7001
120
120
  incident/models/ticket.py,sha256=S3kqGQpYLE6Y4M9IKu_60sgW-f592xNr8uufqHnvDoU,2302
@@ -374,7 +374,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
374
374
  rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
375
375
  rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
376
376
  rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
377
- rest/__init__.py,sha256=v1onV7iLp2fAwAiAR6uRaS5Ck82v0WTI33rLH78hFqE,122
377
+ rest/__init__.py,sha256=yAH0T2MHsrw1zh6Ohu_SDqgIBfkD64lpT-Tdh17i6sI,122
378
378
  rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
379
379
  rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
380
380
  rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
@@ -509,7 +509,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
509
509
  ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
510
510
  ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
511
511
  ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
512
- django_restit-4.2.120.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
513
- django_restit-4.2.120.dist-info/METADATA,sha256=OfRFWQJ2xUyFXdqy1Vbx0j73hGWA_sCiCmm0iUEfQcU,7663
514
- django_restit-4.2.120.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
515
- django_restit-4.2.120.dist-info/RECORD,,
512
+ django_restit-4.2.122.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
513
+ django_restit-4.2.122.dist-info/METADATA,sha256=2nyXSkbfCsurTm3pdSCFjpqtX5KbLyr45tY_dq_aOjc,7663
514
+ django_restit-4.2.122.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
515
+ django_restit-4.2.122.dist-info/RECORD,,
@@ -63,6 +63,15 @@ class Incident(models.Model, rm.RestModel, rm.MetaDataModel):
63
63
  "generic__component": "basic"
64
64
  },
65
65
  },
66
+ "generic": {
67
+ "extra": ["metadata", ("get_state_display", "state_display")],
68
+ "graphs": {
69
+ "group": "basic",
70
+ "rule": "basic",
71
+ "assigned_to": "basic",
72
+ "generic__component": "basic"
73
+ },
74
+ },
66
75
  }
67
76
 
68
77
  created = models.DateTimeField(auto_now_add=True)
@@ -229,10 +238,12 @@ class Incident(models.Model, rm.RestModel, rm.MetaDataModel):
229
238
  except Exception:
230
239
  rh.log_exception("triggerAsyncNotify")
231
240
 
232
- def triggerTask(self):
241
+ def triggerTask(self, action=None):
233
242
  # task:APP_NAME:FNAME:CHANNEL
234
- fields = self.rule.action.split(':')
235
- if len(fields) < 4:
243
+ if action is None:
244
+ action = self.rule.action
245
+ fields = action.split(':')
246
+ if len(fields) < 3:
236
247
  rh.log_error("triggerTask failed, invalid field count")
237
248
  return
238
249
  self.action_sent = datetime.now()
@@ -273,19 +284,26 @@ class Incident(models.Model, rm.RestModel, rm.MetaDataModel):
273
284
  rh.log_exception("triggerSMS")
274
285
 
275
286
  def triggerGroup(self):
276
- if self.rule.action.count(":") == 2:
277
- action, gid, perm = self.rule.action.split(":")
287
+ parts = self.rule.action.split(":")
288
+ junk = parts[0]
289
+ gid = parts[1]
290
+ perm = None
291
+ if len(parts) == 2:
292
+ perm = gid
293
+ gid = None
294
+ if len(parts) > 2:
295
+ perm = parts[2]
296
+ if gid:
278
297
  self.group = Group.objects.filter(pk=int(gid)).last()
279
298
  self.save()
280
- else:
281
- action, perm = self.rule.action.split(":")
282
-
283
299
  if not self.group:
284
300
  self.notifyWith("notify.unknown_incidents")
285
301
  return
302
+ if perm == "action" and len(parts) > 3:
303
+ if parts[3] == "task":
304
+ return self.triggerTask(":".join(parts[3:]))
286
305
  self.action_sent = datetime.now()
287
306
  self.save()
288
-
289
307
  subject = f"New Issue @ {self.group.name} - {self.description}"
290
308
  details = self.getProperty("details", self.description)
291
309
  username = self.getProperty("username", None)
rest/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
1
  from .uberdict import UberDict # noqa: F401
2
2
  from .settings_helper import settings # noqa: F401
3
3
 
4
- __version__ = "4.2.120"
4
+ __version__ = "4.2.122"