mirror of https://github.com/Icinga/icinga2.git
parent
1076bd1a06
commit
1ee26ac89e
|
@ -246,6 +246,12 @@ Downtime::Ptr Downtime::AddDowntime(const Checkable::Ptr& checkable, const Strin
|
|||
if (localZone) {
|
||||
attrs->Set("authoritative_zone", localZone->GetName());
|
||||
}
|
||||
|
||||
auto sd (ScheduledDowntime::GetByName(scheduledDowntime));
|
||||
|
||||
if (sd) {
|
||||
attrs->Set("config_owner_hash", sd->HashDowntimeOptions());
|
||||
}
|
||||
}
|
||||
|
||||
Host::Ptr host;
|
||||
|
|
|
@ -69,6 +69,7 @@ class Downtime : ConfigObject < DowntimeNameComposer
|
|||
[state] int legacy_id;
|
||||
[state] bool was_cancelled;
|
||||
[config] String config_owner;
|
||||
[config] String config_owner_hash;
|
||||
[config] String authoritative_zone;
|
||||
|
||||
[no_user_view, no_user_modify] String removed_by;
|
||||
|
|
|
@ -6,13 +6,17 @@
|
|||
#include "icinga/downtime.hpp"
|
||||
#include "icinga/service.hpp"
|
||||
#include "base/timer.hpp"
|
||||
#include "base/tlsutility.hpp"
|
||||
#include "base/configtype.hpp"
|
||||
#include "base/utility.hpp"
|
||||
#include "base/objectlock.hpp"
|
||||
#include "base/object-packer.hpp"
|
||||
#include "base/serializer.hpp"
|
||||
#include "base/convert.hpp"
|
||||
#include "base/logger.hpp"
|
||||
#include "base/exception.hpp"
|
||||
#include <boost/thread/once.hpp>
|
||||
#include <set>
|
||||
|
||||
using namespace icinga;
|
||||
|
||||
|
@ -333,6 +337,22 @@ void ScheduledDowntime::ValidateChildOptions(const Lazy<Value>& lvalue, const Va
|
|||
}
|
||||
}
|
||||
|
||||
static const std::set<String> l_SDDowntimeOptions ({
|
||||
"author", "child_options", "comment", "duration", "fixed", "ranges", "vars"
|
||||
});
|
||||
|
||||
String ScheduledDowntime::HashDowntimeOptions()
|
||||
{
|
||||
Dictionary::Ptr allOpts = Serialize(this, FAConfig);
|
||||
Dictionary::Ptr opts = new Dictionary();
|
||||
|
||||
for (auto& opt : l_SDDowntimeOptions) {
|
||||
opts->Set(opt, allOpts->Get(opt));
|
||||
}
|
||||
|
||||
return SHA256(PackObject(opts));
|
||||
}
|
||||
|
||||
bool ScheduledDowntime::AllConfigIsLoaded()
|
||||
{
|
||||
return m_AllConfigLoaded.load();
|
||||
|
|
|
@ -35,6 +35,7 @@ public:
|
|||
|
||||
void ValidateRanges(const Lazy<Dictionary::Ptr>& lvalue, const ValidationUtils& utils) override;
|
||||
void ValidateChildOptions(const Lazy<Value>& lvalue, const ValidationUtils& utils) override;
|
||||
String HashDowntimeOptions();
|
||||
|
||||
protected:
|
||||
void OnAllConfigLoaded() override;
|
||||
|
|
Loading…
Reference in New Issue