Skip to content

Commit

Permalink
Don't allow to change object parent,host/service_name at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Sep 9, 2022
1 parent 14e4f6b commit 28c29c1
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions lib/icinga/comment.ti
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class Comment : ConfigObject < CommentNameComposer
load_after Host;
load_after Service;

[config, protected, required, navigation(host)] name(Host) host_name {
[config, no_user_modify, protected, required, navigation(host)] name(Host) host_name {
navigate {{{
return Host::GetByName(GetHostName());
}}}
};
[config, protected, navigation(service)] String service_name {
[config, no_user_modify, protected, navigation(service)] String service_name {
track {{{
if (!oldValue.IsEmpty()) {
Service::Ptr service = Service::GetByNamePair(GetHostName(), oldValue);
Expand Down
8 changes: 4 additions & 4 deletions lib/icinga/dependency.ti
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ class Dependency : CustomVarObject < DependencyNameComposer
load_after Host;
load_after Service;

[config, required, navigation(child_host)] name(Host) child_host_name {
[config, no_user_modify, required, navigation(child_host)] name(Host) child_host_name {
navigate {{{
return Host::GetByName(GetChildHostName());
}}}
};

[config, navigation(child_service)] String child_service_name {
[config, no_user_modify, navigation(child_service)] String child_service_name {
track {{{
if (!oldValue.IsEmpty()) {
Service::Ptr service = Service::GetByNamePair(GetChildHostName(), oldValue);
Expand All @@ -50,13 +50,13 @@ class Dependency : CustomVarObject < DependencyNameComposer
}}}
};

[config, required, navigation(parent_host)] name(Host) parent_host_name {
[config, no_user_modify, required, navigation(parent_host)] name(Host) parent_host_name {
navigate {{{
return Host::GetByName(GetParentHostName());
}}}
};

[config, navigation(parent_service)] String parent_service_name {
[config, no_user_modify, navigation(parent_service)] String parent_service_name {
track {{{
if (!oldValue.IsEmpty()) {
Service::Ptr service = Service::GetByNamePair(GetParentHostName(), oldValue);
Expand Down
4 changes: 2 additions & 2 deletions lib/icinga/downtime.ti
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ class Downtime : ConfigObject < DowntimeNameComposer
load_after Host;
load_after Service;

[config, required, navigation(host)] name(Host) host_name {
[config, no_user_modify, required, navigation(host)] name(Host) host_name {
navigate {{{
return Host::GetByName(GetHostName());
}}}
};
[config, navigation(service)] String service_name {
[config, no_user_modify, navigation(service)] String service_name {
track {{{
if (!oldValue.IsEmpty()) {
Service::Ptr service = Service::GetByNamePair(GetHostName(), oldValue);
Expand Down
4 changes: 2 additions & 2 deletions lib/icinga/notification.ti
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ class Notification : CustomVarObject < NotificationNameComposer
[no_user_view, no_user_modify] int type_filter_real (TypeFilter);
[config] array(Value) states;
[no_user_view, no_user_modify] int state_filter_real (StateFilter);
[config, protected, required, navigation(host)] name(Host) host_name {
[config, no_user_modify, protected, required, navigation(host)] name(Host) host_name {
navigate {{{
return Host::GetByName(GetHostName());
}}}
};
[config, protected, navigation(service)] String service_name {
[config, protected, no_user_modify, navigation(service)] String service_name {
track {{{
if (!oldValue.IsEmpty()) {
Service::Ptr service = Service::GetByNamePair(GetHostName(), oldValue);
Expand Down
4 changes: 2 additions & 2 deletions lib/icinga/scheduleddowntime.ti
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ class ScheduledDowntime : CustomVarObject < ScheduledDowntimeNameComposer
load_after Host;
load_after Service;

[config, protected, required, navigation(host)] name(Host) host_name {
[config, protected, no_user_modify, required, navigation(host)] name(Host) host_name {
navigate {{{
return Host::GetByName(GetHostName());
}}}
};
[config, protected, navigation(service)] String service_name {
[config, protected, no_user_modify, navigation(service)] String service_name {
track {{{
if (!oldValue.IsEmpty()) {
Service::Ptr service = Service::GetByNamePair(GetHostName(), oldValue);
Expand Down
2 changes: 1 addition & 1 deletion lib/icinga/service.ti
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Service : Checkable < ServiceNameComposer
return displayName;
}}}
};
[config, required] name(Host) host_name;
[config, no_user_modify, required] name(Host) host_name;
[no_storage, navigation] Host::Ptr host {
get;
navigate {{{
Expand Down
2 changes: 1 addition & 1 deletion lib/remote/zone.ti
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace icinga

class Zone : ConfigObject
{
[config, navigation] name(Zone) parent (ParentRaw) {
[config, no_user_modify, navigation] name(Zone) parent (ParentRaw) {
navigate {{{
return Zone::GetByName(GetParentRaw());
}}}
Expand Down

0 comments on commit 28c29c1

Please sign in to comment.