The final module
When we put all of the preceding code together, we end up with the following module:
''' This module should be saved as salt/modules/mysqltest.py ''' import salt.utils try: import MySQLdb HAS_LIBS = True except ImportError: HAS_LIBS = False import logging log = logging.getLogger(__name__) __func_alias__ = { 'list_': 'list' } __virtualname__ = 'mysqltest' def __virtual__(): ''' Check dependencies, using both methods from the chapter ''' if not salt.utils.which('mysql'): return False if HAS_LIBS: return __virtualname__ return False def ping(): ''' Returns True CLI Example: salt '*' mysqltest.ping ''' return True def check_mysqld(): ''' Check to see if sshd is running and listening CLI Example: salt &apos...