issue new verdict on configuration change
This commit is contained in:
@@ -91,6 +91,7 @@ func startProfileUpdateChecker() error {
|
||||
if err == nil {
|
||||
newProfile.layeredProfile.Update()
|
||||
}
|
||||
module.TriggerEvent(profileConfigChange, nil)
|
||||
}
|
||||
|
||||
// Always increase the revision counter of the layer profile.
|
||||
@@ -104,6 +105,7 @@ func startProfileUpdateChecker() error {
|
||||
receivedProfile, err := EnsureProfile(r)
|
||||
if err != nil || !receivedProfile.savedInternally {
|
||||
activeProfile.outdated.Set()
|
||||
module.TriggerEvent(profileConfigChange, nil)
|
||||
}
|
||||
case <-ctx.Done():
|
||||
return nil
|
||||
|
||||
@@ -16,8 +16,13 @@ var (
|
||||
updatesPath string
|
||||
)
|
||||
|
||||
const (
|
||||
profileConfigChange = "profile config change"
|
||||
)
|
||||
|
||||
func init() {
|
||||
module = modules.Register("profiles", prep, start, nil, "base", "updates")
|
||||
module.RegisterEvent(profileConfigChange, true)
|
||||
}
|
||||
|
||||
func prep() error {
|
||||
|
||||
@@ -322,15 +322,15 @@ func (profile *Profile) GetServiceEndpoints() endpoints.Endpoints {
|
||||
|
||||
// AddEndpoint adds an endpoint to the endpoint list, saves the profile and reloads the configuration.
|
||||
func (profile *Profile) AddEndpoint(newEntry string) {
|
||||
profile.addEndpointyEntry(CfgOptionEndpointsKey, newEntry)
|
||||
profile.addEndpointEntry(CfgOptionEndpointsKey, newEntry)
|
||||
}
|
||||
|
||||
// AddServiceEndpoint adds a service endpoint to the endpoint list, saves the profile and reloads the configuration.
|
||||
func (profile *Profile) AddServiceEndpoint(newEntry string) {
|
||||
profile.addEndpointyEntry(CfgOptionServiceEndpointsKey, newEntry)
|
||||
profile.addEndpointEntry(CfgOptionServiceEndpointsKey, newEntry)
|
||||
}
|
||||
|
||||
func (profile *Profile) addEndpointyEntry(cfgKey, newEntry string) {
|
||||
func (profile *Profile) addEndpointEntry(cfgKey, newEntry string) {
|
||||
changed := false
|
||||
|
||||
// When finished, save the profile.
|
||||
@@ -365,7 +365,7 @@ func (profile *Profile) addEndpointyEntry(cfgKey, newEntry string) {
|
||||
|
||||
if entry == newEntry {
|
||||
// An identical entry is already in the list, abort.
|
||||
log.Debugf("profile: ingoring new endpoint rule for %s, as identical is already present: %s", profile, newEntry)
|
||||
log.Debugf("profile: ignoring new endpoint rule for %s, as identical is already present: %s", profile, newEntry)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user