Drop unused statusmap_image & coords attributes entirely.

Fixes #6044
This commit is contained in:
Michael Friedrich 2014-04-22 13:48:06 +02:00
parent fe1a83ff34
commit c8b3fde2ef
9 changed files with 9 additions and 139 deletions

View File

@ -235,7 +235,6 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
String action_url = host->GetActionUrl();
String icon_image = host->GetIconImage();
String icon_image_alt = host->GetIconImageAlt();
String statusmap_image = CompatUtility::GetCustomAttributeConfig(host, "statusmap_image");
String display_name = host->GetDisplayName();
String address = host->GetAddress();
String address6 = host->GetAddress6();
@ -260,8 +259,6 @@ void StatusDataWriter::DumpHostObject(std::ostream& fp, const Host::Ptr& host)
fp << "\t" "icon_image" "\t" << icon_image << "\n";
if (!icon_image_alt.IsEmpty())
fp << "\t" "icon_image_alt" "\t" << icon_image_alt << "\n";
if (!statusmap_image.IsEmpty())
fp << "\t" "statusmap_image" "\t" << statusmap_image << "\n";
std::set<Checkable::Ptr> parents = host->GetParents();

View File

@ -67,7 +67,7 @@ void HostsTable::AddColumns(Table *table, const String& prefix,
table->AddColumn(prefix + "icon_image", Column(&HostsTable::IconImageAccessor, objectAccessor));
table->AddColumn(prefix + "icon_image_expanded", Column(&HostsTable::IconImageExpandedAccessor, objectAccessor));
table->AddColumn(prefix + "icon_image_alt", Column(&HostsTable::IconImageAltAccessor, objectAccessor));
table->AddColumn(prefix + "statusmap_image", Column(&HostsTable::StatusmapImageAccessor, objectAccessor));
table->AddColumn(prefix + "statusmap_image", Column(&Table::EmptyStringAccessor, objectAccessor));
table->AddColumn(prefix + "long_plugin_output", Column(&HostsTable::LongPluginOutputAccessor, objectAccessor));
table->AddColumn(prefix + "initial_state", Column(&Table::EmptyStringAccessor, objectAccessor));
table->AddColumn(prefix + "max_check_attempts", Column(&HostsTable::MaxCheckAttemptsAccessor, objectAccessor));
@ -118,8 +118,8 @@ void HostsTable::AddColumns(Table *table, const String& prefix,
table->AddColumn(prefix + "x_3d", Column(&EmptyStringAccessor, objectAccessor));
table->AddColumn(prefix + "y_3d", Column(&EmptyStringAccessor, objectAccessor));
table->AddColumn(prefix + "z_3d", Column(&EmptyStringAccessor, objectAccessor));
table->AddColumn(prefix + "x_2d", Column(&HostsTable::X2dAccessor, objectAccessor));
table->AddColumn(prefix + "y_2d", Column(&HostsTable::Y2dAccessor, objectAccessor));
table->AddColumn(prefix + "x_2d", Column(&Table::EmptyStringAccessor, objectAccessor));
table->AddColumn(prefix + "y_2d", Column(&Table::EmptyStringAccessor, objectAccessor));
table->AddColumn(prefix + "latency", Column(&HostsTable::LatencyAccessor, objectAccessor));
table->AddColumn(prefix + "execution_time", Column(&HostsTable::ExecutionTimeAccessor, objectAccessor));
table->AddColumn(prefix + "percent_state_change", Column(&HostsTable::PercentStateChangeAccessor, objectAccessor));
@ -412,16 +412,6 @@ Value HostsTable::IconImageAltAccessor(const Value& row)
return host->GetIconImageAlt();
}
Value HostsTable::StatusmapImageAccessor(const Value& row)
{
Host::Ptr host = static_cast<Host::Ptr>(row);
if (!host)
return Empty;
return CompatUtility::GetCustomAttributeConfig(host, "statusmap_image");
}
Value HostsTable::LongPluginOutputAccessor(const Value& row)
{
Host::Ptr host = static_cast<Host::Ptr>(row);
@ -814,26 +804,6 @@ Value HostsTable::HighFlapThresholdAccessor(const Value& row)
return CompatUtility::GetCheckableHighFlapThreshold(host);
}
Value HostsTable::X2dAccessor(const Value& row)
{
Host::Ptr host = static_cast<Host::Ptr>(row);
if (!host)
return Empty;
return CompatUtility::GetHost2dCoordX(host);
}
Value HostsTable::Y2dAccessor(const Value& row)
{
Host::Ptr host = static_cast<Host::Ptr>(row);
if (!host)
return Empty;
return CompatUtility::GetHost2dCoordY(host);
}
Value HostsTable::LatencyAccessor(const Value& row)
{
Host::Ptr host = static_cast<Host::Ptr>(row);

View File

@ -65,7 +65,6 @@ protected:
static Value IconImageAccessor(const Value& row);
static Value IconImageExpandedAccessor(const Value& row);
static Value IconImageAltAccessor(const Value& row);
static Value StatusmapImageAccessor(const Value& row);
static Value LongPluginOutputAccessor(const Value& row);
static Value MaxCheckAttemptsAccessor(const Value& row);
static Value FlapDetectionEnabledAccessor(const Value& row);
@ -106,8 +105,6 @@ protected:
static Value NotificationIntervalAccessor(const Value& row);
static Value LowFlapThresholdAccessor(const Value& row);
static Value HighFlapThresholdAccessor(const Value& row);
static Value X2dAccessor(const Value& row);
static Value Y2dAccessor(const Value& row);
static Value LatencyAccessor(const Value& row);
static Value ExecutionTimeAccessor(const Value& row);
static Value PercentStateChangeAccessor(const Value& row);

View File

@ -9,8 +9,7 @@ user interface.
Some interface features will only work in a limited manner due to
[compatibility reasons](#differences-1x-2), other features like the
statusmap parents are available through intelligent compatibility layers
for dumping the host dependencies as parents.
statusmap parents are available dumping the host dependencies as parents.
Special restrictions are noted specifically in the sections below.
> **Tip**

View File

@ -52,10 +52,6 @@ Attributes:
> The `address` and `address6` attributes are required for running commands using
> the `$address$` and `$address6` runtime macros.
Unlike Icinga 1.x the `statusmap_image` and `2d_coords` attributes are
custom attributes only in Icinga 2.
### <a id="objecttype-hostgroup"></a> HostGroup
A group of hosts.

View File

@ -168,29 +168,15 @@ Icinga 2 allows you to define custom attributes in the `vars` dictionary.
The `notes`, `notes_url`, `action_url`, `icon_image`, `icon_image_alt`
attributes for host and service objects are still available in Icinga 2.
### <a id="differences-1x-2-action-url-notes-url-notes"></a> Statusmap Image, 2D Coords
These attributes can be set using the `vars` dictionary in Icinga 2 `Host`
or `Service` objects:
vars = {
"2d_coords" = "1,2"
statusmap_image = "../../images/logos/icinga.gif"
}
External interfaces will recognize and display these attributes accordingly.
`2d_coords` and `statusmap_image` are not supported in Icinga 2.
### <a id="differences-1x-2-custom-variables"></a> Custom Variables
Icinga 1.x custom variable attributes must be prefixed using an underscore (`_`).
In Icinga 2 these attributes must be added to the `vars` dictionary as custom attributes.
vars = {
DN = "cn=icinga2-dev-host,ou=icinga,ou=main,ou=IcingaConfig,ou=LConf,dc=icinga,dc=org"
CV = "my custom cmdb description"
}
TODO
vars.dn = "cn=icinga2-dev-host,ou=icinga,ou=main,ou=IcingaConfig,ou=LConf,dc=icinga,dc=org"
vars.cv = "my custom cmdb description"
## <a id="differences-1x-2-host-service-relation"></a> Host Service Relation

View File

@ -102,19 +102,6 @@ Dictionary::Ptr HostDbObject::GetConfigFields(void) const
fields->Set("action_url", host->GetActionUrl());
fields->Set("icon_image", host->GetIconImage());
fields->Set("icon_image_alt", host->GetIconImageAlt());
fields->Set("statusmap_image", CompatUtility::GetCustomAttributeConfig(host, "statusmap_image"));
Host2dCoords coords = CompatUtility::GetHost2dCoords(host);
fields->Set("have_2d_coords", coords.have_2d_coords);
if (coords.have_2d_coords) {
fields->Set("x_2d", coords.x_2d);
fields->Set("y_2d", coords.y_2d);
}
/* deprecated in 1.x */
fields->Set("have_3d_coords", 0);
return fields;
}

View File

@ -70,54 +70,6 @@ String CompatUtility::GetHostAlias(const Host::Ptr& host)
return host->GetDisplayName();
}
Host2dCoords CompatUtility::GetHost2dCoords(const Host::Ptr& host)
{
ASSERT(host->OwnsLock());
Dictionary::Ptr vars = host->GetVars();
Host2dCoords bag;
if (vars) {
String coords = vars->Get("2d_coords");
bag.have_2d_coords = (!coords.IsEmpty() ? 1 : 0);
std::vector<String> tokens;
boost::algorithm::split(tokens, coords, boost::is_any_of(","));
if (tokens.size() != 2)
bag.have_2d_coords = 0;
if (bag.have_2d_coords == 1) {
bag.x_2d = tokens[0];
bag.y_2d = tokens[1];
}
} else {
bag.have_2d_coords = 0;
}
return bag;
}
String CompatUtility::GetHost2dCoordX(const Host::Ptr& host)
{
Host2dCoords bag = GetHost2dCoords(host);
if (bag.have_2d_coords == 0)
return Empty;
return bag.x_2d;
}
String CompatUtility::GetHost2dCoordY(const Host::Ptr& host)
{
Host2dCoords bag = GetHost2dCoords(host);
if (bag.have_2d_coords == 0)
return Empty;
return bag.y_2d;
}
int CompatUtility::GetHostNotifyOnDown(const Host::Ptr& host)
{
ASSERT(host->OwnsLock());
@ -371,9 +323,7 @@ int CompatUtility::GetCheckableInNotificationPeriod(const Checkable::Ptr& checka
bool CompatUtility::IsLegacyAttribute(DynamicObject::Ptr const& object, const String& name)
{
if ((name == "address" ||
name == "address6" ||
name == "statusmap_image" ||
name == "2d_coords") &&
name == "address6") &&
object->GetType() == DynamicType::GetByName("Host"))
return true;

View File

@ -31,15 +31,6 @@
namespace icinga
{
/**
* @ingroup icinga
*/
struct Host2dCoords {
int have_2d_coords;
String x_2d;
String y_2d;
};
/**
* Compatibility utility functions.
*
@ -51,9 +42,6 @@ public:
/* host */
static String GetHostAlias(const Host::Ptr& host);
static Host2dCoords GetHost2dCoords(const Host::Ptr& host);
static String GetHost2dCoordX(const Host::Ptr& host);
static String GetHost2dCoordY(const Host::Ptr& host);
static int GetHostNotifyOnDown(const Host::Ptr& host);
static int GetHostNotifyOnUnreachable(const Host::Ptr& host);