solver/dnf4: structured data
Instead of returning the string contents of the module configuration file let's return some more structured data so the resulting file can be written with a stage. Note that we don't do the same for the fallback file as we are only provided this as a YAML blob and unparsing it to then immediately reparse it again is counterproductive. Signed-off-by: Simon de Vlieger <supakeen@redhat.com>
This commit is contained in:
parent
b616da69f3
commit
4337cd9595
1 changed files with 6 additions and 10 deletions
|
|
@ -5,7 +5,6 @@ import itertools
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import tempfile
|
import tempfile
|
||||||
import textwrap
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
|
|
@ -403,18 +402,15 @@ class DNF(SolverBase):
|
||||||
# repository is disabled or disappears that non-modular content can't be installed
|
# repository is disabled or disappears that non-modular content can't be installed
|
||||||
# see: https://dnf.readthedocs.io/en/latest/modularity.html#fail-safe-mechanisms
|
# see: https://dnf.readthedocs.io/en/latest/modularity.html#fail-safe-mechanisms
|
||||||
for module_ns, (module, profiles) in modules.items():
|
for module_ns, (module, profiles) in modules.items():
|
||||||
profiles = ",".join(profiles) if profiles else ""
|
|
||||||
|
|
||||||
response["modules"][module.getName()] = {
|
response["modules"][module.getName()] = {
|
||||||
"module-file": {
|
"module-file": {
|
||||||
"data": textwrap.dedent(f"""\
|
|
||||||
[{module.getName()}]
|
|
||||||
name={module.getName()}
|
|
||||||
stream={module.getStream()}
|
|
||||||
profiles={profiles}
|
|
||||||
state=enabled
|
|
||||||
"""),
|
|
||||||
"path": f"/etc/dnf/modules.d/{module.getName()}.conf",
|
"path": f"/etc/dnf/modules.d/{module.getName()}.conf",
|
||||||
|
"data": {
|
||||||
|
"name": module.getName(),
|
||||||
|
"stream": module.getStream(),
|
||||||
|
"profiles": list(profiles),
|
||||||
|
"state": "enabled",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"failsafe-file": {
|
"failsafe-file": {
|
||||||
"data": module.getYaml(),
|
"data": module.getYaml(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue