(targetNode *yaml.Node)
| 197 | } |
| 198 | |
| 199 | func ensureSampleOptions(targetNode *yaml.Node) bool { |
| 200 | optionsVal, modified := targetNode.EnsureKey( |
| 201 | "options", |
| 202 | yaml.NewMappingNode(), |
| 203 | nil, |
| 204 | ) |
| 205 | |
| 206 | // Ensure all our options are on the options struct. |
| 207 | for _, opt := range sampleOptions { |
| 208 | _, added := optionsVal.EnsureKey( |
| 209 | opt.Name, |
| 210 | yaml.NewScalarNode(opt.Value, opt.Tag), |
| 211 | &yaml.EnsureOptions{Comment: opt.Comment}, |
| 212 | ) |
| 213 | |
| 214 | modified = modified || added |
| 215 | } |
| 216 | |
| 217 | return modified |
| 218 | } |
| 219 | |
| 220 | func ensureAdminUser(data []byte, username, pubKey string) ([]byte, error) { |
| 221 | rootNode, modified, err := ensureAdminUserYaml(data, username, pubKey) |
no test coverage detected