mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-21 12:44:58 +02:00
Config Conversion: introduce resource.conf with global macros
refs #4701
This commit is contained in:
parent
2b9568fbd5
commit
c8b9fce0bc
@ -103,6 +103,21 @@ sub end_object_type_config_dump {
|
|||||||
# DUMP ALL OBJECTS 2.x
|
# DUMP ALL OBJECTS 2.x
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
sub dump_cfg_resource_2x {
|
||||||
|
my $icinga2_cfg = shift;
|
||||||
|
my $icinga2_global_macros = shift;
|
||||||
|
|
||||||
|
start_object_type_config_dump($icinga2_cfg, 'resource');
|
||||||
|
|
||||||
|
dump_config_line($icinga2_cfg, "set IcingaMacros = {");
|
||||||
|
foreach my $global_macro_2x_key (sort keys %{$icinga2_global_macros}) {
|
||||||
|
dump_config_line($icinga2_cfg, "\t\"$global_macro_2x_key\" = \"$icinga2_global_macros->{$global_macro_2x_key}\",");
|
||||||
|
}
|
||||||
|
|
||||||
|
dump_config_line($icinga2_cfg, "}");
|
||||||
|
|
||||||
|
end_object_type_config_dump($icinga2_cfg);
|
||||||
|
}
|
||||||
|
|
||||||
sub dump_cfg_obj_2x {
|
sub dump_cfg_obj_2x {
|
||||||
my $icinga2_cfg = shift;
|
my $icinga2_cfg = shift;
|
||||||
|
@ -112,6 +112,7 @@ if (defined $opt->{version}) { print $version."\n"; exit 0; }
|
|||||||
if ($opt->{help}) { pod2usage(1); }
|
if ($opt->{help}) { pod2usage(1); }
|
||||||
|
|
||||||
$icinga2_cfg->{'main'}= "$conf_prefix/icinga2.conf";
|
$icinga2_cfg->{'main'}= "$conf_prefix/icinga2.conf";
|
||||||
|
$icinga2_cfg->{'resource'}= "$conf_prefix/resource.conf";
|
||||||
$icinga2_cfg->{'hosts'}= "$conf_prefix/hosts.conf";
|
$icinga2_cfg->{'hosts'}= "$conf_prefix/hosts.conf";
|
||||||
$icinga2_cfg->{'services'}= "$conf_prefix/services.conf";
|
$icinga2_cfg->{'services'}= "$conf_prefix/services.conf";
|
||||||
$icinga2_cfg->{'users'}= "$conf_prefix/users.conf";
|
$icinga2_cfg->{'users'}= "$conf_prefix/users.conf";
|
||||||
@ -152,6 +153,7 @@ my $icinga1_user_macros = Icinga2::ImportIcinga1Cfg::parse_icinga1_user_macros($
|
|||||||
my $icinga2_cfg_obj = Icinga2::Convert::convert_2x($icinga2_cfg, $icinga1_cfg_obj, $icinga1_cfg_obj_cache, $icinga1_user_macros);
|
my $icinga2_cfg_obj = Icinga2::Convert::convert_2x($icinga2_cfg, $icinga1_cfg_obj, $icinga1_cfg_obj_cache, $icinga1_user_macros);
|
||||||
|
|
||||||
# the export
|
# the export
|
||||||
|
Icinga2::ExportIcinga2Cfg::dump_cfg_resource_2x($icinga2_cfg, $icinga1_user_macros);
|
||||||
Icinga2::ExportIcinga2Cfg::dump_cfg_obj_2x($icinga2_cfg, $icinga2_cfg_obj);
|
Icinga2::ExportIcinga2Cfg::dump_cfg_obj_2x($icinga2_cfg, $icinga2_cfg_obj);
|
||||||
|
|
||||||
# vi: sw=4 ts=4 expandtab :
|
# vi: sw=4 ts=4 expandtab :
|
||||||
|
Loading…
x
Reference in New Issue
Block a user