Revision 173022fb image_creator/os_type/__init__.py
b/image_creator/os_type/__init__.py | ||
---|---|---|
42 | 42 |
import textwrap |
43 | 43 |
import re |
44 | 44 |
from collections import namedtuple |
45 |
from functools import wraps |
|
45 | 46 |
|
46 | 47 |
|
47 | 48 |
def os_cls(distro, osfamily): |
... | ... | |
67 | 68 |
return wrapper |
68 | 69 |
|
69 | 70 |
|
70 |
def sysprep(enabled=True): |
|
71 |
def sysprep(message, enabled=True):
|
|
71 | 72 |
"""Decorator for system preparation tasks""" |
72 |
def wrapper(func): |
|
73 |
def wrapper1(func):
|
|
73 | 74 |
func.sysprep = True |
74 | 75 |
func.enabled = enabled |
75 | 76 |
func.executed = False |
76 |
return func |
|
77 |
return wrapper |
|
77 |
|
|
78 |
@wraps(func) |
|
79 |
def wrapper2(self, print_message=True): |
|
80 |
if print_message: |
|
81 |
self.out.output(message) |
|
82 |
return func(self) |
|
83 |
|
|
84 |
return wrapper2 |
|
85 |
|
|
86 |
return wrapper1 |
|
78 | 87 |
|
79 | 88 |
|
80 | 89 |
class OSBase(object): |
Also available in: Unified diff