@@ -158,7 +158,7 @@ class FixDiscoveryRuleFilters(ConversionRule):
158158 # check if multi-filter can be downgraded to filter expression
159159 if (
160160 node .find ('evaltype' ).text == '0'
161- and node .find ('formula' ).text is None
161+ and node .find ('formula' ).text in ( '1' , None )
162162 ):
163163 conditions = node .find ('conditions' )
164164
@@ -256,12 +256,18 @@ class FixTriggerPrototypesDependencies(ConversionRule):
256256
257257class FixTriggerOperators (ConversionRule ):
258258 """
259- Rule to ensure logical operators in trigger expressions s use ampersand (&)
260- and pipe (|) instead of 'and' and 'or' before 2.4.
259+ Rule to ensure trigger expressions use old style operators before 2.4.
260+ The following conversions are made:
261+
262+ * and -> &
263+ * or -> |
264+ * <> -> #
265+
266+ See: https://www.zabbix.com/documentation/2.2/manual/config/triggers/expression
261267 """
262268
263269 def __str__ (self ):
264- return 'Logical operators in triggers must use ampersand and pipe before 2.4.0'
270+ return 'Triggers must use old style operators before 2.4.0'
265271
266272 def apply (self ):
267273 if self .versioncmp ('2.4' ) >= 0 :
@@ -276,6 +282,7 @@ class FixTriggerOperators(ConversionRule):
276282 ):
277283 node .text = re .sub (r"\s+and\s+" , '&' , node .text )
278284 node .text = re .sub (r"\s+or\s+" , '|' , node .text )
285+ node .text = re .sub (r"<>" , "#" , node .text )
279286
280287class FixLastTriggerFunction (ConversionRule ):
281288 """
@@ -295,7 +302,7 @@ class FixLastTriggerFunction(ConversionRule):
295302 node is not None
296303 and node .text is not None
297304 ):
298- node .text = re .sub (r"\.last\(\)" , '.last(#1 )' , node .text )
305+ node .text = re .sub (r"\.last\(\)" , '.last(0 )' , node .text )
299306
300307# read xml template
301308doc = ET .parse (args .file )
0 commit comments