View | Details | Raw Unified | Return to bug 247627
Collapse All | Expand All

(-)b/sysutils/py-salt/Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	salt
4
PORTNAME=	salt
5
PORTVERSION=	3001
5
PORTVERSION=	3001
6
PORTREVISION=	1
6
PORTREVISION=	2
7
CATEGORIES=	sysutils python
7
CATEGORIES=	sysutils python
8
MASTER_SITES=	CHEESESHOP
8
MASTER_SITES=	CHEESESHOP
9
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
9
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
(-)b/sysutils/py-salt/files/patch-salt_modules_linux__sysctl.py (+115 lines)
Added Link Here
1
--- salt/modules/linux_sysctl.py.orig	2020-06-17 18:05:55 UTC
2
+++ salt/modules/linux_sysctl.py
3
@@ -66,8 +66,8 @@ def show(config_file=False):
4
     """
5
     Return a list of sysctl parameters for this minion
6
 
7
-    :param config_file: Pull data from the system configuration file
8
-                        instead of the live kernel.
9
+    config: Pull the data from the system configuration file
10
+        instead of the live data.
11
 
12
     CLI Example:
13
 
14
@@ -108,13 +108,10 @@ def show(config_file=False):
15
     return ret
16
 
17
 
18
-def get(name, ignore=False):
19
+def get(name):
20
     """
21
     Return a single sysctl parameter for this minion
22
 
23
-    :param name: Name of sysctl setting
24
-    :param ignore: Optional boolean to pass --ignore to sysctl (Default: False)
25
-
26
     CLI Example:
27
 
28
     .. code-block:: bash
29
@@ -122,20 +119,14 @@ def get(name, ignore=False):
30
         salt '*' sysctl.get net.ipv4.ip_forward
31
     """
32
     cmd = "sysctl -n {0}".format(name)
33
-    if ignore:
34
-        cmd += " --ignore"
35
     out = __salt__["cmd.run"](cmd, python_shell=False)
36
     return out
37
 
38
 
39
-def assign(name, value, ignore=False):
40
+def assign(name, value):
41
     """
42
     Assign a single sysctl parameter for this minion
43
 
44
-    :param name: Name of sysctl setting
45
-    :param value: Desired value of sysctl setting
46
-    :param ignore: Optional boolean to pass --ignore to sysctl (Default: False)
47
-
48
     CLI Example:
49
 
50
     .. code-block:: bash
51
@@ -156,13 +147,11 @@ def assign(name, value, ignore=False):
52
         tran_tab = name.translate(trans_args)
53
 
54
     sysctl_file = "/proc/sys/{0}".format(tran_tab)
55
-    if not ignore and not os.path.exists(sysctl_file):
56
+    if not os.path.exists(sysctl_file):
57
         raise CommandExecutionError("sysctl {0} does not exist".format(name))
58
 
59
     ret = {}
60
     cmd = 'sysctl -w {0}="{1}"'.format(name, value)
61
-    if ignore:
62
-        cmd += " --ignore"
63
     data = __salt__["cmd.run_all"](cmd, python_shell=False)
64
     out = data["stdout"]
65
     err = data["stderr"]
66
@@ -175,9 +164,6 @@ def assign(name, value, ignore=False):
67
     if not regex.match(out) or "Invalid argument" in six.text_type(err):
68
         if data["retcode"] != 0 and err:
69
             error = err
70
-        elif ignore:
71
-            ret[name] = "ignored"
72
-            return ret
73
         else:
74
             error = out
75
         raise CommandExecutionError("sysctl -w failed: {0}".format(error))
76
@@ -186,17 +172,12 @@ def assign(name, value, ignore=False):
77
     return ret
78
 
79
 
80
-def persist(name, value, config=None, ignore=False):
81
+def persist(name, value, config=None):
82
     """
83
     Assign and persist a simple sysctl parameter for this minion. If ``config``
84
     is not specified, a sensible default will be chosen using
85
     :mod:`sysctl.default_config <salt.modules.linux_sysctl.default_config>`.
86
 
87
-    :param name: Name of sysctl setting
88
-    :param value: Desired value of sysctl setting
89
-    :param config: Optional path to sysctl.conf
90
-    :param ignore: Optional boolean to pass --ignore to sysctl (Default: False)
91
-
92
     CLI Example:
93
 
94
     .. code-block:: bash
95
@@ -259,11 +240,8 @@ def persist(name, value, config=None, ignore=False):
96
             # This is the line to edit
97
             if six.text_type(comps[1]) == six.text_type(value):
98
                 # It is correct in the config, check if it is correct in /proc
99
-                current_setting = get(name, ignore)
100
-                if not current_setting:
101
-                    return "Ignored"
102
-                if six.text_type(current_setting) != six.text_type(value):
103
-                    assign(name, value, ignore)
104
+                if six.text_type(get(name)) != six.text_type(value):
105
+                    assign(name, value)
106
                     return "Updated"
107
                 else:
108
                     return "Already set"
109
@@ -282,5 +260,5 @@ def persist(name, value, config=None, ignore=False):
110
         msg = "Could not write to file: {0}"
111
         raise CommandExecutionError(msg.format(config))
112
 
113
-    assign(name, value, ignore)
114
+    assign(name, value)
115
     return "Updated"
(-)b/sysutils/py-salt/files/patch-salt_states_pkg.py (-3 / +3 lines)
Lines 1-6 Link Here
1
--- salt/states/pkg.py.orig	2020-01-14 22:57:27 UTC
1
--- salt/states/pkg.py.orig	2020-06-17 18:05:55 UTC
2
+++ salt/states/pkg.py
2
+++ salt/states/pkg.py
3
@@ -207,6 +207,10 @@ def _fulfills_version_string(installed_versions, versi
3
@@ -227,6 +227,10 @@ def _fulfills_version_string(
4
         the repository without enforcing a re-installation of the package.
4
         the repository without enforcing a re-installation of the package.
5
         (Only applicable if only one strict version condition is specified E.G. version: 2.0.6~ubuntu3)
5
         (Only applicable if only one strict version condition is specified E.G. version: 2.0.6~ubuntu3)
6
     """
6
     """
Lines 11-17 Link Here
11
     version_conditions = _parse_version_string(version_conditions_string)
11
     version_conditions = _parse_version_string(version_conditions_string)
12
     for installed_version in installed_versions:
12
     for installed_version in installed_versions:
13
         fullfills_all = True
13
         fullfills_all = True
14
@@ -704,7 +708,7 @@ def _find_install_targets(name=None,
14
@@ -754,7 +758,7 @@ def _find_install_targets(
15
         for key in resolved_latest:
15
         for key in resolved_latest:
16
             if not resolved_latest[key]:
16
             if not resolved_latest[key]:
17
                 if key in cur_pkgs:
17
                 if key in cur_pkgs:
(-)b/sysutils/py-salt/files/patch-salt_states_sysctl.py (+42 lines)
Added Link Here
1
--- salt/states/sysctl.py.orig	2020-06-17 18:05:55 UTC
2
+++ salt/states/sysctl.py
3
@@ -32,7 +32,7 @@ def __virtual__():
4
     return (False, "sysctl module could not be loaded")
5
 
6
 
7
-def present(name, value, config=None, ignore=False):
8
+def present(name, value, config=None):
9
     """
10
     Ensure that the named sysctl value is set in memory and persisted to the
11
     named configuration file. The default sysctl configuration file is
12
@@ -47,13 +47,6 @@ def present(name, value, config=None, ignore=False):
13
     config
14
         The location of the sysctl configuration file. If not specified, the
15
         proper location will be detected based on platform.
16
-
17
-    ignore
18
-        ..versionadded:: neon
19
-
20
-        Adds --ignore to sysctl commands. This suppresses errors in environments
21
-        where sysctl settings may have been disabled in kernel boot configuration.
22
-        Defaults to False
23
     """
24
     ret = {"name": name, "result": True, "changes": {}, "comment": ""}
25
 
26
@@ -114,7 +107,7 @@ def present(name, value, config=None, ignore=False):
27
         return ret
28
 
29
     try:
30
-        update = __salt__["sysctl.persist"](name, value, config, ignore)
31
+        update = __salt__["sysctl.persist"](name, value, config)
32
     except CommandExecutionError as exc:
33
         ret["result"] = False
34
         ret["comment"] = "Failed to set {0} to {1}: {2}".format(name, value, exc)
35
@@ -125,7 +118,5 @@ def present(name, value, config=None, ignore=False):
36
         ret["comment"] = "Updated sysctl value {0} = {1}".format(name, value)
37
     elif update == "Already set":
38
         ret["comment"] = "Sysctl value {0} = {1} is already set".format(name, value)
39
-    elif update == "Ignored":
40
-        ret["comment"] = "Sysctl value {0} = {1} was ignored".format(name, value)
41
 
42
     return ret
(-)b/sysutils/py-salt/files/patch-tests_unit_modules_test__linux__sysctl.py (+37 lines)
Added Link Here
1
--- tests/unit/modules/test_linux_sysctl.py.orig	2020-06-17 18:05:55 UTC
2
+++ tests/unit/modules/test_linux_sysctl.py
3
@@ -33,14 +33,6 @@ class LinuxSysctlTestCase(TestCase, LoaderModuleMockMi
4
         with patch.dict(linux_sysctl.__salt__, {"cmd.run": mock_cmd}):
5
             self.assertEqual(linux_sysctl.get("net.ipv4.ip_forward"), 1)
6
 
7
-    def test_get_ignore(self):
8
-        """
9
-        Tests the return of get function with ignore
10
-        """
11
-        mock_cmd = MagicMock(return_value="")
12
-        with patch.dict(linux_sysctl.__salt__, {"cmd.run": mock_cmd}):
13
-            self.assertEqual(linux_sysctl.get("net.ipv4.ip_forward", ignore=True), "")
14
-
15
     def test_assign_proc_sys_failed(self):
16
         """
17
         Tests if /proc/sys/<kernel-subsystem> exists or not
18
@@ -93,19 +85,6 @@ class LinuxSysctlTestCase(TestCase, LoaderModuleMockMi
19
             mock_cmd = MagicMock(return_value=cmd)
20
             with patch.dict(linux_sysctl.__salt__, {"cmd.run_all": mock_cmd}):
21
                 self.assertEqual(linux_sysctl.assign("net.ipv4.ip_forward", 1), ret)
22
-
23
-    def test_assign_ignore(self):
24
-        """
25
-        Tests the ignore assign function
26
-        """
27
-        with patch("os.path.exists", MagicMock(return_value=True)):
28
-            cmd = {"pid": 1337, "retcode": 0, "stderr": "", "stdout": ""}
29
-            ret = {"net.ipv4.ip_forward": "ignored"}
30
-            mock_cmd = MagicMock(return_value=cmd)
31
-            with patch.dict(linux_sysctl.__salt__, {"cmd.run_all": mock_cmd}):
32
-                self.assertEqual(
33
-                    linux_sysctl.assign("net.ipv4.ip_forward", 1, ignore=True), ret
34
-                )
35
 
36
     def test_persist_no_conf_failure(self):
37
         """
(-)b/sysutils/py-salt/files/patch-tests_unit_states_test__sysctl.py (-1 / +21 lines)
Added Link Here
0
- 
1
--- tests/unit/states/test_sysctl.py.orig	2020-06-17 18:05:55 UTC
2
+++ tests/unit/states/test_sysctl.py
3
@@ -68,8 +68,6 @@ class SysctlTestCase(TestCase, LoaderModuleMockMixin):
4
 
5
         comt7 = "Sysctl value {0} = {1} is already set".format(name, value)
6
 
7
-        comt8 = "Sysctl value {0} = {1} was ignored".format(name, value)
8
-
9
         def mock_current(config_file=None):
10
             """
11
             Mock return value for __salt__.
12
@@ -136,9 +134,4 @@ class SysctlTestCase(TestCase, LoaderModuleMockMixin):
13
             mock = MagicMock(return_value="Already set")
14
             with patch.dict(sysctl.__salt__, {"sysctl.persist": mock}):
15
                 ret.update({"comment": comt7, "result": True})
16
-                self.assertDictEqual(sysctl.present(name, value), ret)
17
-
18
-            mock = MagicMock(return_value="Ignored")
19
-            with patch.dict(sysctl.__salt__, {"sysctl.persist": mock}):
20
-                ret.update({"comment": comt8, "result": True})
21
                 self.assertDictEqual(sysctl.present(name, value), ret)

Return to bug 247627