def default_config(): ''' Linux hosts using systemd 207 or later ignore ``/etc/sysctl.conf`` and only load from ``/etc/sysctl.d/*.conf``. This function will do the proper checks and return a default config file which will be valid for the Minion. Hosts running systemd >= 207 will use ``/etc/sysctl.d/99-salt.conf``. CLI Example: .. code-block:: bash salt -G 'kernel:Linux' sysctl.default_config ''' if _sd_booted(): for line in __salt__['cmd.run_stdout']( 'systemctl --version').splitlines(): if line.startswith('systemd '): version = line.split()[-1] try: if int(version) >= 207: return '/etc/sysctl.d/99-salt.conf' except ValueError: log.error('Unexpected non-numeric systemd version {0!r} ' 'detected'.format(version)) break return '/etc/sysctl.conf'
def __virtual__(): ''' Only work on Debian and when systemd isn't running ''' if __grains__['os'] in ('Debian', 'Raspbian') and not _sd_booted(__context__): return __virtualname__ return False
def default_config(): ''' Linux hosts using systemd 207 or later ignore ``/etc/sysctl.conf`` and only load from ``/etc/sysctl.d/*.conf``. This function will do the proper checks and return a default config file which will be valid for the Minion. Hosts running systemd >= 207 will use ``/etc/sysctl.d/99-salt.conf``. CLI Example: .. code-block:: bash salt -G 'kernel:Linux' sysctl.default_config ''' if _sd_booted(): for line in __salt__['cmd.run_stdout']( 'systemctl --version' ).splitlines(): if line.startswith('systemd '): version = line.split()[-1] try: if int(version) >= 207: return '/etc/sysctl.d/99-salt.conf' except ValueError: log.error( 'Unexpected non-numeric systemd version {0!r} ' 'detected'.format(version) ) break return '/etc/sysctl.conf'
def __virtual__(): ''' Only work on Ubuntu ''' # Disable on these platforms, specific service modules exist: if _sd_booted(__context__): return False elif __grains__['os'] in ('Ubuntu', 'Linaro', 'elementary OS'): return __virtualname__ elif __grains__['os'] in ('Debian', 'Raspbian'): debian_initctl = '/sbin/initctl' if os.path.isfile(debian_initctl): initctl_version = salt.modules.cmdmod._run_quiet(debian_initctl + ' version') if 'upstart' in initctl_version: return __virtualname__ return False