Source
$host = ($data['vault'] === 'Hashicorp') ? 'Host for creating Vault macros' : 'Empty host without macros';
<?php
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
require_once dirname(__FILE__).'/../common/testFormMacros.php';
/**
* @backup hosts, config
*
* @dataSource GlobalMacros
*
* @onBefore prepareHostMacrosData
*/
class testFormMacrosHost extends testFormMacros {
protected $macro_resolve = '{$X_SECRET_HOST_MACRO_2_RESOLVE}';
protected $update_vault_macro = '{$VAULT_HOST_MACRO3_CHANGED}';
protected $hashi_error_field = '/1/macros/4/value';
protected $cyber_error_field = '/1/macros/4/value';
protected $vault_macro_index = 2;
protected $vault_object = 'host';
protected $revert_macro_1 = '{$SECRET_HOST_MACRO_REVERT}';
protected $revert_macro_2 = '{$SECRET_HOST_MACRO_2_TEXT_REVERT}';
protected $revert_macro_object = 'host';
protected static $hostid_remove_inherited;
protected static $macro_resolve_hostid;
public function prepareHostMacrosData() {
$hosts = CDataHelper::createHosts([
[
'host' => 'Host with macros',
'groups' => ['groupid' => self::ZABBIX_SERVERS_GROUPID],
'macros' => [
['macro' => '{$MACRO1}', 'value' => ''],
['macro' => '{$MACRO2}', 'value' => '']
]
],
[
'host' => 'Host for removing macros',
'groups' => ['groupid' => self::ZABBIX_SERVERS_GROUPID],
'macros' => [
['macro' => '{$MACRO_FOR_REMOVE1}', 'value' => ''],
['macro' => '{$MACRO_FOR_REMOVE2}', 'value' => '']
]
],
[
'host' => 'Host for Inherited macros removing',
'groups' => [['groupid' => self::ZABBIX_SERVERS_GROUPID]],
'macros' => [
[
'macro' => '{$TEST_MACRO123}',