Merge pull request #8572 from jcollie/depends-typo

fix funcion => function typos
This commit is contained in:
Thomas S Hatch 2013-11-15 20:45:41 -08:00
commit 78df157504
4 changed files with 12 additions and 12 deletions

View File

@ -13774,7 +13774,7 @@ work on all hosts, but some functions require (for example) a service to be inst
Instead of trying to wrap much of the code in large try/except blocks you can use
a simple decorator to do this. If the dependencies passed to the decorator don\(aqt
exist, then the salt minion will remove those functions from the module on that host.
If a "fallback_funcion" is defined, it will replace the function instead of removing it
If a "fallback_function" is defined, it will replace the function instead of removing it
.INDENT 0.0
.INDENT 3.5
.sp
@ -13800,7 +13800,7 @@ def _fallback():
\(aq\(aq\(aq
return \(aq"dependency_that_sometimes_exists" needs to be installed for this function to exist\(aq
@depends(\(aqdependency_that_sometimes_exists\(aq, fallback_funcion=_fallback)
@depends(\(aqdependency_that_sometimes_exists\(aq, fallback_function=_fallback)
def foo():
\(aq\(aq\(aq
Function with a dependency on the "dependency_that_sometimes_exists" module.

View File

@ -279,7 +279,7 @@ work on all hosts, but some functions require (for example) a service to be inst
Instead of trying to wrap much of the code in large try/except blocks you can use
a simple decorator to do this. If the dependencies passed to the decorator don't
exist, then the salt minion will remove those functions from the module on that host.
If a "fallback_funcion" is defined, it will replace the function instead of removing it
If a "fallback_function" is defined, it will replace the function instead of removing it
.. code-block:: python
@ -303,7 +303,7 @@ If a "fallback_funcion" is defined, it will replace the function instead of remo
'''
return '"dependency_that_sometimes_exists" needs to be installed for this function to exist'
@depends('dependency_that_sometimes_exists', fallback_funcion=_fallback)
@depends('dependency_that_sometimes_exists', fallback_function=_fallback)
def foo():
'''
Function with a dependency on the "dependency_that_sometimes_exists" module.

View File

@ -38,7 +38,7 @@ class Depends(object):
OR
@depends('modulename', fallback_funcion=function)
@depends('modulename', fallback_function=function)
def test():
return 'foo'
'''
@ -49,7 +49,7 @@ class Depends(object):
)
)
self.dependencies = dependencies
self.fallback_funcion = kwargs.get('fallback_funcion')
self.fallback_function = kwargs.get('fallback_function')
def __call__(self, function):
'''
@ -60,7 +60,7 @@ class Depends(object):
module = inspect.getmodule(inspect.stack()[1][0])
for dep in self.dependencies:
self.dependency_dict[dep].add(
(module, function, self.fallback_funcion)
(module, function, self.fallback_function)
)
return function
@ -74,7 +74,7 @@ class Depends(object):
'''
for dependency, dependent_set in cls.dependency_dict.iteritems():
# check if dependency is loaded
for module, func, fallback_funcion in dependent_set:
for module, func, fallback_function in dependent_set:
# check if you have the dependency
if dependency in dir(module):
log.debug(
@ -102,8 +102,8 @@ class Depends(object):
continue
try:
if fallback_funcion is not None:
functions[mod_key] = fallback_funcion
if fallback_function is not None:
functions[mod_key] = fallback_function
else:
del(functions[mod_key])
except AttributeError:

View File

@ -21,13 +21,13 @@ def depends():
def missing_depends():
return True
@salt.utils.decorators.depends('time', fallback_funcion=_fallbackfunc)
@salt.utils.decorators.depends('time', fallback_function=_fallbackfunc)
def depends_will_fallback():
ret = {'ret': True,
'time': time.time()}
return ret
@salt.utils.decorators.depends('time123', fallback_funcion=_fallbackfunc)
@salt.utils.decorators.depends('time123', fallback_function=_fallbackfunc)
def missing_depends_will_fallback():
ret = {'ret': True,
'time': time.time()}