diff options
author | Olivier Mauras <olivier@mauras.ch> | 2016-12-17 10:39:57 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2016-12-18 17:06:14 +0100 |
commit | 2e003b457f1bd78ff44c44df2dab117e75fc72c4 (patch) | |
tree | 35e0f55b7496048cc8aa83f4feddb79811c12cdc /community/salt | |
parent | 3a0538798b70ee4795b2644e46f1e8658c1b6dea (diff) | |
download | aports-2e003b457f1bd78ff44c44df2dab117e75fc72c4.tar.bz2 aports-2e003b457f1bd78ff44c44df2dab117e75fc72c4.tar.xz |
community/salt: upgrade to 2016.11.1
Diffstat (limited to 'community/salt')
-rw-r--r-- | community/salt/0001-alpine-support.patch | 320 | ||||
-rw-r--r-- | community/salt/APKBUILD | 14 |
2 files changed, 15 insertions, 319 deletions
diff --git a/community/salt/0001-alpine-support.patch b/community/salt/0001-alpine-support.patch index 530d33f391..c5f276c22c 100644 --- a/community/salt/0001-alpine-support.patch +++ b/community/salt/0001-alpine-support.patch @@ -1,6 +1,6 @@ -Upstream code not released yet that will happen in next major version - +Upstream code not released yet that will happen in next major version - Oxygen? --- + diff --git a/salt/modules/apk.py b/salt/modules/apk.py new file mode 100644 index 0000000..4c0efe0 @@ -627,319 +627,15 @@ index 0000000..4c0efe0 + + return ret diff --git a/salt/modules/gentoo_service.py b/salt/modules/gentoo_service.py -index 228a3fe..32dfcde 100644 +index 6345ae3..32dfcde 100644 --- a/salt/modules/gentoo_service.py +++ b/salt/modules/gentoo_service.py -@@ -12,9 +12,14 @@ to the correct service manager - - # Import Python libs - from __future__ import absolute_import -+import logging - --# Import Salt modules -+# Import salt libs - import salt.utils.systemd -+import salt.utils.odict as odict -+ -+# Set up logging -+log = logging.getLogger(__name__) - - # Define the module's virtual name - __virtualname__ = 'service' -@@ -22,13 +27,65 @@ __virtualname__ = 'service' - - def __virtual__(): +@@ -31,6 +31,8 @@ def __virtual__(): ''' -- Only work on systems which default to systemd -+ Only work on systems which default to OpenRC - ''' -- if __grains__['os'] == 'Gentoo' \ -- and not salt.utils.systemd.booted(__context__): -+ if __grains__['os'] == 'Gentoo' and not salt.utils.systemd.booted(__context__): -+ return __virtualname__ -+ if __grains__['os'] == 'Alpine': + if __grains__['os'] == 'Gentoo' and not salt.utils.systemd.booted(__context__): return __virtualname__ ++ if __grains__['os'] == 'Alpine': ++ return __virtualname__ return (False, 'The gentoo_service execution module cannot be loaded: ' -- 'only available on Gentoo systems.') -+ 'only available on Gentoo/Open-RC systems.') -+ -+ -+def _ret_code(cmd): -+ log.debug('executing [{0}]'.format(cmd)) -+ sts = __salt__['cmd.retcode'](cmd, python_shell=False) -+ return sts -+ -+ -+def _list_services(): -+ return __salt__['cmd.run']('rc-update -v show').splitlines() -+ -+ -+def _get_service_list(include_enabled=True, include_disabled=False): -+ enabled_services = dict() -+ disabled_services = set() -+ lines = _list_services() -+ for line in lines: -+ if '|' not in line: -+ continue -+ service = [l.strip() for l in line.split('|')] -+ # enabled service should have runlevels -+ if service[1]: -+ if include_enabled: -+ enabled_services.update({service[0]: sorted(service[1].split())}) -+ continue -+ # in any other case service is disabled -+ if include_disabled: -+ disabled_services.update({service[0]: []}) -+ return enabled_services, disabled_services -+ -+ -+def _enable_delta(name, requested_runlevels): -+ all_enabled = get_enabled() -+ current_levels = set(all_enabled[name] if name in all_enabled else []) -+ enabled_levels = requested_runlevels - current_levels -+ disabled_levels = current_levels - requested_runlevels -+ return enabled_levels, disabled_levels -+ -+ -+def _disable_delta(name, requested_runlevels): -+ all_enabled = get_enabled() -+ current_levels = set(all_enabled[name] if name in all_enabled else []) -+ return current_levels & requested_runlevels -+ -+ -+def _service_cmd(*args): -+ return '/etc/init.d/{0} {1}'.format(args[0], ' '.join(args[1:])) -+ -+ -+def _enable_disable_cmd(name, command, runlevels=()): -+ return 'rc-update {0} {1} {2}'.format(command, name, ' '.join(sorted(runlevels))).strip() - - - def get_enabled(): -@@ -41,15 +98,8 @@ def get_enabled(): - - salt '*' service.get_enabled - ''' -- ret = set() -- lines = __salt__['cmd.run']('rc-update show').splitlines() -- for line in lines: -- if '|' not in line: -- continue -- if 'shutdown' in line: -- continue -- ret.add(line.split('|')[0].strip()) -- return sorted(ret) -+ (enabled_services, disabled_services) = _get_service_list() -+ return odict.OrderedDict(enabled_services) - - - def get_disabled(): -@@ -62,17 +112,9 @@ def get_disabled(): - - salt '*' service.get_disabled - ''' -- ret = set() -- lines = __salt__['cmd.run']('rc-update -v show').splitlines() -- for line in lines: -- if '|' not in line: -- continue -- elif 'shutdown' in line: -- continue -- comps = line.split() -- if len(comps) < 3: -- ret.add(comps[0]) -- return sorted(ret) -+ (enabled_services, disabled_services) = _get_service_list(include_enabled=False, -+ include_disabled=True) -+ return sorted(disabled_services) - - - def available(name): -@@ -86,7 +128,9 @@ def available(name): - - salt '*' service.available sshd - ''' -- return name in get_all() -+ (enabled_services, disabled_services) = _get_service_list(include_enabled=True, -+ include_disabled=True) -+ return name in enabled_services or name in disabled_services - - - def missing(name): -@@ -101,7 +145,7 @@ def missing(name): - - salt '*' service.missing sshd - ''' -- return name not in get_all() -+ return not available(name) - - - def get_all(): -@@ -114,7 +158,10 @@ def get_all(): - - salt '*' service.get_all - ''' -- return sorted(get_enabled() + get_disabled()) -+ (enabled_services, disabled_services) = _get_service_list(include_enabled=True, -+ include_disabled=True) -+ enabled_services.update(dict([(s, []) for s in disabled_services])) -+ return odict.OrderedDict(enabled_services) - - - def start(name): -@@ -127,8 +174,8 @@ def start(name): - - salt '*' service.start <service name> - ''' -- cmd = '/etc/init.d/{0} start'.format(name) -- return not __salt__['cmd.retcode'](cmd, python_shell=False) -+ cmd = _service_cmd(name, 'start') -+ return not _ret_code(cmd) - - - def stop(name): -@@ -141,8 +188,8 @@ def stop(name): - - salt '*' service.stop <service name> - ''' -- cmd = '/etc/init.d/{0} stop'.format(name) -- return not __salt__['cmd.retcode'](cmd, python_shell=False) -+ cmd = _service_cmd(name, 'stop') -+ return not _ret_code(cmd) - - - def restart(name): -@@ -155,8 +202,36 @@ def restart(name): - - salt '*' service.restart <service name> - ''' -- cmd = '/etc/init.d/{0} restart'.format(name) -- return not __salt__['cmd.retcode'](cmd, python_shell=False) -+ cmd = _service_cmd(name, 'restart') -+ return not _ret_code(cmd) -+ -+ -+def reload_(name): -+ ''' -+ Reload the named service -+ -+ CLI Example: -+ -+ .. code-block:: bash -+ -+ salt '*' service.reload <service name> -+ ''' -+ cmd = _service_cmd(name, 'reload') -+ return not _ret_code(cmd) -+ -+ -+def zap(name): -+ ''' -+ Resets service state -+ -+ CLI Example: -+ -+ .. code-block:: bash -+ -+ salt '*' service.zap <service name> -+ ''' -+ cmd = _service_cmd(name, 'zap') -+ return not _ret_code(cmd) - - - def status(name, sig=None): -@@ -171,7 +246,10 @@ def status(name, sig=None): - - salt '*' service.status <service name> [service signature] - ''' -- return __salt__['status.pid'](sig if sig else name) -+ if sig: -+ return bool(__salt__['status.pid'](sig)) -+ cmd = _service_cmd(name, 'status') -+ return not _ret_code(cmd) - - - def enable(name, **kwargs): -@@ -182,10 +260,26 @@ def enable(name, **kwargs): - - .. code-block:: bash - -- salt '*' service.enable <service name> -+ salt '*' service.enable <service name> <runlevels=single-runlevel> -+ salt '*' service.enable <service name> <runlevels=[runlevel1,runlevel2]> - ''' -- cmd = 'rc-update add {0} default'.format(name) -- return not __salt__['cmd.retcode'](cmd, python_shell=False) -+ if 'runlevels' in kwargs: -+ requested_levels = set(kwargs['runlevels'] if isinstance(kwargs['runlevels'], -+ list) else [kwargs['runlevels']]) -+ enabled_levels, disabled_levels = _enable_delta(name, requested_levels) -+ commands = [] -+ if disabled_levels: -+ commands.append(_enable_disable_cmd(name, 'delete', disabled_levels)) -+ if enabled_levels: -+ commands.append(_enable_disable_cmd(name, 'add', enabled_levels)) -+ if not commands: -+ return True -+ else: -+ commands = [_enable_disable_cmd(name, 'add')] -+ for cmd in commands: -+ if _ret_code(cmd): -+ return False -+ return True - - - def disable(name, **kwargs): -@@ -196,10 +290,18 @@ def disable(name, **kwargs): + 'only available on Gentoo/Open-RC systems.') - .. code-block:: bash - -- salt '*' service.disable <service name> -+ salt '*' service.disable <service name> <runlevels=single-runlevel> -+ salt '*' service.disable <service name> <runlevels=[runlevel1,runlevel2]> - ''' -- cmd = 'rc-update delete {0} default'.format(name) -- return not __salt__['cmd.retcode'](cmd, python_shell=False) -+ levels = [] -+ if 'runlevels' in kwargs: -+ requested_levels = set(kwargs['runlevels'] if isinstance(kwargs['runlevels'], -+ list) else [kwargs['runlevels']]) -+ levels = _disable_delta(name, requested_levels) -+ if not levels: -+ return True -+ cmd = _enable_disable_cmd(name, 'delete', levels) -+ return not _ret_code(cmd) - - - def enabled(name, **kwargs): -@@ -210,9 +312,17 @@ def enabled(name, **kwargs): - - .. code-block:: bash - -- salt '*' service.enabled <service name> -+ salt '*' service.enabled <service name> <runlevels=single-runlevel> -+ salt '*' service.enabled <service name> <runlevels=[runlevel1,runlevel2]> - ''' -- return name in get_enabled() -+ enabled_services = get_enabled() -+ if name not in enabled_services: -+ return False -+ if 'runlevels' not in kwargs: -+ return True -+ requested_levels = set(kwargs['runlevels'] if isinstance(kwargs['runlevels'], -+ list) else [kwargs['runlevels']]) -+ return len(requested_levels - set(enabled_services[name])) == 0 - - - def disabled(name): -@@ -223,6 +333,6 @@ def disabled(name): - - .. code-block:: bash - -- salt '*' service.disabled <service name> -+ salt '*' service.disabled <service name> <runlevels=[runlevel]> - ''' - return name in get_disabled() --- -2.10.0 - diff --git a/community/salt/APKBUILD b/community/salt/APKBUILD index e459a9050c..45de2c194e 100644 --- a/community/salt/APKBUILD +++ b/community/salt/APKBUILD @@ -2,7 +2,7 @@ # Contributor: Olivier Mauras <olivier@mauras.ch> # Maintainer: Olivier Mauras <olivier@mauras.ch> pkgname=salt -pkgver=2016.3.4 +pkgver=2016.11.1 pkgrel=0 pkgdesc="A parallel remote execution system" url="https://github.com/saltstack/salt" @@ -110,7 +110,7 @@ _conf_copy() { cp -r "$builddir"/conf/$type* "$subpkgdir"/etc/salt/ } -md5sums="1ce25b16c7d4de5058cad59cdc7651f1 salt-2016.3.4.tar.gz +md5sums="6dc2898f0f30cfc7cd79d7ee33beecee salt-2016.11.1.tar.gz 322f17cc48aabdc8cbf5f0bccf3e2059 salt-api.confd 014e02c0aafafcd74179e32f5a3b55a8 salt-api.initd 7bb58f256213aaaa23d86d5127c9ffe3 salt-master.confd @@ -119,8 +119,8 @@ md5sums="1ce25b16c7d4de5058cad59cdc7651f1 salt-2016.3.4.tar.gz c8326b9cff0df6065a1320eefea09b2c salt-minion.initd a24d13b018a35b31b34167bcaa749db5 salt-syndic.confd dffce15d3a16a2dc40dd02d0c24fb4c6 salt-syndic.initd -1e1707f34e0f9af609ad1cd66d1b2c11 0001-alpine-support.patch" -sha256sums="09112bffb004afc78c68a2cd4cfd30e17570f7f5a37d409143218077ff8c2cc7 salt-2016.3.4.tar.gz +7736c86a3f2bfadab8c70a8e9ca6a45f 0001-alpine-support.patch" +sha256sums="7f061ad760856afe3699bd8aafb75f1657581b898533482f3ce58d627c3eec57 salt-2016.11.1.tar.gz b25cfdb769305f2245b27f6753adee590bac10faeb8c43ba605dbf7e931fe258 salt-api.confd f8918f2819b81e69af1b8564b90ec370942ed733aefd4b97e5d2446a892880eb salt-api.initd 383475b21261ac22c5930e99060d53630dfb35aac67aa03a18ec738e0f4dff50 salt-master.confd @@ -129,8 +129,8 @@ f8918f2819b81e69af1b8564b90ec370942ed733aefd4b97e5d2446a892880eb salt-api.initd ae9236919c3fee3eef0ef8ad54334d6f833a51bbd4d42c40214614498acbe573 salt-minion.initd 66a663c426e2fa157ea78f7f9b2f33f17b72dbc48e119f8dd2609aab8f8370e7 salt-syndic.confd 6a453f63e51f2cc1ecb024ee8e7fa1beab7fbcea010f3eb10ea23bdb2383e7f5 salt-syndic.initd -c38f11633625ce968a64d85819f7fa494d8734517ec3f70afb9be2ac402173da 0001-alpine-support.patch" -sha512sums="16305a4321cb12044639ee975bafe79a7ed1edd5607e5dc98a78eabf3cfbd23d51e2c4281a68693fa7924725698ef9378416b65ef21a603efaf9e1bc064aa2a2 salt-2016.3.4.tar.gz +cd07c61dec347678049bd436d99b2278e8e5c5c0c71899c37533cbe05975b6cc 0001-alpine-support.patch" +sha512sums="d8eb7ca2494307e13230a80302066c939ea8c5649223437a559d2b5c407f6536ba72ca4331c01beb308b6043c4f64d63c0a51e22caa84281d904ea9354430bec salt-2016.11.1.tar.gz 975ba2f5e681fbd62045da61cc3dc065b148683a07b5df7eca9f131e47314eb6bfa8660ca1c06a3bd93683c7097d0ff9f8e514273dd24d82fb2de6a255e6b275 salt-api.confd 435d399bfecf431d0c713031e2ae57ce25b5c6edc98b62f33bd7a4ff1c587e3cdeb988445ae0c3e9ffc1911555c3694654d98815f9562b8a14bf0688ec1ebea6 salt-api.initd cfbbeb8023a383e7c42d84e3346edfd068c9ec7650c4ddc3caa38534da325a67497e1f06ca02cc1f0941b7348a3af6d1dca7cd6f2bcb3612ca10e1ec98997e5a salt-master.confd @@ -139,4 +139,4 @@ cfbbeb8023a383e7c42d84e3346edfd068c9ec7650c4ddc3caa38534da325a67497e1f06ca02cc1f c6634a592c6f3e65dd2b704cb500486bf8004c5b287d4a4d42b09af36ef129c59d6a89f005af058cf7911e8587d927b3db931186569084f13ebaca56f6ef93a0 salt-minion.initd bafc6ea10cdafd0aef868feb35aecbe4ae6a7dff0ae42862bded85715ad763eb89e1ed27437866a7e5f2b9f7064e3c2a3fb59814487744ba4227238d95cf3818 salt-syndic.confd d71133e834685304e0167554035ebbc861252f972bbe981cc71e45b70f15d94a28a02a369463c9a641372919689f96b62a0408b14f824ad986d536e52b1e5ec0 salt-syndic.initd -5581671e030f6af53b48016aa31e80b1908cb15721f3b113b9945484616f5cd6e22af80f6f25b2d68044bf8f59be9673a8a0577f6c2f4422130f5055bb960b35 0001-alpine-support.patch" +9af1b09d97d7eabae38b8313240b36e6e959c6dc8f24630f20f0788802740cad5bd6dc8960e0ae98f8b61bb732b4ee7e5a5a20d5f31a072f6323062fe97ddc2a 0001-alpine-support.patch" |