陈辉煌 发表于 2018-8-1 08:19:33

SaltStack源码分析之service模块

def __virtual__():  
    '''
  
    Only work on systems which exclusively use sysvinit
  
    '''
  
    # Disable on these platforms, specific service modules exist:
  
    disable = set((
  
      'RedHat',
  
      'CentOS',
  
      'Amazon',
  
      'ScientificLinux',
  
      'CloudLinux',
  
      'Fedora',
  
      'Gentoo',
  
      'Ubuntu',
  
      'Debian',
  
      'Arch',
  
      'Arch ARM',
  
      'ALT',
  
      'SUSEEnterprise Server',
  
      'OEL',
  
      'Linaro',
  
      'elementary OS',
  
      'McAfeeOS Server'
  
    ))
  
    if __grains__.get('os', '') in disable:
  
      return False
  
    # Disable on all non-Linux OSes as well
  
    if __grains__['kernel'] != 'Linux':
  
      return False
  
    # Suse >=12.0 uses systemd
  
    if __grains__.get('os_family', '') == 'Suse':
  
      try:
  
            if int(__grains__.get('osrelease', '').split('.')) >= 12:
  
                return False
  
      except ValueError:
  
            return False
  
    return 'service'
页: [1]
查看完整版本: SaltStack源码分析之service模块