mirror of
				https://github.com/Icinga/icinga2.git
				synced 2025-11-03 21:25:56 +01:00 
			
		
		
		
	custom attr: move into DynamicObject using GetCustom()
This commit is contained in:
		
							parent
							
								
									cfb3c9cf9f
								
							
						
					
					
						commit
						36e9e9adbd
					
				@ -624,7 +624,7 @@ void CompatComponent::DumpServiceObject(std::ostream& fp, const Service::Ptr& se
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void CompatComponent::DumpCustomAttributes(std::ostream& fp, const DynamicObject::Ptr& object)
 | 
					void CompatComponent::DumpCustomAttributes(std::ostream& fp, const DynamicObject::Ptr& object)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Dictionary::Ptr custom = object->Get("custom");
 | 
						Dictionary::Ptr custom = object->GetCustom();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!custom)
 | 
						if (!custom)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
				
			|||||||
@ -56,6 +56,7 @@ DynamicObject::DynamicObject(const Dictionary::Ptr& serializedObject)
 | 
				
			|||||||
	RegisterAttribute("__local", Attribute_Config, &m_Local);
 | 
						RegisterAttribute("__local", Attribute_Config, &m_Local);
 | 
				
			||||||
	RegisterAttribute("__source", Attribute_Local, &m_Source);
 | 
						RegisterAttribute("__source", Attribute_Local, &m_Source);
 | 
				
			||||||
	RegisterAttribute("methods", Attribute_Config, &m_Methods);
 | 
						RegisterAttribute("methods", Attribute_Config, &m_Methods);
 | 
				
			||||||
 | 
						RegisterAttribute("custom", Attribute_Config, &m_Custom);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!serializedObject->Contains("configTx"))
 | 
						if (!serializedObject->Contains("configTx"))
 | 
				
			||||||
		BOOST_THROW_EXCEPTION(std::invalid_argument("Serialized object must contain a config snapshot."));
 | 
							BOOST_THROW_EXCEPTION(std::invalid_argument("Serialized object must contain a config snapshot."));
 | 
				
			||||||
@ -616,3 +617,8 @@ const DynamicObject::AttributeMap& DynamicObject::GetAttributes(void) const
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	return m_Attributes;
 | 
						return m_Attributes;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Dictionary::Ptr DynamicObject::GetCustom(void) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return m_Custom;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -101,6 +101,8 @@ public:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	static double GetCurrentTx(void);
 | 
						static double GetCurrentTx(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Dictionary::Ptr GetCustom(void) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
	explicit DynamicObject(const Dictionary::Ptr& serializedObject);
 | 
						explicit DynamicObject(const Dictionary::Ptr& serializedObject);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -125,6 +127,7 @@ private:
 | 
				
			|||||||
	Attribute<bool> m_Local;
 | 
						Attribute<bool> m_Local;
 | 
				
			||||||
	Attribute<String> m_Source;
 | 
						Attribute<String> m_Source;
 | 
				
			||||||
	Attribute<Dictionary::Ptr> m_Methods;
 | 
						Attribute<Dictionary::Ptr> m_Methods;
 | 
				
			||||||
 | 
						Attribute<Dictionary::Ptr> m_Custom;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool m_Registered;	/**< protected by the type mutex */
 | 
						bool m_Registered;	/**< protected by the type mutex */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -51,7 +51,6 @@ Host::Host(const Dictionary::Ptr& serializedUpdate)
 | 
				
			|||||||
	RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
 | 
						RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
 | 
				
			||||||
	RegisterAttribute("hostgroups", Attribute_Config, &m_HostGroups);
 | 
						RegisterAttribute("hostgroups", Attribute_Config, &m_HostGroups);
 | 
				
			||||||
	RegisterAttribute("macros", Attribute_Config, &m_Macros);
 | 
						RegisterAttribute("macros", Attribute_Config, &m_Macros);
 | 
				
			||||||
	RegisterAttribute("custom", Attribute_Config, &m_Custom);
 | 
					 | 
				
			||||||
	RegisterAttribute("hostdependencies", Attribute_Config, &m_HostDependencies);
 | 
						RegisterAttribute("hostdependencies", Attribute_Config, &m_HostDependencies);
 | 
				
			||||||
	RegisterAttribute("servicedependencies", Attribute_Config, &m_ServiceDependencies);
 | 
						RegisterAttribute("servicedependencies", Attribute_Config, &m_ServiceDependencies);
 | 
				
			||||||
	RegisterAttribute("hostcheck", Attribute_Config, &m_HostCheck);
 | 
						RegisterAttribute("hostcheck", Attribute_Config, &m_HostCheck);
 | 
				
			||||||
@ -105,11 +104,6 @@ Dictionary::Ptr Host::GetMacros(void) const
 | 
				
			|||||||
	return m_Macros;
 | 
						return m_Macros;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Dictionary::Ptr Host::GetCustom(void) const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return m_Custom;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Array::Ptr Host::GetHostDependencies(void) const
 | 
					Array::Ptr Host::GetHostDependencies(void) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return m_HostDependencies;;
 | 
						return m_HostDependencies;;
 | 
				
			||||||
 | 
				
			|||||||
@ -88,7 +88,6 @@ public:
 | 
				
			|||||||
	Array::Ptr GetGroups(void) const;
 | 
						Array::Ptr GetGroups(void) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Dictionary::Ptr GetMacros(void) const;
 | 
						Dictionary::Ptr GetMacros(void) const;
 | 
				
			||||||
	Dictionary::Ptr GetCustom(void) const;
 | 
					 | 
				
			||||||
	Array::Ptr GetHostDependencies(void) const;
 | 
						Array::Ptr GetHostDependencies(void) const;
 | 
				
			||||||
	Array::Ptr GetServiceDependencies(void) const;
 | 
						Array::Ptr GetServiceDependencies(void) const;
 | 
				
			||||||
	String GetHostCheck(void) const;
 | 
						String GetHostCheck(void) const;
 | 
				
			||||||
@ -128,7 +127,6 @@ private:
 | 
				
			|||||||
	Attribute<String> m_DisplayName;
 | 
						Attribute<String> m_DisplayName;
 | 
				
			||||||
	Attribute<Array::Ptr> m_HostGroups;
 | 
						Attribute<Array::Ptr> m_HostGroups;
 | 
				
			||||||
	Attribute<Dictionary::Ptr> m_Macros;
 | 
						Attribute<Dictionary::Ptr> m_Macros;
 | 
				
			||||||
	Attribute<Dictionary::Ptr> m_Custom;
 | 
					 | 
				
			||||||
	Attribute<Array::Ptr> m_HostDependencies;
 | 
						Attribute<Array::Ptr> m_HostDependencies;
 | 
				
			||||||
	Attribute<Array::Ptr> m_ServiceDependencies;
 | 
						Attribute<Array::Ptr> m_ServiceDependencies;
 | 
				
			||||||
	Attribute<String> m_HostCheck;
 | 
						Attribute<String> m_HostCheck;
 | 
				
			||||||
 | 
				
			|||||||
@ -44,7 +44,6 @@ Service::Service(const Dictionary::Ptr& serializedObject)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
 | 
						RegisterAttribute("display_name", Attribute_Config, &m_DisplayName);
 | 
				
			||||||
	RegisterAttribute("macros", Attribute_Config, &m_Macros);
 | 
						RegisterAttribute("macros", Attribute_Config, &m_Macros);
 | 
				
			||||||
	RegisterAttribute("custom", Attribute_Config, &m_Custom);
 | 
					 | 
				
			||||||
	RegisterAttribute("hostdependencies", Attribute_Config, &m_HostDependencies);
 | 
						RegisterAttribute("hostdependencies", Attribute_Config, &m_HostDependencies);
 | 
				
			||||||
	RegisterAttribute("servicedependencies", Attribute_Config, &m_ServiceDependencies);
 | 
						RegisterAttribute("servicedependencies", Attribute_Config, &m_ServiceDependencies);
 | 
				
			||||||
	RegisterAttribute("servicegroups", Attribute_Config, &m_ServiceGroups);
 | 
						RegisterAttribute("servicegroups", Attribute_Config, &m_ServiceGroups);
 | 
				
			||||||
@ -167,11 +166,6 @@ Dictionary::Ptr Service::GetMacros(void) const
 | 
				
			|||||||
	return m_Macros;
 | 
						return m_Macros;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Dictionary::Ptr Service::GetCustom(void) const
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return m_Custom;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Array::Ptr Service::GetHostDependencies(void) const
 | 
					Array::Ptr Service::GetHostDependencies(void) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return m_HostDependencies;
 | 
						return m_HostDependencies;
 | 
				
			||||||
 | 
				
			|||||||
@ -112,7 +112,6 @@ public:
 | 
				
			|||||||
	String GetDisplayName(void) const;
 | 
						String GetDisplayName(void) const;
 | 
				
			||||||
	Host::Ptr GetHost(void) const;
 | 
						Host::Ptr GetHost(void) const;
 | 
				
			||||||
	Dictionary::Ptr GetMacros(void) const;
 | 
						Dictionary::Ptr GetMacros(void) const;
 | 
				
			||||||
	Dictionary::Ptr GetCustom(void) const;
 | 
					 | 
				
			||||||
	Array::Ptr GetHostDependencies(void) const;
 | 
						Array::Ptr GetHostDependencies(void) const;
 | 
				
			||||||
	Array::Ptr GetServiceDependencies(void) const;
 | 
						Array::Ptr GetServiceDependencies(void) const;
 | 
				
			||||||
	Array::Ptr GetGroups(void) const;
 | 
						Array::Ptr GetGroups(void) const;
 | 
				
			||||||
@ -311,7 +310,6 @@ private:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	Attribute<String> m_DisplayName;
 | 
						Attribute<String> m_DisplayName;
 | 
				
			||||||
	Attribute<Dictionary::Ptr> m_Macros;
 | 
						Attribute<Dictionary::Ptr> m_Macros;
 | 
				
			||||||
	Attribute<Dictionary::Ptr> m_Custom;
 | 
					 | 
				
			||||||
	Attribute<Array::Ptr> m_HostDependencies;
 | 
						Attribute<Array::Ptr> m_HostDependencies;
 | 
				
			||||||
	Attribute<Array::Ptr> m_ServiceDependencies;
 | 
						Attribute<Array::Ptr> m_ServiceDependencies;
 | 
				
			||||||
	Attribute<Array::Ptr> m_ServiceGroups;
 | 
						Attribute<Array::Ptr> m_ServiceGroups;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user