Commit Graph

7 Commits (9dd548ebb785dcb156d77b9a946b8e377ee2232d)

Author SHA1 Message Date
sky-joker 7b2cfdacd0 Zabbix: Handle KeyError in zabbix_host module (#65392)
Fixes: #65304
5 years ago
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
Dusan Matejka fadf7a426f re-enable zabbix_host integration tests and add cleanup handlers 5 years ago
Dusan Matejka 57c36e0378 Zabbix integration tests (#63744)
* adjusted setup_zabbix integration tests role to work on distributions from Debian family

* bumped zabbix_host integration tests role to be run against bionic
5 years ago
Matt Clay 149336319a
Clean up local_action and delegate_to in tests. (#55835)
* Remove unnecessary delegate_to in tests.

* Remove incorrect delegate_to in tests.

* Remove unnecessary use of local_action in tests.

* Remove incorrect use of local_action in tests.

* Remove unnecessary use of local_action in tests.

* Remove incorrect use of local_action in tests.

* Remove unnecessary use of local_action in tests.

* Use delegate_to instead of local_action in tests.

* Use setup_remote_tmp_dir instead of TMPDIR.
5 years ago
Eike Frost d84e0861ef zabbix_host ipmi_*-tests (#33717)
* zabbix_host ipmi_*-tests

* oops, double assert fixed
7 years ago
Eike Frost ed376abe42 zabbix_host integration tests (#33184)
* Integration tests for zabbix_host using Zabbix on Ubuntu 14.04.

* fix duplicate yaml key in test

* .changed -> is changed, |failed -> is failed, trim configfile

* zabbix_host integration test does not need BOTMETA entry, inherited from module
7 years ago