mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #5796 from s0undt3ch/hotfix/modules.sysmod
Fix travis and sys.list_functions
This commit is contained in:
commit
b9d0352e99
@ -40,6 +40,11 @@ def doc(*args, **kwargs):
|
||||
### NOTE: **kwargs is used here to prevent a traceback when garbage
|
||||
### arguments are tacked on to the end.
|
||||
docs = {}
|
||||
if not args:
|
||||
for fun in __salt__:
|
||||
docs[fun] = __salt__[fun].__doc__
|
||||
return docs
|
||||
|
||||
for module in args:
|
||||
if module:
|
||||
# allow both "sys" and "sys." to match sys, without also matching
|
||||
@ -66,6 +71,11 @@ def list_functions(*args, **kwargs):
|
||||
'''
|
||||
### NOTE: **kwargs is used here to prevent a traceback when garbage
|
||||
### arguments are tacked on to the end.
|
||||
|
||||
if not args:
|
||||
# We're being asked for all functions
|
||||
return sorted(__salt__)
|
||||
|
||||
names = set()
|
||||
for module in args:
|
||||
if module:
|
||||
|
@ -10,9 +10,25 @@ class SysModuleTest(integration.ModuleCase):
|
||||
'''
|
||||
sys.list_functions
|
||||
'''
|
||||
# Get all functions
|
||||
funcs = self.run_function('sys.list_functions')
|
||||
self.assertTrue('hosts.list_hosts' in funcs)
|
||||
self.assertTrue('pkg.install' in funcs)
|
||||
self.assertIn('hosts.list_hosts', funcs)
|
||||
self.assertIn('pkg.install', funcs)
|
||||
|
||||
# Just sysctl
|
||||
funcs = self.run_function('sys.list_functions', ('sysctl',))
|
||||
self.assertNotIn('sys.doc', funcs)
|
||||
self.assertIn('sysctl.get', funcs)
|
||||
|
||||
# Just sys
|
||||
funcs = self.run_function('sys.list_functions', ('sys.',))
|
||||
self.assertNotIn('sysctl.get', funcs)
|
||||
self.assertIn('sys.doc', funcs)
|
||||
|
||||
# Staring with sys
|
||||
funcs = self.run_function('sys.list_functions', ('sys',))
|
||||
self.assertNotIn('sysctl.get', funcs)
|
||||
self.assertIn('sys.doc', funcs)
|
||||
|
||||
def test_list_modules(self):
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user