unioslo / zabbix-cli

Command-line interface for Zabbix
https://unioslo.github.io/zabbix-cli/
GNU General Public License v3.0
208 stars 104 forks source link

Fix: limit upper case conversion of host user macros to name part and leave context part as is #155

Closed emanueleborin closed 2 years ago

emanueleborin commented 2 years ago

Fixes #132

For example:

define_host_usermacro test-issue-132 'max_usage:/home/' 'some value'
define_host_usermacro test-issue-132 'macro_name:regex:[abc]+' 'some value'

Current behaviour:

+---------+----------------------------+------------+
| MacroID | Name                       | Value      |
+---------+----------------------------+------------+
|  123456 | {$MAX_USAGE:/HOME/}        | some value |
+---------+----------------------------+------------+
|  123457 | {$MACRO_NAME:REGEX:[ABC]+} | some value |
+---------+----------------------------+------------+

Fixed:

+---------+----------------------------+------------+
| MacroID | Name                       | Value      |
+---------+----------------------------+------------+
|  123456 | {$MAX_USAGE:/home/}        | some value |
+---------+----------------------------+------------+
|  123457 | {$MACRO_NAME:regex:[abc]+} | some value |
+---------+----------------------------+------------+

define_host_usermacro_tests.txt

mbakke commented 2 years ago

Merged, thank you!