Commit 0dc81291 authored by Nikos Skalkotos's avatar Nikos Skalkotos

Make the 3rd CONFIGURATION_TASK field to function

Use a function to determine if a CONFIGURATION_TASK entry specifies
a task that is applicable for the current image's OS type.
parent fb378f89
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011-2014 GRNET S.A.
# Copyright (C) 2011-2015 GRNET S.A.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -38,20 +38,18 @@ from image_creator.dialog_util import SMALL_WIDTH, WIDTH, \
copy_file
CONFIGURATION_TASKS = [
("Partition table manipulation", ["FixPartitionTable"],
["linux", "windows"]),
("Partition table manipulation", ["FixPartitionTable"], lambda x: True),
("File system resize",
["FilesystemResizeUnmounted", "FilesystemResizeMounted"],
["linux", "windows"]),
("Swap partition configuration", ["AddSwap"], ["linux"]),
("SSH keys removal", ["DeleteSSHKeys"], ["linux"]),
["FilesystemResizeUnmounted", "FilesystemResizeMounted"], lambda x: True),
("Swap partition configuration", ["AddSwap"], lambda x: x == 'linux'),
("SSH keys removal", ["DeleteSSHKeys"], lambda x: x != 'windows'),
("Temporal RDP disabling", ["DisableRemoteDesktopConnections"],
["windows"]),
("SELinux relabeling at next boot", ["SELinuxAutorelabel"], ["linux"]),
("Hostname/Computer Name assignment", ["AssignHostname"],
["windows", "linux"]),
("Password change", ["ChangePassword"], ["windows", "linux"]),
("File injection", ["EnforcePersonality"], ["windows", "linux"])
lambda x: x == "windows"),
("SELinux relabeling at next boot", ["SELinuxAutorelabel"],
lambda x: x == "linux"),
("Hostname/Computer Name assignment", ["AssignHostname"], lambda x: True),
("Password change", ["ChangePassword"], lambda x: True),
("File injection", ["EnforcePersonality"], lambda x: True)
]
SYSPREP_PARAM_MAXLEN = 20
......@@ -641,8 +639,8 @@ def exclude_tasks(session):
else:
return False
for (msg, task, osfamily) in CONFIGURATION_TASKS:
if image.meta['OSFAMILY'] in osfamily:
for (msg, task, os_check) in CONFIGURATION_TASKS:
if os_check(image.meta['OSFAMILY']):
checked = 1 if index in session['excluded_tasks'] else 0
choices.append((str(displayed_index), msg, checked))
mapping[displayed_index] = index
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment