]> granicus.if.org Git - icinga2/commitdiff
Rename "short_name", "host" and "sevice" attributes.
authorGunnar Beutner <gunnar@beutner.name>
Sat, 5 Apr 2014 07:15:40 +0000 (09:15 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Sat, 5 Apr 2014 07:15:40 +0000 (09:15 +0200)
Fixes #5857

18 files changed:
doc/4.3-object-types.md
etc/icinga2/conf.d/localhost.conf
lib/base/dynamicobject.ti
lib/config/base-type.conf
lib/config/configitem.cpp
lib/icinga/dependency-apply.cpp
lib/icinga/dependency.cpp
lib/icinga/dependency.ti
lib/icinga/icinga-type.conf
lib/icinga/notification-apply.cpp
lib/icinga/notification.cpp
lib/icinga/notification.ti
lib/icinga/scheduleddowntime-apply.cpp
lib/icinga/scheduleddowntime.cpp
lib/icinga/scheduleddowntime.ti
lib/icinga/service-apply.cpp
lib/icinga/service.cpp
lib/icinga/service.ti

index b34985020063c25fdd021e17309919bf323939f1..808d5138ae2314ab4a72a62ab5e2dcd7b7a681bb 100644 (file)
@@ -53,8 +53,8 @@ by Icinga 2.
 Example:
 
     object Service "localhost-uptime" {
-      host = "localhost"
-      short_name = "uptime"
+      host_name = "localhost"
+      name = "uptime"
 
       display_name = "localhost Uptime"
 
@@ -75,8 +75,8 @@ Attributes:
 
   Name            |Description
   ----------------|----------------
-  host            |**Required.** The host this service belongs to. There must be a `Host` object with that name.
-  short_name      |**Required.** The service name. Must be unique on a per-host basis (Similar to the service_description attribute in Icinga 1.x).
+  host_name       |**Required.** The host this service belongs to. There must be a `Host` object with that name.
+  name            |**Required.** The service name. Must be unique on a per-host basis (Similar to the service_description attribute in Icinga 1.x).
   display_name    |**Optional.** A short description of the service.
   vars            |**Optional.** A dictionary containing custom attributes that are specific to this host.
   check\_command  |**Required.** The name of the check command.
@@ -127,8 +127,8 @@ of service state changes and other events.
 Example:
 
     object Notification "localhost-ping-notification" {
-      host = "localhost"
-      service = "ping4"
+      host_name = "localhost"
+      service_name = "ping4"
 
       notification_command = "mail-notification"
 
@@ -139,8 +139,8 @@ Attributes:
 
   Name            |Description
   ----------------|----------------
-  host            |**Required.** The name of the host this notification belongs to.
-  service         |**Required.** The short name of the service this notification belongs to.
+  host_name       |**Required.** The name of the host this notification belongs to.
+  service_name    |**Required.** The short name of the service this notification belongs to.
   vars            |**Optional.** A dictionary containing custom attributes that are specific to this notification object.
   users           |**Optional.** A list of user names who should be notified.
   user_groups     |**Optional.** A list of user group names who should be notified.
@@ -185,11 +185,11 @@ Dependency objects are used to specify dependencies between hosts and services.
 Example:
 
     object Dependency "webserver-internet" {
-      child_host = "webserver"
-      child_service = "ping4"
+      child_host_name = "webserver"
+      child_service_name = "ping4"
 
-      parent_host = "internet"
-      parent_service = "ping4"
+      parent_host_name = "internet"
+      parent_service_name = "ping4"
 
       state_filter = StateFilterOK
 
@@ -344,8 +344,8 @@ ScheduledDowntime objects can be used to set up recurring downtimes for services
 Example:
 
     object ScheduledDowntime "some-downtime" {
-      host = "localhost"
-      service = "ping4"
+      host_name = "localhost"
+      service_name = "ping4"
 
       author = "icingaadmin"
       comment = "Some comment"
@@ -362,8 +362,8 @@ Attributes:
 
   Name            |Description
   ----------------|----------------
-  host            |**Required.** The name of the host this notification belongs to.
-  service         |**Required.** The short name of the service this notification belongs to.
+  host_name       |**Required.** The name of the host this notification belongs to.
+  service_name    |**Required.** The short name of the service this notification belongs to.
   author          |**Required.** The author of the downtime.
   comment         |**Required.** A comment for the downtime.
   fixed           |**Optional.** Whether this is a fixed downtime. Defaults to true.
index c0212a0f1c351df034ee46ffc7b5a4d130ca706e..b2b77f8cb421083c1c5e062e0b5d1b58468f474e 100644 (file)
@@ -45,7 +45,7 @@ apply Service "load" {
 apply ScheduledDowntime "backup-downtime" {
   import "backup-downtime"
 
-  assign where service.host == "localhost" && service.short_name == "load"
+  assign where host.name == "localhost" && service.name == "load"
 }
 
 apply Service "processes" {
index ca18ea159e62d7d57ac0f3f45123f4b3bb06bc21..49d2c642cd5f8ec52ca5cab92e7f41bc070ab4d8 100644 (file)
@@ -3,7 +3,15 @@ namespace icinga
 
 abstract class DynamicObject
 {
-       [config] String name (Name);
+       [config] String __name (Name);
+       [config] String name (ShortName) {
+               get {{{
+                       if (m_ShortName.IsEmpty())
+                               return GetName();
+                       else
+                               return m_ShortName;
+               }}}
+       };
        [config, get_protected] String type (TypeName);
        [config, get_protected] Array::Ptr templates;
        [config] Dictionary::Ptr methods;
index d4648e741d26cfce4880ffaca2130f9076681071..75c3a6d5f6aa36f386d9b338444879c0223f9924 100644 (file)
@@ -18,8 +18,8 @@
  ******************************************************************************/
 
 %type DynamicObject {
-       %require "name",
-       %attribute %string "name",
+       %require "__name",
+       %attribute %string "__name",
 
        %require "type",
        %attribute %string "type",
index 5f3052b35b07e60ec6b93813048ba70c77bef3d7..4889891a32d36c64e3c80c554b4c5a356f68eb66 100644 (file)
@@ -117,12 +117,12 @@ Dictionary::Ptr ConfigItem::GetProperties(void)
        if (!m_Properties) {
                m_Properties = make_shared<Dictionary>();
                m_Properties->Set("type", m_Type);
-               m_Properties->Set("name", m_Name);
+               m_Properties->Set("__name", m_Name);
                m_Properties->Set("__parent", m_Scope);
                GetExpressionList()->Evaluate(m_Properties);
                m_Properties->Remove("__parent");
 
-               VERIFY(m_Properties->Get("type") == GetType() && m_Properties->Get("name") == GetName());
+               VERIFY(m_Properties->Get("type") == GetType() && m_Properties->Get("__name") == GetName());
        }
 
        return m_Properties;
index 503998b06ec2c3a6aa34381f772cd3fad1938614..3a6249a4769f2831866e1bd60dacf9592b839fbb 100644 (file)
@@ -69,12 +69,12 @@ void Dependency::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
                        builder->SetScope(rule.GetScope());
 
                        builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
-                           make_shared<AExpression>(&AExpression::OpLiteral, "child_host", di),
+                           make_shared<AExpression>(&AExpression::OpLiteral, "child_host_name", di),
                            make_shared<AExpression>(&AExpression::OpLiteral, service->GetHost()->GetName(),
                            di), di));
 
                        builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
-                           make_shared<AExpression>(&AExpression::OpLiteral, "child_service", di),
+                           make_shared<AExpression>(&AExpression::OpLiteral, "child_service_name", di),
                            make_shared<AExpression>(&AExpression::OpLiteral, service->GetShortName(), di), di));
 
                        builder->AddExpression(rule.GetExpression());
index 10bd6fa08d97f6e6e3e21f1bb8add699d0f22a9a..28d33255466f0a36a7ee2df1129e96c7e9e5bedd 100644 (file)
@@ -116,28 +116,28 @@ bool Dependency::IsAvailable(DependencyType dt) const
 
 Checkable::Ptr Dependency::GetChild(void) const
 {
-       Host::Ptr host = Host::GetByName(GetChildHostRaw());
+       Host::Ptr host = Host::GetByName(GetChildHostName());
 
        if (!host)
                return Service::Ptr();
 
-       if (GetChildServiceRaw().IsEmpty())
+       if (GetChildServiceName().IsEmpty())
                return host;
        else
-               return host->GetServiceByShortName(GetChildServiceRaw());
+               return host->GetServiceByShortName(GetChildServiceName());
 }
 
 Checkable::Ptr Dependency::GetParent(void) const
 {
-       Host::Ptr host = Host::GetByName(GetParentHostRaw());
+       Host::Ptr host = Host::GetByName(GetParentHostName());
 
        if (!host)
                return Service::Ptr();
 
-       if (GetParentServiceRaw().IsEmpty())
+       if (GetParentServiceName().IsEmpty())
                return host;
        else
-               return host->GetServiceByShortName(GetParentServiceRaw());
+               return host->GetServiceByShortName(GetParentServiceName());
 }
 
 TimePeriod::Ptr Dependency::GetPeriod(void) const
index 81ad2688571261106cedb3beaf65157aefeb85e4..94d8649c751d19eebb3df5b1e683da0dd982a3ba 100644 (file)
@@ -6,11 +6,11 @@ namespace icinga
 
 class Dependency : DynamicObject
 {
-       [config] String child_host (ChildHostRaw);
-       [config] String child_service (ChildServiceRaw);
+       [config] String child_host_name;
+       [config] String child_service_name;
 
-       [config] String parent_host  (ParentHostRaw);
-       [config] String parent_service (ParentServiceRaw);
+       [config] String parent_host_name;
+       [config] String parent_service_name;
 
        [config] String period (PeriodRaw);
 
index 71b1bae86711bfdbc2aa9c5606fd9ec117c7483f..771045c221a6a0d67962c32665ba4577d17d3a62 100644 (file)
 }
 
 %type Service %inherits Checkable {
-       %require "host",
-       %attribute %name(Host) "host",
-
-       %attribute %string "short_name",
+       %require "host_name",
+       %attribute %name(Host) "host_name",
 
+       %attribute %string "name",
 
        %attribute %array "groups" {
                %attribute %name(ServiceGroup) "*"
 }
 
 %type Notification {
-       %require "host",
-       %attribute %name(Host) "host",
+       %require "host_name",
+       %attribute %name(Host) "host_name",
 
-       %require "service",
-       %attribute %string "service",
+       %require "service_name",
+       %attribute %string "service_name",
 
        %attribute %array "users" {
                %attribute %name(User) "*"
 }
 
 %type ScheduledDowntime {
-       %require "host",
-       %attribute %name(Host) "host",
-       %require "service",
-       %attribute %string "service",
+       %require "host_name",
+       %attribute %name(Host) "host_name",
+       %require "service_name",
+       %attribute %string "service_name",
 
        %require "author",
        %attribute %string "author",
 }
 
 %type Dependency {
-       %require "parent_host",
-       %attribute %name(Host) "parent_host",
-       %attribute %string "parent_service",
+       %require "parent_host_name",
+       %attribute %name(Host) "parent_host_name",
+       %attribute %string "parent_service_name",
 
-       %require "child_host",
-       %attribute %name(Host) "child_host",
-       %attribute %string "child_service",
+       %require "child_host_name",
+       %attribute %name(Host) "child_host_name",
+       %attribute %string "child_service_name",
 
        %attribute %name(TimePeriod) "period",
 
index 557f6e124ec8ea6f17b72bbe4b0022bd398acb05..998f5ed158b6b537fc95c7ac0fc9f60e3d2d3d58 100644 (file)
@@ -68,12 +68,12 @@ void Notification::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
                        builder->SetScope(rule.GetScope());
 
                        builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
-                           make_shared<AExpression>(&AExpression::OpLiteral, "host", di),
+                           make_shared<AExpression>(&AExpression::OpLiteral, "host_name", di),
                            make_shared<AExpression>(&AExpression::OpLiteral, service->GetHost()->GetName(), di),
                            di));
 
                        builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
-                           make_shared<AExpression>(&AExpression::OpLiteral, "service", di),
+                           make_shared<AExpression>(&AExpression::OpLiteral, "service_name", di),
                            make_shared<AExpression>(&AExpression::OpLiteral, service->GetShortName(), di),
                            di));
 
index f304f6d9e93bf6989dce608b48b6c53cc73c7638..f4d47f58306cf67c6caa9b2245500596c93635b2 100644 (file)
@@ -77,12 +77,12 @@ void Notification::Stop(void)
 
 Checkable::Ptr Notification::GetCheckable(void) const
 {
-       Host::Ptr host = Host::GetByName(GetHostRaw());
+       Host::Ptr host = Host::GetByName(GetHostName());
 
-       if (GetServiceRaw().IsEmpty())
+       if (GetServiceName().IsEmpty())
                return host;
        else
-               return host->GetServiceByShortName(GetServiceRaw());
+               return host->GetServiceByShortName(GetServiceName());
 }
 
 NotificationCommand::Ptr Notification::GetNotificationCommand(void) const
index e6b299b4de9b3ecc9419f2d8b22884345f1dfd33..7449275fafeb7cbba3d6353c2ad5c1312c2308d8 100644 (file)
@@ -20,8 +20,8 @@ class Notification : DynamicObject
        [config] int notification_state_filter {
                default {{{ return ~(int)0; }}}
        };
-       [config, protected] String host (HostRaw);
-       [config, protected] String service (ServiceRaw);
+       [config, protected] String host_name;
+       [config, protected] String service_name;
 
        [state] double last_notification;
        [state, set_protected] double next_notification (NextNotificationRaw);
index ff1ffb127d6b2495ad332ba8dfcd4a06f7797f11..09085adaa25063b56b374b8b00d19baa9b4a3a2a 100644 (file)
@@ -68,12 +68,12 @@ void ScheduledDowntime::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
                        builder->SetScope(rule.GetScope());
 
                        builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
-                           make_shared<AExpression>(&AExpression::OpLiteral, "host", di),
+                           make_shared<AExpression>(&AExpression::OpLiteral, "host_name", di),
                            make_shared<AExpression>(&AExpression::OpLiteral, service->GetHost()->GetName(), di),
                            di));
 
                        builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
-                           make_shared<AExpression>(&AExpression::OpLiteral, "service", di),
+                           make_shared<AExpression>(&AExpression::OpLiteral, "service_name", di),
                            make_shared<AExpression>(&AExpression::OpLiteral, service->GetShortName(), di),
                            di));
 
index 7654fed5197f959304dc0d3e719ded6a47e9081c..826b8e3767aac9cbedf40e6e453f1f4761861124 100644 (file)
@@ -61,12 +61,12 @@ void ScheduledDowntime::TimerProc(void)
 
 Checkable::Ptr ScheduledDowntime::GetCheckable(void) const
 {
-       Host::Ptr host = Host::GetByName(GetHostRaw());
+       Host::Ptr host = Host::GetByName(GetHostName());
 
-       if (GetServiceRaw().IsEmpty())
+       if (GetServiceName().IsEmpty())
                return host;
        else
-               return host->GetServiceByShortName(GetServiceRaw());
+               return host->GetServiceByShortName(GetServiceName());
 }
 
 std::pair<double, double> ScheduledDowntime::FindNextSegment(void)
index 6b31a5fa15b4bcaadce5b8dfd88ba93b2f821b4a..9f25e1cf1dc7b18b4bd59f8e7e59137836e1355f 100644 (file)
@@ -5,8 +5,8 @@ namespace icinga
 
 class ScheduledDowntime : DynamicObject
 {
-       [config, protected] String host (HostRaw);
-       [config, protected] String service (ServiceRaw);
+       [config, protected] String host_name;
+       [config, protected] String service_name;
 
        [config] String author;
        [config] String comment;
index 6433237e82107f2d6aba71a8d44ebb0582b69a17..d41499070617de82666b242f49221f07f20beed2 100644 (file)
@@ -67,12 +67,12 @@ void Service::EvaluateApplyRules(const std::vector<ApplyRule>& rules)
                        builder->SetScope(rule.GetScope());
 
                        builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
-                           make_shared<AExpression>(&AExpression::OpLiteral, "host", di), 
+                           make_shared<AExpression>(&AExpression::OpLiteral, "host_name", di), 
                            make_shared<AExpression>(&AExpression::OpLiteral, host->GetName(), di),
                            di));
 
                        builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
-                           make_shared<AExpression>(&AExpression::OpLiteral, "short_name", di),
+                           make_shared<AExpression>(&AExpression::OpLiteral, "name", di),
                            make_shared<AExpression>(&AExpression::OpLiteral, rule.GetName(), di),
                            di));
 
index 2f9eac67a25dc009521ab1590d43194f8348a277..62c4fffb8d52a827a5a33c01f1edd7aedbe238af 100644 (file)
@@ -54,7 +54,7 @@ void Service::OnConfigLoaded(void)
                }
        }
 
-       m_Host = Host::GetByName(GetHostRaw());
+       m_Host = Host::GetByName(GetHostName());
 
        if (m_Host)
                m_Host->AddService(GetSelf());
index 93cc579371b68a4da0ba2c23a7c3d2d85738225b..f48033500a69ba16972a2004f97b00726cc6d7f9 100644 (file)
@@ -16,15 +16,7 @@ class Service : Checkable
                                return m_DisplayName;
                }}}
        };
-       [config] String short_name {
-               get {{{
-                       if (m_ShortName.IsEmpty())
-                               return GetName();
-                       else
-                               return m_ShortName;
-               }}}
-       };
-       [config] String host (HostRaw);
+       [config] String host_name;
        [enum] ServiceState "state" {
                get {{{
                        return GetStateRaw();