Revision af01e887 image_creator/os_type/windows.py

b/image_creator/os_type/windows.py
36 36
"""This module hosts OS-specific code common for the various Microsoft
37 37
Windows OSs."""
38 38

  
39
from image_creator.os_type import OSBase, sysprep
39
from image_creator.os_type import OSBase, sysprep, add_sysprep_param
40 40
from image_creator.util import FatalError, check_guestfs_version, get_command
41 41
from image_creator.winexe import WinEXE, WinexeTimeout
42 42

  
......
107 107

  
108 108
class Windows(OSBase):
109 109
    """OS class for Windows"""
110

  
111
    @add_sysprep_param('password', 'Image Administrator Password', 20)
110 112
    def __init__(self, image, **kargs):
111 113
        super(Windows, self).__init__(image, **kargs)
112 114

  
......
126 128

  
127 129
        self.product_name = self.g.inspect_get_product_name(self.root)
128 130

  
129
    def needed_sysprep_params(self):
130
        """Returns a list of needed sysprep parameters. Each element in the
131
        list is a SysprepParam object.
132
        """
133
        password = self.SysprepParam(
134
            'password', 'Image Administrator Password', 20, lambda x: True)
135

  
136
        return [password]
137

  
138 131
    @sysprep('Disabling IPv6 privacy extensions')
139 132
    def disable_ipv6_privacy_extensions(self):
140 133
        """Disable IPv6 privacy extensions"""
......
280 273
            raise FatalError("Image is already syspreped!")
281 274

  
282 275
        txt = "System preparation parameter: `%s' is needed but missing!"
283
        for param in self.needed_sysprep_params():
284
            if param[0] not in self.sysprep_params:
285
                raise FatalError(txt % param[0])
276
        for param in self.needed_sysprep_params:
277
            if param not in self.sysprep_params:
278
                raise FatalError(txt % param)
286 279

  
287 280
        self.mount(readonly=False)
288 281
        try:

Also available in: Unified diff