mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-23 07:56:44 -06:00
Resolves #9876 Conditions for webhook process tags
This commit is contained in:
parent
498b655cb7
commit
1638fcd55c
@ -1,5 +1,6 @@
|
|||||||
import functools
|
import functools
|
||||||
import re
|
import re
|
||||||
|
from collections import OrderedDict
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'Condition',
|
'Condition',
|
||||||
@ -103,6 +104,13 @@ class Condition:
|
|||||||
return value in self.value
|
return value in self.value
|
||||||
|
|
||||||
def eval_contains(self, value):
|
def eval_contains(self, value):
|
||||||
|
# For tags because tags are list of dicts
|
||||||
|
if (type(value) is list and
|
||||||
|
value and
|
||||||
|
type(next(iter(value))) is OrderedDict and
|
||||||
|
next(iter(value)) is not None):
|
||||||
|
return next((item for item in value if item["slug"] == self.value), None) is not None
|
||||||
|
else:
|
||||||
return self.value in value
|
return self.value in value
|
||||||
|
|
||||||
# Regular expressions
|
# Regular expressions
|
||||||
|
Loading…
Reference in New Issue
Block a user