mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Add docs for new raw boolean support of depends decorator
This commit is contained in:
parent
9fa37fd46b
commit
b8e39c13f9
@ -336,3 +336,20 @@ If a "fallback_function" is defined, it will replace the function instead of rem
|
||||
replaced with "_fallback"
|
||||
'''
|
||||
return True
|
||||
|
||||
In addition to global dependancies the depends decorator also supports raw booleans.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from salt.utils.decorators import depends
|
||||
|
||||
HAS_DEP = False
|
||||
try:
|
||||
import dependency_that_sometimes_exists
|
||||
HAS_DEP = True
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
@depends(HAS_DEP)
|
||||
def foo():
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user