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 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 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 }