You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test
Adrián López dac3bf5b71 zabbix_host: interface.port parameter is a string (#64986)
interface.port should be a string to be able to use macros in that
value.
This fixes the case when interface.port is a macro (eg.: "{$MACRO}" and
force=false.

Because, until now, setting the interface.port to an integer was the correct way to work with force=false, a type validation has been added
to that parameter.
Previously, if a string was used for interface.port, it was converted
to an integer, the comparison didn't work (if interface not in interfaces)
and the module tried to register the same interface twice, returning an
error.

Zabbix API manual specifies that only 'main, 'type', 'useip' and 'bulk'
are integers.
https://www.zabbix.com/documentation/current/manual/api/reference/hostinterface/object

Tests are changed to use always str in the interface.port.

Two new tests are added.
The first one is to show that now registering a host with force=false and
a macro in interface.port works.
The other one tests that interfaces defined using string for port are
compared correctly when force=false is used. Previously it was
a comparison between int and str, interfaces were seen as different
and an error was thrown because we were trying to create twice a main
interface.

* Try to kindly convert interface port to the string

As suggested, the previous behaviour could break current configurations. This solution accepts integers and strings.

Co-Authored-By: Dusan Matejka <D3DeFi@users.noreply.github.com>
5 years ago
..
ansible_test Relocate ansible-test self tests outside package. (#61255) 5 years ago
integration zabbix_host: interface.port parameter is a string (#64986) 5 years ago
legacy Sanity test fixups - AWS related tests (#64093) 5 years ago
lib/ansible_test Sanity checks: test for print statement (#65219) 5 years ago
sanity fixed inconsistent required set to True in zabbix modules 5 years ago
units Fix flake8 errors for iosxr tests (#65860) 5 years ago
utils Increase unit test timeout in CI. 5 years ago