close /etc/machine-id properly when reading it

This commit is contained in:
Michael Hudson-Doyle 2019-05-10 10:25:57 +12:00
parent bdf33a2adf
commit 7848d18967
1 changed files with 5 additions and 1 deletions

View File

@ -183,6 +183,10 @@ class SubiquityModel:
else:
return "media-info"
def _machine_id(self):
with open('/etc/machine-id') as fp:
return fp.read()
def render(self, syslog_identifier):
config = {
'apt': {
@ -229,7 +233,7 @@ class SubiquityModel:
'write_files': {
'etc_machine_id': {
'path': 'etc/machine-id',
'content': open('/etc/machine-id').read(),
'content': self._machine_id(),
'permissions': 0o444,
},
'media_info': {