mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add option to return a Non instantiated class
This commit is contained in:
parent
315b0cc105
commit
e67387deb7
2 changed files with 8 additions and 3 deletions
|
@ -15,7 +15,7 @@ import win32service
|
|||
import winerror
|
||||
|
||||
|
||||
class MinionService(service):
|
||||
class MinionService(service(False)):
|
||||
|
||||
def start(self):
|
||||
self.runflag = True
|
||||
|
|
|
@ -30,10 +30,15 @@ def __virtual__():
|
|||
return 'winservice'
|
||||
|
||||
|
||||
def service():
|
||||
def service(instantiated=True):
|
||||
'''
|
||||
Helper function to return an instance of the ServiceFramework class
|
||||
|
||||
Args:
|
||||
instantiated (bool): True to return an instantiated object, False to
|
||||
return the object definition. Use False if inherited by another
|
||||
class. Default is True.
|
||||
|
||||
Returns:
|
||||
class: An instance of the ServiceFramework class
|
||||
'''
|
||||
|
@ -87,7 +92,7 @@ def service():
|
|||
def stop(self):
|
||||
pass
|
||||
|
||||
return Service()
|
||||
return Service() if instantiated else Service
|
||||
|
||||
|
||||
def instart(cls, name, display_name=None, stay_alive=True):
|
||||
|
|
Loading…
Add table
Reference in a new issue