mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
Cli: Ignore 'localhost' from agent repository on 'update-config'
refs #7249
This commit is contained in:
parent
8251a60044
commit
e7c07fb66b
@ -101,6 +101,12 @@ int AgentUpdateConfigCommand::Run(const boost::program_options::variables_map& v
|
|||||||
String host_pattern = host + ".conf";
|
String host_pattern = host + ".conf";
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
|
|
||||||
|
if (host == "localhost") {
|
||||||
|
Log(LogWarning, "cli")
|
||||||
|
<< "Ignoring host '" << host << "'. Please make sure to configure a unique name on your agent '" << endpoint << "'.";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_FOREACH(const String& object_path, object_paths) {
|
BOOST_FOREACH(const String& object_path, object_paths) {
|
||||||
if (object_path.Contains(host_pattern)) {
|
if (object_path.Contains(host_pattern)) {
|
||||||
Log(LogWarning, "cli")
|
Log(LogWarning, "cli")
|
||||||
@ -209,13 +215,21 @@ int AgentUpdateConfigCommand::Run(const boost::program_options::variables_map& v
|
|||||||
zone_attrs->Set("name", zone);
|
zone_attrs->Set("name", zone);
|
||||||
zone_attrs->Set("endpoints", zone_members);
|
zone_attrs->Set("endpoints", zone_members);
|
||||||
|
|
||||||
String parent_zone = "master"; //hardcode the name
|
String agent_parent_zone = "master"; //hardcode the name
|
||||||
|
String parent_zone;
|
||||||
|
|
||||||
if (!agent->Contains("parent_zone") || !agent->Get("parent_zone")) {
|
if (!agent->Contains("parent_zone")) {
|
||||||
Log(LogWarning, "cli")
|
Log(LogWarning, "cli")
|
||||||
<< "Agent '" << endpoint << "' does not have any parent zone defined. Using 'master' as default. Please verify the generated configuration.";
|
<< "Agent '" << endpoint << "' does not have any parent zone defined. Using 'master' as default. Please verify the generated configuration.";
|
||||||
|
parent_zone = agent_parent_zone;
|
||||||
} else {
|
} else {
|
||||||
parent_zone = agent->Get("parent_zone");
|
parent_zone = agent->Get("parent_zone");
|
||||||
|
|
||||||
|
if (parent_zone.IsEmpty()) {
|
||||||
|
Log(LogWarning, "cli")
|
||||||
|
<< "Agent '" << endpoint << "' does not have any parent zone defined. Using 'master' as default. Please verify the generated configuration.";
|
||||||
|
parent_zone = agent_parent_zone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
zone_attrs->Set("parent", parent_zone);
|
zone_attrs->Set("parent", parent_zone);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user