mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 18:00:35 +00:00
Clear the machine ID for jessie and newer releases (systemd) (resolves #427)
This commit is contained in:
parent
d21b09191e
commit
6bb167f361
3 changed files with 30 additions and 5 deletions
|
@ -35,7 +35,7 @@ def get_standard_groups(manifest):
|
|||
group.extend(security_group)
|
||||
group.extend(get_locale_group(manifest))
|
||||
group.extend(get_bootloader_group(manifest))
|
||||
group.extend(cleanup_group)
|
||||
group.extend(get_cleanup_group(manifest))
|
||||
return group
|
||||
|
||||
|
||||
|
@ -200,9 +200,17 @@ def get_fs_specific_group(manifest):
|
|||
return list(group)
|
||||
|
||||
|
||||
cleanup_group = [cleanup.ClearMOTD,
|
||||
cleanup.CleanTMP,
|
||||
]
|
||||
def get_cleanup_group(manifest):
|
||||
from bootstrapvz.common.releases import jessie
|
||||
|
||||
group = [cleanup.ClearMOTD,
|
||||
cleanup.CleanTMP,
|
||||
]
|
||||
|
||||
if manifest.release >= jessie:
|
||||
group.append(cleanup.ClearMachineId)
|
||||
|
||||
return group
|
||||
|
||||
|
||||
rollback_map = {workspace.CreateWorkspace: workspace.DeleteWorkspace,
|
||||
|
|
|
@ -30,3 +30,20 @@ class CleanTMP(Task):
|
|||
log = os.path.join(info.root, 'var/log/')
|
||||
os.remove(os.path.join(log, 'bootstrap.log'))
|
||||
os.remove(os.path.join(log, 'dpkg.log'))
|
||||
|
||||
|
||||
class ClearMachineId(Task):
|
||||
description = 'Clearing the Machine ID'
|
||||
phase = phases.system_cleaning
|
||||
|
||||
@classmethod
|
||||
def run(cls, info):
|
||||
import logging
|
||||
log = logging.getLogger(__name__)
|
||||
for machineid_file in [os.path.join(info.root, f) for f in ['etc/machine-id', 'var/lib/dbus/machine-id']]:
|
||||
if os.path.isfile(machineid_file):
|
||||
log.debug(machineid_file + ' found, clearing')
|
||||
with open(machineid_file, 'w'):
|
||||
pass
|
||||
else:
|
||||
log.debug(machineid_file + ' not found, not clearing')
|
||||
|
|
|
@ -21,7 +21,7 @@ def resolve_tasks(taskset, manifest):
|
|||
taskset.update(task_groups.get_apt_group(manifest))
|
||||
taskset.update(task_groups.get_locale_group(manifest))
|
||||
taskset.update(task_groups.security_group)
|
||||
taskset.update(task_groups.cleanup_group)
|
||||
taskset.update(task_groups.get_cleanup_group(manifest))
|
||||
|
||||
# Let the autostart of daemons by apt remain disabled
|
||||
taskset.discard(apt.EnableDaemonAutostart)
|
||||
|
|
Loading…
Add table
Reference in a new issue