Revision 3f70f242 image_creator/os_type/__init__.py

b/image_creator/os_type/__init__.py
114 114
        """Cleanup sensitive data out of the OS image."""
115 115

  
116 116
        puts('Cleaning up sensitive data out of the OS image:')
117
        with indent(4):
118
            for name in dir(self):
119
                attr = getattr(self, name)
120
                if name.startswith('data_cleanup_') and callable(attr):
121
                    attr()
117

  
118
        is_cleanup = lambda x: x.startswith('data_cleanup_') and \
119
                                                    callable(getattr(self, x))
120
        tasks = [getattr(self, x) for x in dir(self) if is_cleanup(x)]
121
        size = len(tasks)
122
        cnt = 0
123
        for task in tasks:
124
            cnt += 1
125
            puts(('(%d/%d)' % (cnt, size)).ljust(7), False)
126
            task()
122 127
        puts()
123 128

  
124 129
    def sysprep(self):
125 130
        """Prepere system for image creation."""
126 131

  
127 132
        puts('Preparing system for image creation:')
128
        with indent(4):
129
            for name in dir(self):
130
                attr = getattr(self, name)
131
                if name.startswith('sysprep_') and callable(attr):
132
                    attr()
133

  
134
        is_sysprep = lambda x: x.startswith('sysprep_') and \
135
                                                    callable(getattr(self, x))
136
        tasks = [getattr(self, x) for x in dir(self) if is_sysprep(x)]
137
        size = len(tasks)
138
        cnt = 0
139
        for task in tasks:
140
            cnt += 1
141
            puts(('(%d/%d)' % (cnt, size)).ljust(7), False)
142
            task()
133 143
        puts()
134 144

  
135 145
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :

Also available in: Unified diff