diff --git a/html/index.html b/html/index.html index dd070bd2..57b531b8 100644 --- a/html/index.html +++ b/html/index.html @@ -4642,7 +4642,6 @@

{{i18n.options}} - {{ i18n.settingsSynchronize }} diff --git a/html/js/i18n.js b/html/js/i18n.js index 8208bc65..013f1a94 100644 --- a/html/js/i18n.js +++ b/html/js/i18n.js @@ -196,7 +196,6 @@ const i18n = { completed: 'Completed', config: 'Configuration', configAdvancedTag: 'adv', - configExtendedTag: 'ext', configTitle: 'Grid Configuration', configQLGridTitle: 'Grid Administration Quick Links', configQLElasticsearchCold: 'Cold Phase', @@ -773,10 +772,8 @@ const i18n = { settingHideDefault: 'Hide Default', settingValidationFailed: 'The specified value is not valid.', settings: 'Settings', - settingsAdvanced: 'Show all configurable settings, including advanced settings.', + settingsAdvanced: 'Show advanced settings. Screen refresh will take significantly longer.', settingsAdvancedHelp: 'CAUTION! Changing advanced settings is unsupported and could result in requiring a full cluster re-installation.', - settingsExtended: 'Show extended settings, including index settings.', - settingsExtendedHelp: 'Including the extended settings will cause the configuration screen to take longer to load. These are customized less often, and therefore excluded by default.', settingsInvalid: 'Unable to save settings: ', settingsCustomized: 'Modified: ', settingsTitle: 'User Settings', diff --git a/html/js/routes/config.js b/html/js/routes/config.js index 0f4f2b38..8a1a2a79 100644 --- a/html/js/routes/config.js +++ b/html/js/routes/config.js @@ -43,7 +43,6 @@ routes.push({ path: '/config', name: 'config', component: { resetNodeId: null, confirmResetDialog: false, treeVisible: true, - extended: false, }}, mounted() { this.processRouteParameters(); @@ -51,8 +50,7 @@ routes.push({ path: '/config', name: 'config', component: { }, watch: { "active": "selectSetting", - "advanced": "refreshTree", - "extended": "loadData", + "advanced": "loadData", }, computed: { selected() { @@ -69,9 +67,6 @@ routes.push({ path: '/config', name: 'config', component: { if (this.$route.query.a == "1") { this.advanced = true; } - if (this.$route.query.x == "1") { - this.extended = true; - } if (this.$route.query.f) { this.search = this.$route.query.f; } @@ -156,10 +151,8 @@ routes.push({ path: '/config', name: 'config', component: { settings.forEach((setting) => { try { path = setting.id.split("."); - if ((setting.description && !setting.advanced) || this.advanced) { - this.addToNode(root, "", path, setting); - this.settingsAvailable++; - } + this.addToNode(root, "", path, setting); + this.settingsAvailable++; } catch(e) { route.$root.showError(route.i18n.settingMalformed + " (" + setting.id + "): " + e); } @@ -255,7 +248,7 @@ routes.push({ path: '/config', name: 'config', component: { var response = await this.$root.papi.get('gridmembers/'); this.nodes = response.data; - response = await this.$root.papi.get('config/', {params: { extended: this.extended }}); + response = await this.$root.papi.get('config/', {params: { advanced: this.advanced }}); this.settings = []; response.data.forEach((setting) => { const existing = this.settings.find(s => s.id == setting.id); @@ -313,9 +306,6 @@ routes.push({ path: '/config', name: 'config', component: { if (setting.advanced) { modifiers.push(this.i18n.configAdvancedTag); } - if (setting.extended) { - modifiers.push(this.i18n.configExtendedTag); - } if (modifiers.length > 0) { breadcrumbs = breadcrumbs + " [" + modifiers.join(", ") + "]"; } diff --git a/html/js/routes/config.test.js b/html/js/routes/config.test.js index 3f9710fa..7ecbafff 100644 --- a/html/js/routes/config.test.js +++ b/html/js/routes/config.test.js @@ -41,7 +41,7 @@ test('loadData', async () => { comp.settings = []; await comp.loadData(); expect(loadmock).toHaveBeenCalledWith('gridmembers/'); - expect(mock).toHaveBeenCalledWith('config/', {params: { extended: false }}); + expect(mock).toHaveBeenCalledWith('config/', {params: { advanced: false }}); expect(comp.nodes).toBe(loaddata); @@ -686,19 +686,13 @@ test('processRouteParameters', () => { }); test('getSettingBreadcrumbs', () => { - setting = { id: "foo.bar.car", advanced: false, extended: false }; + setting = { id: "foo.bar.car", advanced: false }; expect(comp.getSettingBreadcrumbs(setting)).toBe("foo > bar > car"); - setting = { id: "foo.bar.car", advanced: false, extended: false, title: "Carbine" }; + setting = { id: "foo.bar.car", advanced: false, title: "Carbine" }; expect(comp.getSettingBreadcrumbs(setting)).toBe("foo > bar > Carbine"); - setting = { id: "foo.bar.car", advanced: false, extended: true }; - expect(comp.getSettingBreadcrumbs(setting)).toBe("foo > bar > car [ext]"); - - setting = { id: "foo.bar.car", advanced: true, extended: false }; + setting = { id: "foo.bar.car", advanced: true }; expect(comp.getSettingBreadcrumbs(setting)).toBe("foo > bar > car [adv]"); - var setting = { id: "foo.bar.car", advanced: true, extended: true }; - expect(comp.getSettingBreadcrumbs(setting)).toBe("foo > bar > car [adv, ext]"); - }); \ No newline at end of file diff --git a/model/config.go b/model/config.go index 09237b18..1908a3ec 100644 --- a/model/config.go +++ b/model/config.go @@ -8,7 +8,6 @@ package model import ( "regexp" - "strings" ) type Setting struct { @@ -33,7 +32,6 @@ type Setting struct { Syntax string `json:"syntax"` ForcedType string `json:"forcedType"` Duplicates bool `json:"duplicates"` - Extended bool `json:"extended"` } func NewSetting(id string) *Setting { @@ -44,16 +42,6 @@ func NewSetting(id string) *Setting { func (setting *Setting) SetId(id string) { setting.Id = id - setting.Extended = IsExtendedSetting(setting) -} - -func IsExtendedSetting(setting *Setting) bool { - extended := false - extended = extended || strings.HasPrefix(setting.Id, "elasticsearch.index_settings.") - extended = extended || strings.HasPrefix(setting.Id, "docker.containers.") - extended = extended || strings.HasPrefix(setting.Id, "firewall.role.") - extended = extended || strings.HasPrefix(setting.Id, "strelka.backend.") - return extended } func IsValidMinionId(id string) bool { diff --git a/model/config_test.go b/model/config_test.go index b9d8437f..8c67da2d 100644 --- a/model/config_test.go +++ b/model/config_test.go @@ -15,15 +15,7 @@ import ( func TestStringId(tester *testing.T) { setting := NewSetting("MyId") assert.Equal(tester, "MyId", setting.Id) - assert.False(tester, setting.Extended) -} - -func TestExtendedSetting(tester *testing.T) { - assert.True(tester, NewSetting("elasticsearch.index_settings.foo").Extended) - assert.True(tester, NewSetting("docker.containers.foo").Extended) - assert.True(tester, NewSetting("firewall.role.foo").Extended) - assert.True(tester, NewSetting("strelka.backend.foo").Extended) - assert.False(tester, NewSetting("something.else.foo").Extended) + assert.False(tester, setting.Advanced) } func TestIsValidMinionId(tester *testing.T) { diff --git a/server/confighandler.go b/server/confighandler.go index bd6e4d1a..5a7a392f 100644 --- a/server/confighandler.go +++ b/server/confighandler.go @@ -57,11 +57,11 @@ func (h *ConfigHandler) configEnabled(next http.Handler) http.Handler { func (h *ConfigHandler) getConfig(w http.ResponseWriter, r *http.Request) { ctx := r.Context() - extended, err := strconv.ParseBool(r.URL.Query().Get("extended")) + advanced, err := strconv.ParseBool(r.URL.Query().Get("advanced")) if err != nil { - extended = false + advanced = false } - settings, err := h.server.Configstore.GetSettings(ctx, extended) + settings, err := h.server.Configstore.GetSettings(ctx, advanced) if err != nil { web.Respond(w, r, http.StatusBadRequest, err) return diff --git a/server/configstore.go b/server/configstore.go index 6ed8a3dd..d1b8d3d8 100644 --- a/server/configstore.go +++ b/server/configstore.go @@ -13,7 +13,7 @@ import ( ) type Configstore interface { - GetSettings(ctx context.Context, extended bool) ([]*model.Setting, error) + GetSettings(ctx context.Context, advanced bool) ([]*model.Setting, error) UpdateSetting(ctx context.Context, setting *model.Setting, remove bool) error SyncSettings(ctx context.Context) error } diff --git a/server/memconfigstore.go b/server/memconfigstore.go index cee0db8c..e6f62400 100644 --- a/server/memconfigstore.go +++ b/server/memconfigstore.go @@ -22,7 +22,7 @@ func NewMemConfigStore(settings []*model.Setting) *MemConfigStore { } } -func (m *MemConfigStore) GetSettings(ctx context.Context, extended bool) ([]*model.Setting, error) { +func (m *MemConfigStore) GetSettings(ctx context.Context, advanced bool) ([]*model.Setting, error) { return m.settings, nil } diff --git a/server/memconfigstore_test.go b/server/memconfigstore_test.go index 5ddbf40c..6a65a621 100644 --- a/server/memconfigstore_test.go +++ b/server/memconfigstore_test.go @@ -26,7 +26,7 @@ func TestMemConfigStoreNew(t *testing.T) { ctx := context.Background() - set, err := mCfgStore.GetSettings(ctx, false) + set, err := mCfgStore.GetSettings(ctx, true) assert.NoError(t, err) assert.Same(t, &origSettings[0], &set[0]) } @@ -44,7 +44,7 @@ func TestMemConfigStoreUpdate(t *testing.T) { err := mCfgStore.UpdateSetting(ctx, &model.Setting{Id: "1", Value: "new"}, false) assert.NoError(t, err) - set, err := mCfgStore.GetSettings(ctx, false) + set, err := mCfgStore.GetSettings(ctx, true) assert.NoError(t, err) assert.Len(t, set, 3) @@ -68,7 +68,7 @@ func TestMemConfigStoreUpdateAdd(t *testing.T) { err := mCfgStore.UpdateSetting(ctx, &model.Setting{Id: "4", Value: "four"}, false) assert.NoError(t, err) - set, err := mCfgStore.GetSettings(ctx, false) + set, err := mCfgStore.GetSettings(ctx, true) assert.NoError(t, err) assert.Len(t, set, 4) @@ -92,14 +92,14 @@ func TestMemConfigStoreUpdateRemove(t *testing.T) { err := mCfgStore.UpdateSetting(ctx, &model.Setting{Id: "4"}, true) assert.NoError(t, err) - set, err := mCfgStore.GetSettings(ctx, false) + set, err := mCfgStore.GetSettings(ctx, true) assert.NoError(t, err) assert.Len(t, set, 3) err = mCfgStore.UpdateSetting(ctx, &model.Setting{Id: "2"}, true) assert.NoError(t, err) - set, err = mCfgStore.GetSettings(ctx, false) + set, err = mCfgStore.GetSettings(ctx, true) assert.NoError(t, err) assert.Len(t, set, 2) diff --git a/server/modules/salt/saltstore.go b/server/modules/salt/saltstore.go index e59d14ad..7d91f9a5 100644 --- a/server/modules/salt/saltstore.go +++ b/server/modules/salt/saltstore.go @@ -131,7 +131,7 @@ func (store *Saltstore) GetSetting(settings []*model.Setting, id string) *model. return nil } -func (store *Saltstore) GetSettings(ctx context.Context, extended bool) ([]*model.Setting, error) { +func (store *Saltstore) GetSettings(ctx context.Context, advanced bool) ([]*model.Setting, error) { var err error if err = store.server.CheckAuthorized(ctx, "read", "config"); err != nil { return nil, err @@ -227,16 +227,28 @@ func (store *Saltstore) GetSettings(ctx context.Context, extended bool) ([]*mode }) } - return store.sortSettings(store.filterExtended(settings, extended)), err + store.markAdvanced(settings) + + return store.sortSettings(store.filter(settings, advanced)), err } -func (store *Saltstore) filterExtended(settings []*model.Setting, extended bool) []*model.Setting { - if !extended { - settings = slices.DeleteFunc(settings, func(setting *model.Setting) bool { - return setting.Extended - }) +func (store *Saltstore) markAdvanced(settings []*model.Setting) { + // Mark all settings missing descriptions as advanced + for _, setting := range settings { + if len(setting.Description) == 0 { + setting.Advanced = true + } } - return settings +} + +func (store *Saltstore) filter(settings []*model.Setting, advanced bool) []*model.Setting { + if advanced { + // No need to filter anything, caller wants everything + return settings + } + return slices.DeleteFunc(settings, func(setting *model.Setting) bool { + return setting.Advanced + }) } func (store *Saltstore) sortSettings(settings []*model.Setting) []*model.Setting { @@ -634,7 +646,9 @@ func (store *Saltstore) UpdateSetting(ctx context.Context, setting *model.Settin return errors.New("Invalid setting id: " + setting.Id) } - settings, err := store.GetSettings(ctx, model.IsExtendedSetting(setting)) + // always pull advanced settings on update since incoming setting may not be properly flagged as advanced + advanced := true + settings, err := store.GetSettings(ctx, advanced) if err != nil { return err } else { diff --git a/server/modules/salt/saltstore_test.go b/server/modules/salt/saltstore_test.go index f2b1f9bb..fab64874 100644 --- a/server/modules/salt/saltstore_test.go +++ b/server/modules/salt/saltstore_test.go @@ -191,7 +191,7 @@ func TestManageMember_Failure(tester *testing.T) { func TestGetSettings_BadSaltstackPath(tester *testing.T) { srv := server.NewFakeAuthorizedServer(nil) salt := NewSaltstore(srv) - _, err := salt.GetSettings(ctx(), false) + _, err := salt.GetSettings(ctx(), true) assert.EqualError(tester, err, "lstat /default: no such file or directory") } @@ -199,7 +199,7 @@ func TestGetSettings(tester *testing.T) { defer Cleanup() salt := NewTestSalt() - settings, err := salt.GetSettings(ctx(), false) + settings, err := salt.GetSettings(ctx(), true) assert.NoError(tester, err) count := 0 @@ -373,7 +373,7 @@ func TestUpdateSetting_OverrideDefault(tester *testing.T) { assert.NoError(tester, err) // Ensure there's an additional setting listed - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) new_setting := findSetting(settings, "myapp.my_def", "") @@ -391,7 +391,7 @@ func TestUpdateSetting_AddGlobal(tester *testing.T) { assert.NoError(tester, err) // Ensure there's an additional setting listed - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) assert.Equal(tester, TEST_SETTINGS_COUNT+1, len(settings)) @@ -414,7 +414,7 @@ func TestUpdateSetting_AddToNode(tester *testing.T) { assert.NoError(tester, err) // Ensure there's an additional setting listed - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) assert.Equal(tester, TEST_SETTINGS_COUNT+1, len(settings)) @@ -436,7 +436,7 @@ func TestUpdateSetting_DeleteGlobal(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, true) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) assert.Equal(tester, TEST_SETTINGS_COUNT-1, len(settings)) delete_setting := findSetting(settings, "myapp.str", "") @@ -453,7 +453,7 @@ func TestUpdateSetting_DeleteFromNode(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, true) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) assert.Equal(tester, TEST_SETTINGS_COUNT-1, len(settings)) delete_setting := findSetting(settings, "myapp.foo", "normal_import") @@ -469,7 +469,7 @@ func TestUpdateSetting_DeleteAdvanced(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, true) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) assert.Equal(tester, TEST_SETTINGS_COUNT, len(settings)) deleted_setting := findSetting(settings, "myapp.advanced", "") @@ -487,7 +487,7 @@ func TestUpdateSetting_UpdateGlobal(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) assert.Equal(tester, TEST_SETTINGS_COUNT, len(settings)) updated_setting := findSetting(settings, "myapp.str", "") @@ -506,7 +506,7 @@ func TestUpdateSetting_UpdateForNode(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.foo", "normal_import") assert.Equal(tester, "new value", updated_setting.Value) @@ -523,7 +523,7 @@ func TestUpdateSetting_UpdateAdvanced(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.advanced", "") assert.Equal(tester, "something: new", updated_setting.Value) @@ -541,7 +541,7 @@ func TestUpdateSetting_UpdateFile(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.foo__txt", "") assert.Equal(tester, "anything", updated_setting.Default) @@ -551,7 +551,7 @@ func TestUpdateSetting_UpdateFile(tester *testing.T) { err = salt.UpdateSetting(ctx(), setting, true) assert.NoError(tester, err) - settings, get_err = salt.GetSettings(ctx(), false) + settings, get_err = salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting = findSetting(settings, "myapp.foo__txt", "") assert.Equal(tester, "anything", updated_setting.Default) @@ -582,7 +582,7 @@ func TestUpdateSetting_AlignIntType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.int", "") assert.Equal(tester, "44", updated_setting.Value) @@ -609,7 +609,7 @@ func TestUpdateSetting_AlignIntListType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.lists.list_int", "") assert.Equal(tester, "44\n2\n1\n", updated_setting.Value) @@ -642,7 +642,7 @@ func TestUpdateSetting_AlignEmptyListIntType(tester *testing.T) { err = salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.empty_lists.list_int", "") assert.Equal(tester, "123\n456\n23\n", updated_setting.Value) @@ -664,7 +664,7 @@ func TestUpdateSetting_ForceIntType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.int_nodefault", "") assert.Equal(tester, "44", updated_setting.Value) @@ -680,7 +680,7 @@ func TestUpdateSetting_ForceListIntType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.int_list_nodefault", "") assert.Equal(tester, "44\n55\n", updated_setting.Value) @@ -698,7 +698,7 @@ func TestUpdateSetting_AlignFloatType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.float", "") assert.Equal(tester, "44.2", updated_setting.Value) @@ -725,7 +725,7 @@ func TestUpdateSetting_AlignFloatListType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.lists.list_float", "") assert.Equal(tester, "44.3\n2.1\n1.2\n", updated_setting.Value) @@ -758,7 +758,7 @@ func TestUpdateSetting_AlignEmptyListFloatType(tester *testing.T) { err = salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.empty_lists.list_float", "") assert.Equal(tester, "1.23\n4.56\n2.3\n", updated_setting.Value) @@ -782,7 +782,7 @@ func TestUpdateSetting_AlignBoolType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.bool", "") assert.Equal(tester, "false", updated_setting.Value) @@ -809,7 +809,7 @@ func TestUpdateSetting_AlignBoolListType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.lists.list_bool", "") assert.Equal(tester, "true\nfalse\ntrue\n", updated_setting.Value) @@ -842,7 +842,7 @@ func TestUpdateSetting_AlignEmptyListBoolType(tester *testing.T) { err = salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.empty_lists.list_bool", "") assert.Equal(tester, "true\ntrue\nfalse\n", updated_setting.Value) @@ -867,7 +867,7 @@ func TestUpdateSetting_AlignListListType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.lists.list_list_str", "") assert.Equal(tester, expected, updated_setting.Value) @@ -901,7 +901,7 @@ func TestUpdateSetting_AlignEmptyListListType(tester *testing.T) { err = salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.empty_lists.list_list_str", "") assert.Equal(tester, expected, updated_setting.Value) @@ -926,7 +926,7 @@ func TestUpdateSetting_AlignMapListType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.lists.list_map_str", "") assert.Equal(tester, expected, updated_setting.Value) @@ -960,7 +960,7 @@ func TestUpdateSetting_AlignEmptyListMapType(tester *testing.T) { err = salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.empty_lists.list_map_str", "") assert.Equal(tester, expected, updated_setting.Value) @@ -984,7 +984,7 @@ func TestUpdateSetting_AlignNonStringType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.str", "") assert.Equal(tester, "123", updated_setting.Value) @@ -1000,7 +1000,7 @@ func TestUpdateSetting_AlignNonStringListType(tester *testing.T) { err := salt.UpdateSetting(ctx(), setting, false) assert.NoError(tester, err) - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.lists.list_str", "") assert.Equal(tester, "123\n456\n", updated_setting.Value) @@ -1011,7 +1011,7 @@ func TestUpdateSetting_AlignBlankStringListType(tester *testing.T) { salt := NewTestSalt() // default should be an empty list - settings, get_err := salt.GetSettings(ctx(), false) + settings, get_err := salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting := findSetting(settings, "myapp.empty_lists.list_str", "") assert.Equal(tester, "", updated_setting.Value) @@ -1023,7 +1023,7 @@ func TestUpdateSetting_AlignBlankStringListType(tester *testing.T) { assert.NoError(tester, err) // should now contain non-blank value - settings, get_err = salt.GetSettings(ctx(), false) + settings, get_err = salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting = findSetting(settings, "myapp.empty_lists.list_str", "") assert.Equal(tester, "foo\n", updated_setting.Value) @@ -1035,7 +1035,7 @@ func TestUpdateSetting_AlignBlankStringListType(tester *testing.T) { assert.NoError(tester, err) // should be an empty list again - settings, get_err = salt.GetSettings(ctx(), false) + settings, get_err = salt.GetSettings(ctx(), true) assert.NoError(tester, get_err) updated_setting = findSetting(settings, "myapp.empty_lists.list_str", "") assert.Equal(tester, "", updated_setting.Value) diff --git a/server/modules/suricata/suricata.go b/server/modules/suricata/suricata.go index f4bac1d5..23eb4fb4 100644 --- a/server/modules/suricata/suricata.go +++ b/server/modules/suricata/suricata.go @@ -371,7 +371,7 @@ func (e *SuricataEngine) Sync(logger *log.Entry, forceSync bool) error { } } - allSettings, err := e.srv.Configstore.GetSettings(e.srv.Context, false) + allSettings, err := e.srv.Configstore.GetSettings(e.srv.Context, true) if err != nil { if e.notify { e.srv.Host.Broadcast("detection-sync", "detections", server.SyncStatus{ @@ -728,7 +728,7 @@ func (e *SuricataEngine) SyncLocalDetections(ctx context.Context, detects []*mod } }() - allSettings, err := e.srv.Configstore.GetSettings(ctx, false) + allSettings, err := e.srv.Configstore.GetSettings(ctx, true) if err != nil { return nil, err } @@ -1755,7 +1755,7 @@ func (e *SuricataEngine) IntegrityCheck(canInterrupt bool, logger *log.Entry) (d logger = logger.WithField("intCheckId", uuid.New().String()) - allSettings, err := e.srv.Configstore.GetSettings(e.srv.Context, false) + allSettings, err := e.srv.Configstore.GetSettings(e.srv.Context, true) if err != nil { return nil, nil, err } diff --git a/server/modules/suricata/suricata_test.go b/server/modules/suricata/suricata_test.go index 9e2b030c..6582f6e5 100644 --- a/server/modules/suricata/suricata_test.go +++ b/server/modules/suricata/suricata_test.go @@ -878,7 +878,7 @@ func TestSyncLocalSuricata(t *testing.T) { assert.Equal(t, test.ExpectedErr, err) assert.Equal(t, test.ExpectedErrMap, errMap) - set, err := mCfgStore.GetSettings(ctx, false) + set, err := mCfgStore.GetSettings(ctx, true) assert.NoError(t, err, "GetSettings should not return an error") for id, expectedValue := range test.ExpectedSettings { @@ -1107,7 +1107,7 @@ func TestSyncCommunitySuricata(t *testing.T) { assert.NotEmpty(t, det.Id) } - set, err := mCfgStore.GetSettings(ctx, false) + set, err := mCfgStore.GetSettings(ctx, true) assert.NoError(t, err, "GetSettings should not return an error") for id, expectedValue := range test.ExpectedSettings { @@ -2333,7 +2333,7 @@ func TestSyncChanges(t *testing.T) { assert.False(t, eng.EngineState.SyncFailure) assert.True(t, migrationChecked) - allSettings, err := cfgStore.GetSettings(ctx, false) + allSettings, err := cfgStore.GetSettings(ctx, true) assert.NoError(t, err) enabled := settingByID(allSettings, "idstools.sids.enabled")