Skip to content

Commit

Permalink
Backports (stable-5.21) (#13804)
Browse files Browse the repository at this point in the history
A few more backports to fix doc build issues.
  • Loading branch information
tomponline authored Jul 23, 2024
2 parents e0d8071 + 831e262 commit 3d6237d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
4 changes: 2 additions & 2 deletions doc/.sphinx/.markdownlint/exceptions.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 1 addition & 7 deletions doc/howto/projects_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 22 additions & 11 deletions lxd/lxd-metadata/lxd_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -389,18 +389,29 @@ func writeDocFile(inputJSONPath, outputTxtPath string) error {
for _, groupKey := range sortedGroupKeys {
groupEntries := entityEntries[groupKey]
buffer.WriteString(fmt.Sprintf("<!-- config group %s-%s start -->\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
}

Expand Down

0 comments on commit 3d6237d

Please sign in to comment.