dsqzhaoyue 发表于 2018-8-1 07:21:52

SaltStack源码分析之cmdmod模块

# Import python libs  
import time
  
import functools
  
import json
  
import glob
  
import logging
  
import os
  
import shutil
  
import subprocess
  
import sys
  
import traceback
  
from salt.utils import vt
  

  
# Import salt libs
  
import salt.utils
  
import salt.utils.timed_subprocess
  
import salt.grains.extra
  
from salt._compat import string_types
  
from salt.exceptions import CommandExecutionError, TimedProcTimeoutError
  
from salt.log import LOG_LEVELS
  

  
# Only available on POSIX systems, nonfatal on windows
  
try:
  
    import pwd
  
except ImportError:
  
    pass
  

  
# Define the module's virtual name
  
__virtualname__ = 'cmd'
  

  
# Set up logging
  
log = logging.getLogger(__name__)
  

  
DEFAULT_SHELL = salt.grains.extra.shell()['shell']
  

  

  
def __virtual__():
  
    '''
  
    Overwriting the cmd python module makes debugging modules
  
    with pdb a bit harder so lets do it this way instead.
  
    '''
  
    return __virtualname__
页: [1]
查看完整版本: SaltStack源码分析之cmdmod模块