file_util generate_config -> generate_config_yaml
The two usages of generate_config were both for yaml, so make that simpler.
This commit is contained in:
parent
b7349241a9
commit
f4a9836143
|
@ -21,9 +21,7 @@ import tempfile
|
|||
|
||||
from curtin.config import merge_config
|
||||
|
||||
import yaml
|
||||
|
||||
from subiquitycore.file_util import write_file, generate_config
|
||||
from subiquitycore.file_util import write_file, generate_config_yaml
|
||||
from subiquitycore.lsb_release import lsb_release
|
||||
from subiquitycore.utils import arun_command
|
||||
|
||||
|
@ -179,7 +177,7 @@ class AptConfigurer:
|
|||
|
||||
config_location = os.path.join(
|
||||
self.app.root, 'var/log/installer/subiquity-curtin-apt.conf')
|
||||
generate_config(config_location, yaml.dump(self.apt_config()))
|
||||
generate_config_yaml(config_location, self.apt_config())
|
||||
self.app.note_data_for_apport("CurtinAptConfig", config_location)
|
||||
|
||||
await run_curtin_command(
|
||||
|
|
|
@ -29,7 +29,7 @@ from subiquitycore.async_helpers import (
|
|||
run_in_thread,
|
||||
)
|
||||
from subiquitycore.context import with_context
|
||||
from subiquitycore.file_util import write_file, generate_config
|
||||
from subiquitycore.file_util import write_file, generate_config_yaml
|
||||
|
||||
from subiquity.common.errorreport import ErrorReportKind
|
||||
from subiquity.common.types import (
|
||||
|
@ -106,7 +106,7 @@ class InstallController(SubiquityController):
|
|||
log_location = self.app.opts.output_base + INSTALL_LOG
|
||||
os.makedirs(os.path.dirname(config_location), exist_ok=True)
|
||||
os.makedirs(os.path.dirname(log_location), exist_ok=True)
|
||||
generate_config(config_location, yaml.dump(config))
|
||||
generate_config_yaml(config_location, config)
|
||||
self.app.note_file_for_apport("CurtinConfig", config_location)
|
||||
self.app.note_file_for_apport("CurtinErrors", ERROR_TARFILE)
|
||||
self.app.note_file_for_apport("CurtinLog", log_location)
|
||||
|
|
|
@ -20,6 +20,8 @@ import os
|
|||
import stat
|
||||
import tempfile
|
||||
|
||||
import yaml
|
||||
|
||||
_DEF_PERMS = 0o640
|
||||
_DEF_GROUP = 'adm'
|
||||
|
||||
|
@ -60,8 +62,8 @@ def write_file(filename, content, **kwargs):
|
|||
tf.write(content)
|
||||
|
||||
|
||||
def generate_config(filename, content, **kwargs):
|
||||
def generate_config_yaml(filename, content, **kwargs):
|
||||
with open_perms(filename, **kwargs) as tf:
|
||||
now = datetime.datetime.utcnow()
|
||||
tf.write(f'# Autogenerated by Subiquity: {now} UTC\n')
|
||||
tf.write(content)
|
||||
tf.write(yaml.dump(content))
|
||||
|
|
Loading…
Reference in New Issue