From eb60f3715cf241450959e651fc18d773e684402f Mon Sep 17 00:00:00 2001 From: Mark Laing Date: Tue, 9 Jul 2024 09:07:03 +0100 Subject: [PATCH 1/3] lxd-metadata: Fix lint errors (revive: unchecked-type-assertion, var-naming). Signed-off-by: Mark Laing --- lxd/lxd-metadata/lxd_metadata.go | 33 +++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/lxd/lxd-metadata/lxd_metadata.go b/lxd/lxd-metadata/lxd_metadata.go index 6c880a301836..1ec827cd1c72 100644 --- a/lxd/lxd-metadata/lxd_metadata.go +++ b/lxd/lxd-metadata/lxd_metadata.go @@ -347,19 +347,19 @@ func parse(path string, outputJSONPath string, excludedPaths []string, substitut func writeDocFile(inputJSONPath, outputTxtPath string) error { countMaxBackTicks := func(s string) int { - count, curr_count := 0, 0 + count, currCount := 0, 0 n := len(s) for i := 0; i < n; i++ { if s[i] == '`' { - curr_count++ + currCount++ continue } - if curr_count > count { - count = curr_count + if currCount > count { + count = currCount } - curr_count = 0 + currCount = 0 } return count @@ -389,18 +389,29 @@ func writeDocFile(inputJSONPath, outputTxtPath string) error { for _, groupKey := range sortedGroupKeys { groupEntries := entityEntries[groupKey] buffer.WriteString(fmt.Sprintf("\n", entityKey, groupKey)) - for _, configEntry := range groupEntries["keys"] { - for configKey, configContent := range configEntry.(map[string]any) { + for _, configEntryAny := range groupEntries["keys"] { + configEntry, ok := configEntryAny.(map[string]any) + if !ok { + return fmt.Errorf("Unexpected config entry type (%T) in group %q", configEntryAny, groupKey) + } + + for configKey, configContentAny := range configEntry { // There is only one key-value pair in each map kvBuffer := bytes.NewBufferString("") var backticksCount int var longDescContent string - sortedConfigContentKeys := getSortedKeysFromMap(configContent.(map[string]any)) + configContent, ok := configContentAny.(map[string]any) + if !ok { + return fmt.Errorf("Unexpected config content type (%T) for key %q in group %q", configContentAny, configKey, groupKey) + } + + sortedConfigContentKeys := getSortedKeysFromMap(configContent) for _, configEntryContentKey := range sortedConfigContentKeys { - configContentValue := configContent.(map[string]any)[configEntryContentKey] + configContentValue := configContent[configEntryContentKey] if configEntryContentKey == "longdesc" { - backticksCount = countMaxBackTicks(configContentValue.(string)) - longDescContent = configContentValue.(string) + configContentString, _ := configContentValue.(string) + backticksCount = countMaxBackTicks(configContentString) + longDescContent = configContentString continue } From d3a969e0660771c3aa1389148056c60722ce706f Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 14 Jun 2024 09:11:07 +0000 Subject: [PATCH 2/3] doc: Fix exception rules for import_machines_to_instances.md Signed-off-by: Din Music --- doc/.sphinx/.markdownlint/exceptions.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/.sphinx/.markdownlint/exceptions.txt b/doc/.sphinx/.markdownlint/exceptions.txt index dff8d656e4f0..63fd175bbcc9 100644 --- a/doc/.sphinx/.markdownlint/exceptions.txt +++ b/doc/.sphinx/.markdownlint/exceptions.txt @@ -1,5 +1,5 @@ -.tmp/doc/howto/import_machines_to_instances.md:108: MD034 Bare URL used -.tmp/doc/howto/import_machines_to_instances.md:212: MD034 Bare URL used +.tmp/doc/howto/import_machines_to_instances.md:103: MD034 Bare URL used +.tmp/doc/howto/import_machines_to_instances.md:207: MD034 Bare URL used .tmp/doc/howto/network_forwards.md:66: MD004 Unordered list style .tmp/doc/howto/network_forwards.md:71: MD004 Unordered list style .tmp/doc/howto/network_forwards.md:67: MD005 Inconsistent indentation for list items at the same level From 831e26253dfc9f0ca458fe77dd93e0a2a515476e Mon Sep 17 00:00:00 2001 From: Ruth Fuchss Date: Mon, 22 Jul 2024 12:59:34 +0200 Subject: [PATCH 3/3] doc/projects: fix documentation for PATCH request The functionality was fixed in https://github.com/canonical/lxd/pull/13786 Signed-off-by: Ruth Fuchss --- doc/howto/projects_create.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/doc/howto/projects_create.md b/doc/howto/projects_create.md index ccf58bad727d..ca744b3b0308 100644 --- a/doc/howto/projects_create.md +++ b/doc/howto/projects_create.md @@ -125,16 +125,10 @@ For example, to limit the number of containers that can be created in `my-projec lxc query --request PATCH /1.0/projects/my-project --data '{ "config": { - "limits.containers": "5", - ... + "limits.containers": "5" } }' -```{note} -The PATCH request updates the full content of the `config` field. -Therefore, you must specify all configuration options as part of the PATCH request, and not only the option that you want to change. -``` - See [`PATCH /1.0/projects/{name}`](swagger:/projects/project_patch) for more information. ```` ````{group-tab} UI