install: fix subclassing of knob groups

Add new @group decorator to declare an installer class as a knob group
instead of subclassing Group, so that subclassing the installer does not
create duplicates of the original group.

https://fedorahosted.org/freeipa/ticket/6392

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Jan Cholasta
2016-11-02 06:30:38 +01:00
parent 269ca6c454
commit 08a446a6bc
3 changed files with 12 additions and 17 deletions

View File

@@ -23,7 +23,7 @@ from . import util, typing
from .util import from_
__all__ = ['InvalidStateError', 'KnobValueError', 'Property', 'Knob',
'Configurable', 'Group', 'Component', 'Composite']
'Configurable', 'group', 'Component', 'Composite']
NoneType = type(None)
@@ -516,11 +516,14 @@ class Configurable(six.with_metaclass(abc.ABCMeta, object)):
self.__state = to_state
class Group(Configurable):
@classmethod
def group(cls):
def group(cls):
def group():
return cls
cls.group = staticmethod(group)
return cls
class ComponentMeta(util.InnerClassMeta, abc.ABCMeta):
pass