1""" 2This runner is used only for test purposes and servers no production purpose 3""" 4 5import time 6 7 8def arg(*args, **kwargs): 9 """ 10 Output the given args and kwargs 11 12 Kwargs will be filtered for 'private' keynames. 13 """ 14 kwargs = {k: v for k, v in kwargs.items() if not k.startswith("__")} 15 16 ret = { 17 "args": args, 18 "kwargs": kwargs, 19 } 20 return ret 21 22 23def raw_arg(*args, **kwargs): 24 """ 25 Output the given args and kwargs 26 """ 27 ret = { 28 "args": args, 29 "kwargs": kwargs, 30 } 31 return ret 32 33 34def metasyntactic(locality="us"): 35 """ 36 Return common metasyntactic variables for the given locality 37 """ 38 lookup = { 39 "us": [ 40 "foo", 41 "bar", 42 "baz", 43 "qux", 44 "quux", 45 "quuz", 46 "corge", 47 "grault", 48 "garply", 49 "waldo", 50 "fred", 51 "plugh", 52 "xyzzy", 53 "thud", 54 ], 55 "uk": ["wibble", "wobble", "wubble", "flob"], 56 } 57 return lookup.get(locality, None) 58 59 60def stdout_print(): 61 """ 62 Print 'foo' and return 'bar' 63 """ 64 print("foo") 65 return "bar" 66 67 68def sleep(s_time=10): 69 """ 70 Sleep t seconds, then return True 71 """ 72 print(s_time) 73 time.sleep(s_time) 74 return True 75 76 77def stream(): 78 """ 79 Return True 80 """ 81 ret = True 82 for i in range(1, 100): 83 __jid_event__.fire_event( 84 {"message": "Runner is {}% done".format(i)}, "progress" 85 ) 86 time.sleep(0.1) 87 return ret 88 89 90def get_opts(): 91 """ 92 .. versionadded:: 2018.3.0 93 94 Return the configuration options of the master. 95 96 CLI Example: 97 98 .. code-block:: bash 99 100 salt-run test.get_opts 101 """ 102 return __opts__ 103