Skip to content

Commit

Permalink
Cli: Add zone attribute for 'agent update-config' command
Browse files Browse the repository at this point in the history
refs #7248
  • Loading branch information
Michael Friedrich committed Oct 28, 2014
1 parent 028186e commit 3c5645c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/cli/agentupdateconfigcommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ int AgentUpdateConfigCommand::Run(const boost::program_options::variables_map& v

BOOST_FOREACH(const Dictionary::Ptr& agent, AgentUtility::GetAgents()) {
Dictionary::Ptr repository = agent->Get("repository");
String zone = agent->Get("zone");

ObjectLock olock(repository);
BOOST_FOREACH(const Dictionary::Pair& kv, repository) {
Expand All @@ -81,6 +82,7 @@ int AgentUpdateConfigCommand::Run(const boost::program_options::variables_map& v
/* add a new host to the config repository */
Dictionary::Ptr host_attrs = make_shared<Dictionary>();
host_attrs->Set("check_command", "dummy"); //TODO: add a repository-host template
host_attrs->Set("zone", zone);

if (!RepositoryUtility::AddObject(host, "Host", host_attrs)) {
Log(LogCritical, "cli")
Expand All @@ -96,6 +98,7 @@ int AgentUpdateConfigCommand::Run(const boost::program_options::variables_map& v
Dictionary::Ptr service_attrs = make_shared<Dictionary>();
service_attrs->Set("host_name", host); //Required for host-service relation
service_attrs->Set("check_command", "dummy"); //TODO: add a repository-service template
service_attrs->Set("zone", zone);

if (!RepositoryUtility::AddObject(service, "Service", service_attrs)) {
Log(LogCritical, "cli")
Expand Down

0 comments on commit 3c5645c

Please sign in to comment.