mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Merge pull request #430 from octivi/cleaning_machine_id
Cleaning machine ID
This commit is contained in:
commit
4c8529569c
3 changed files with 30 additions and 5 deletions
|
@ -35,7 +35,7 @@ def get_standard_groups(manifest):
|
||||||
group.extend(security_group)
|
group.extend(security_group)
|
||||||
group.extend(get_locale_group(manifest))
|
group.extend(get_locale_group(manifest))
|
||||||
group.extend(get_bootloader_group(manifest))
|
group.extend(get_bootloader_group(manifest))
|
||||||
group.extend(cleanup_group)
|
group.extend(get_cleanup_group(manifest))
|
||||||
return group
|
return group
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,10 +200,18 @@ def get_fs_specific_group(manifest):
|
||||||
return list(group)
|
return list(group)
|
||||||
|
|
||||||
|
|
||||||
cleanup_group = [cleanup.ClearMOTD,
|
def get_cleanup_group(manifest):
|
||||||
|
from bootstrapvz.common.releases import jessie
|
||||||
|
|
||||||
|
group = [cleanup.ClearMOTD,
|
||||||
cleanup.CleanTMP,
|
cleanup.CleanTMP,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if manifest.release >= jessie:
|
||||||
|
group.append(cleanup.ClearMachineId)
|
||||||
|
|
||||||
|
return group
|
||||||
|
|
||||||
|
|
||||||
rollback_map = {workspace.CreateWorkspace: workspace.DeleteWorkspace,
|
rollback_map = {workspace.CreateWorkspace: workspace.DeleteWorkspace,
|
||||||
loopback.Create: volume.Delete,
|
loopback.Create: volume.Delete,
|
||||||
|
|
|
@ -30,3 +30,20 @@ class CleanTMP(Task):
|
||||||
log = os.path.join(info.root, 'var/log/')
|
log = os.path.join(info.root, 'var/log/')
|
||||||
os.remove(os.path.join(log, 'bootstrap.log'))
|
os.remove(os.path.join(log, 'bootstrap.log'))
|
||||||
os.remove(os.path.join(log, 'dpkg.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_apt_group(manifest))
|
||||||
taskset.update(task_groups.get_locale_group(manifest))
|
taskset.update(task_groups.get_locale_group(manifest))
|
||||||
taskset.update(task_groups.security_group)
|
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
|
# Let the autostart of daemons by apt remain disabled
|
||||||
taskset.discard(apt.EnableDaemonAutostart)
|
taskset.discard(apt.EnableDaemonAutostart)
|
||||||
|
|
Loading…
Add table
Reference in a new issue