pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/salt salt: don't crash if no swap is configured



details:   https://anonhg.NetBSD.org/pkgsrc/rev/778db760c183
branches:  trunk
changeset: 380151:778db760c183
user:      maya <maya%pkgsrc.org@localhost>
date:      Sat May 12 11:29:35 2018 +0000

description:
salt: don't crash if no swap is configured
(in a netbsd/openbsd specific code block)

from Travis Paul in PR pkg/53278, also upstream pull #47600
bump PKGREVISION

diffstat:

 sysutils/salt/Makefile                          |   3 ++-
 sysutils/salt/distinfo                          |   3 ++-
 sysutils/salt/patches/patch-salt_grains_core.py |  25 +++++++++++++++++++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)

diffs (54 lines):

diff -r 2b7723b20ad9 -r 778db760c183 sysutils/salt/Makefile
--- a/sysutils/salt/Makefile    Sat May 12 10:12:02 2018 +0000
+++ b/sysutils/salt/Makefile    Sat May 12 11:29:35 2018 +0000
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.59 2018/04/13 07:58:22 adam Exp $
+# $NetBSD: Makefile,v 1.60 2018/05/12 11:29:35 maya Exp $
 
 DISTNAME=      salt-2018.3.0
+PKGREVISION=   1
 CATEGORIES=    sysutils
 MASTER_SITES=  ${MASTER_SITE_PYPI:=s/salt/}
 
diff -r 2b7723b20ad9 -r 778db760c183 sysutils/salt/distinfo
--- a/sysutils/salt/distinfo    Sat May 12 10:12:02 2018 +0000
+++ b/sysutils/salt/distinfo    Sat May 12 11:29:35 2018 +0000
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.34 2018/04/13 07:58:22 adam Exp $
+$NetBSD: distinfo,v 1.35 2018/05/12 11:29:35 maya Exp $
 
 SHA1 (salt-2018.3.0.tar.gz) = b891aa96775a9675fef7ca98a78073fed304e062
 RMD160 (salt-2018.3.0.tar.gz) = 54ea78736292c97367c4b34b586bce25b434ecce
 SHA512 (salt-2018.3.0.tar.gz) = 3d64a4d12d4ff7effe644b682b138d8f49fd00523e9cfe3e80bebff9c944a089fb41cbac92e63139633425f49c1eebeb99145290a0bdd1b4f306da86abe9b2e5
 Size (salt-2018.3.0.tar.gz) = 13448567 bytes
+SHA1 (patch-salt_grains_core.py) = 735a71cd9616be34cce6b015da7a70cace08accd
 SHA1 (patch-salt_version.py) = 1827dac3609a938fae38ee5dfd2a873c9723dfbd
diff -r 2b7723b20ad9 -r 778db760c183 sysutils/salt/patches/patch-salt_grains_core.py
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/salt/patches/patch-salt_grains_core.py   Sat May 12 11:29:35 2018 +0000
@@ -0,0 +1,25 @@
+$NetBSD: patch-salt_grains_core.py,v 1.3 2018/05/12 11:29:35 maya Exp $
+
+Prevent crash on NetBSD and OpenBSD when no swap is configured.
+https://github.com/saltstack/salt/pull/47600
+
+--- salt/grains/core.py.orig   2018-05-11 13:12:38.000000000 +0000
++++ salt/grains/core.py
+@@ -450,11 +450,13 @@ def _bsd_memdata(osdata):
+             mem = __salt__['cmd.run']('{0} -n hw.physmem64'.format(sysctl))
+         grains['mem_total'] = int(mem) // 1024 // 1024
+
+-        if osdata['kernel'] == 'OpenBSD':
++        if osdata['kernel'] in ['OpenBSD', 'NetBSD']:
+             swapctl = salt.utils.path.which('swapctl')
+-            swap_total = __salt__['cmd.run']('{0} -sk'.format(swapctl)).split(' ')[1]
+-        else:
+-            swap_total = __salt__['cmd.run']('{0} -n vm.swap_total'.format(sysctl))
++            swap_data = __salt__['cmd.run']('{0} -sk'.format(swapctl))
++            if swap_data == 'no swap devices configured':
++                swap_total = 0
++            else:
++                swap_total = swap_data.split(' ')[1]
+         grains['swap_total'] = int(swap_total) // 1024 // 1024
+     return grains
+



Home | Main Index | Thread Index | Old Index