SHA256
1
0
forked from pool/salt

Accepting request 438684 from systemsmanagement:saltstack:testing

- Update to 2016.3.4
  see https://docs.saltstack.com/en/latest/topics/releases/2016.3.4.html
- Removed Patches, applied upstream
  * 0008-checksum-validation-when-zypper-pkg.download.patch
  * 0009-unit-tests-for-rpm.checksum-and-zypper.download.patch
  * 0010-snapper-execution-module.patch
  * 0011-fix-salt-summary-to-count-not-responding-minions-cor.patch
  * 0012-Run-salt-api-as-user-salt-bsc-990029.patch
  * 0013-Deprecate-status.uptime-one-version-later.patch
  * 0014-Add-ignore_repo_failure-option-to-suppress-zypper-s-.patch
  * 0015-Remove-zypper-s-raise-exception-if-mod_repo-has-no-a.patch
  * 0016-Improve-Mock-to-be-flexible-and-able-to-mock-methods.patch
  * 0017-Check-for-single-quote-before-splitting-on-single-qu.patch
  * 0018-Unit-tests-fixes-for-2016.3.2.patch
  * 0019-Fix-snapper_test-for-python26.patch
  * 0020-Integration-tests-fixes-for-2016.3.2.patch
  * 0021-Fix-pkg.upgrade-for-zypper.patch
  * 0022-Setting-up-OS-grains-for-SLES-Expanded-Support-SUSE-.patch
  * 0023-acl.delfacl-fix-position-of-X-option-to-setfacl.patch
  * 0024-Change-travis-configuration-file-to-use-salt-toaster.patch
  * 0025-Adding-dist-upgrade-support-to-zypper-module.patch
  * 0026-Fix-pkg.latest_version-when-latest-already-installed.patch
  * 0027-Including-resolver-params-for-Zypper-debug-solver.patch
- Added patches
  * 0008-snapper-execution-module.patch
  * 0009-fix-salt-summary-to-count-not-responding-minions-cor.patch
  * 0010-Run-salt-api-as-user-salt-bsc-990029.patch
  * 0011-Fix-snapper_test-for-python26.patch
  * 0012-Fix-pkg.upgrade-for-zypper.patch
  * 0013-Setting-up-OS-grains-for-SLES-Expanded-Support-SUSE-.patch

OBS-URL: https://build.opensuse.org/request/show/438684
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=81
This commit is contained in:
Klaus Kämpf 2016-11-06 11:48:16 +00:00 committed by Git OBS Bridge
parent 1bf3f65f87
commit 44f6a131de
34 changed files with 607 additions and 1557 deletions

View File

@ -1,7 +1,7 @@
From 3f8257601cb1224221e10e712c0377254714f6fc Mon Sep 17 00:00:00 2001
From 945e87477d66ada90e914e95acd5ff529477012a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Wed, 20 Jan 2016 11:00:15 +0100
Subject: [PATCH 01/13] tserong@suse.com -- We don't have python-systemd, so
Subject: [PATCH 01/17] tserong@suse.com -- We don't have python-systemd, so
notify can't work
---
@ -9,7 +9,7 @@ Subject: [PATCH 01/13] tserong@suse.com -- We don't have python-systemd, so
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/pkg/salt-master.service b/pkg/salt-master.service
index 0eadf88a3837..2b0f32623571 100644
index 1f4650f..59be503 100644
--- a/pkg/salt-master.service
+++ b/pkg/salt-master.service
@@ -4,8 +4,7 @@ After=network.target
@ -20,8 +20,8 @@ index 0eadf88a3837..2b0f32623571 100644
-NotifyAccess=all
+Type=simple
ExecStart=/usr/bin/salt-master
KillMode=process
[Install]
--
2.8.3
2.10.1

View File

@ -1,7 +1,7 @@
From e86b0bf279c7faea457dfb8152fe9f5c829e42be Mon Sep 17 00:00:00 2001
From e5db5dcfecab4f1d2e93386ad8c7e579393280d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <kkaempf@suse.de>
Date: Wed, 20 Jan 2016 11:01:06 +0100
Subject: [PATCH 02/13] Run salt master as dedicated salt user
Subject: [PATCH 02/17] Run salt master as dedicated salt user
---
conf/master | 3 ++-
@ -9,7 +9,7 @@ Subject: [PATCH 02/13] Run salt master as dedicated salt user
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/conf/master b/conf/master
index 1bbeb50c51b4..54d5f8f3ca75 100644
index ed09126..ee98e51 100644
--- a/conf/master
+++ b/conf/master
@@ -25,7 +25,8 @@
@ -23,7 +23,7 @@ index 1bbeb50c51b4..54d5f8f3ca75 100644
# The port used by the communication interface. The ret (return) port is the
# interface used for the file server, authentication, job returns, etc.
diff --git a/pkg/salt-common.logrotate b/pkg/salt-common.logrotate
index 3cd002308e83..8d970c0a64d0 100644
index 3cd0023..8d970c0 100644
--- a/pkg/salt-common.logrotate
+++ b/pkg/salt-common.logrotate
@@ -1,4 +1,5 @@
@ -49,5 +49,5 @@ index 3cd002308e83..8d970c0a64d0 100644
missingok
rotate 7
--
2.8.3
2.10.1

View File

@ -1,7 +1,7 @@
From cad9f1a8fda2a4d8c666abcf74e03e7c6a8eb6be Mon Sep 17 00:00:00 2001
From 166ee0f5747234024a89a0a68667dec5db98cac7 Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de>
Date: Mon, 18 Jan 2016 16:28:48 +0100
Subject: [PATCH 03/12] Check if byte strings are properly encoded in UTF-8
Subject: [PATCH 03/17] Check if byte strings are properly encoded in UTF-8
Rename keywords arguments variable to a default name.
---
@ -9,10 +9,10 @@ Rename keywords arguments variable to a default name.
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 7dd73dd..92c604e 100644
index f3e9d68..b2a4e0b 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -335,9 +335,9 @@ def info_installed(*names, **kwargs):
@@ -360,9 +360,9 @@ def info_installed(*names, **kwargs):
summary, description.
:param errors:
@ -25,7 +25,7 @@ index 7dd73dd..92c604e 100644
Valid attributes are:
ignore, report
@@ -350,7 +350,8 @@ def info_installed(*names, **kwargs):
@@ -375,7 +375,8 @@ def info_installed(*names, **kwargs):
salt '*' pkg.info_installed <package1> <package2> <package3> ...
salt '*' pkg.info_installed <package1> attr=version,vendor
salt '*' pkg.info_installed <package1> <package2> <package3> ... attr=version,vendor
@ -35,7 +35,7 @@ index 7dd73dd..92c604e 100644
'''
ret = dict()
for pkg_name, pkg_nfo in __salt__['lowpkg.info'](*names, **kwargs).items():
@@ -361,7 +362,7 @@ def info_installed(*names, **kwargs):
@@ -386,7 +387,7 @@ def info_installed(*names, **kwargs):
# Check, if string is encoded in a proper UTF-8
value_ = value.decode('UTF-8', 'ignore').encode('UTF-8', 'ignore')
if value != value_:
@ -45,5 +45,5 @@ index 7dd73dd..92c604e 100644
if key == 'source_rpm':
t_nfo['source'] = value
--
2.9.2
2.10.1

View File

@ -1,7 +1,7 @@
From a831380a6d7f323c9824d26d6f6e5966b10cbc6e Mon Sep 17 00:00:00 2001
From c52d045e4b292baf95e68b6c61c6162d536cf500 Mon Sep 17 00:00:00 2001
From: Michael Calmer <mc@suse.de>
Date: Fri, 4 Mar 2016 09:51:22 +0100
Subject: [PATCH 04/13] do not generate a date in a comment to prevent rebuilds
Subject: [PATCH 04/17] do not generate a date in a comment to prevent rebuilds
(bsc#969407)
---
@ -9,10 +9,10 @@ Subject: [PATCH 04/13] do not generate a date in a comment to prevent rebuilds
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/setup.py b/setup.py
index c84c19824a6f..819ec2b875d1 100755
index c0fd278..dbcccb6 100755
--- a/setup.py
+++ b/setup.py
@@ -618,8 +618,7 @@ class Clean(clean):
@@ -659,8 +659,7 @@ class Clean(clean):
INSTALL_VERSION_TEMPLATE = '''\
@ -23,5 +23,5 @@ index c84c19824a6f..819ec2b875d1 100755
from salt.version import SaltStackVersion
--
2.8.3
2.10.1

View File

@ -1,7 +1,7 @@
From 03732c6879c45596b0a9a0e6500957ec4f9d8415 Mon Sep 17 00:00:00 2001
From 7854a6cd0ddc5a7d51f298e69b54eec09ce97c14 Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de>
Date: Thu, 17 Mar 2016 12:30:23 +0100
Subject: [PATCH 05/12] Use SHA256 hash type by default
Subject: [PATCH 05/17] Use SHA256 hash type by default
---
conf/master | 2 +-
@ -10,7 +10,7 @@ Subject: [PATCH 05/12] Use SHA256 hash type by default
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/conf/master b/conf/master
index 8bbe490..118f53b 100644
index ee98e51..6ef1c10 100644
--- a/conf/master
+++ b/conf/master
@@ -509,7 +509,7 @@ syndic_user: salt
@ -23,10 +23,10 @@ index 8bbe490..118f53b 100644
# The buffer size in the file server can be adjusted here:
#file_buffer_size: 1048576
diff --git a/conf/minion b/conf/minion
index 3ba8ba0..8e4dbd0 100644
index 9bc9408..07b706f 100644
--- a/conf/minion
+++ b/conf/minion
@@ -542,7 +542,7 @@
@@ -559,7 +559,7 @@
#
# Warning: Prior to changing this value, the minion should be stopped and all
# Salt caches should be cleared.
@ -36,10 +36,10 @@ index 3ba8ba0..8e4dbd0 100644
# The Salt pillar is searched for locally if file_client is set to local. If
# this is the case, and pillar data is defined, then the pillar_roots need to
diff --git a/conf/proxy b/conf/proxy
index 7b835e2..ab500f9 100644
index 4e5cc34..8e5dd2d 100644
--- a/conf/proxy
+++ b/conf/proxy
@@ -435,7 +435,7 @@
@@ -445,7 +445,7 @@
#
# Warning: Prior to changing this value, the minion should be stopped and all
# Salt caches should be cleared.
@ -49,5 +49,5 @@ index 7b835e2..ab500f9 100644
# The Salt pillar is searched for locally if file_client is set to local. If
# this is the case, and pillar data is defined, then the pillar_roots need to
--
2.9.2
2.10.1

View File

@ -1,7 +1,7 @@
From 46476c37aa00d9cbbd0ac58e56b7e1c134d33b13 Mon Sep 17 00:00:00 2001
From 57f9c9cb438f13475ca437252770dc8d365d96cd Mon Sep 17 00:00:00 2001
From: Christian McHugh <mchugh19@hotmail.com>
Date: Thu, 10 Mar 2016 13:25:01 -0600
Subject: [PATCH 06/13] Create salt-proxy instantiated service file
Subject: [PATCH 06/17] Create salt-proxy instantiated service file
Add a systemd service file for salt-proxy.
@ -15,7 +15,7 @@ Instantiate a new proxy service with proxyid=p8000:
diff --git a/pkg/salt-proxy@.service b/pkg/salt-proxy@.service
new file mode 100644
index 000000000000..f97120a05589
index 0000000..f97120a
--- /dev/null
+++ b/pkg/salt-proxy@.service
@@ -0,0 +1,12 @@
@ -32,5 +32,5 @@ index 000000000000..f97120a05589
+[Install]
+WantedBy=multi-user.target
--
2.8.3
2.10.1

View File

@ -1,7 +1,7 @@
From c0aacf83fa51015fb6e50ab96204a7b3c31413a8 Mon Sep 17 00:00:00 2001
From 484b0fa0250b4adc0da34d033ebc5e019e3e1240 Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de>
Date: Mon, 9 May 2016 10:33:44 +0200
Subject: [PATCH 07/21] Add zypp-notify plugin
Subject: [PATCH 07/17] Add zypp-notify plugin
* Add unit test to the libzypp drift detector plugin
---
@ -217,5 +217,5 @@ index 0000000..218f703
+ '''
+ self.closed = True
--
2.10.0
2.10.1

View File

@ -1,43 +0,0 @@
From c80528b9aad5305b06a07cadf752a45392d4a147 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Tue, 24 May 2016 11:01:55 +0100
Subject: [PATCH 08/12] checksum validation when zypper pkg.download
check the signature of downloaded RPM files
bugfix: showing errors when a package download fails using zypper pkg.download
Renamed check_sig to checksum and some refactoring
simpler rpm.checksum function
---
salt/modules/zypper.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 92c604e..547d72b 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -1596,14 +1596,17 @@ def download(*packages, **kwargs):
pkg_ret = {}
for dld_result in __zypper__.xml.call('download', *packages).getElementsByTagName("download-result"):
repo = dld_result.getElementsByTagName("repository")[0]
+ path = dld_result.getElementsByTagName("localfile")[0].getAttribute("path")
pkg_info = {
'repository-name': repo.getAttribute('name'),
'repository-alias': repo.getAttribute('alias'),
+ 'path': path,
}
key = _get_first_aggregate_text(
dld_result.getElementsByTagName('name')
)
- pkg_ret[key] = pkg_info
+ if __salt__['lowpkg.checksum'](pkg_info['path']):
+ pkg_ret[key] = pkg_info
if pkg_ret:
failed = [pkg for pkg in packages if pkg not in pkg_ret]
--
2.8.2

View File

@ -1,7 +1,7 @@
From 501eda9c64b6e8b4b66c0bf98592331248742ea0 Mon Sep 17 00:00:00 2001
From 7ea96fd6c6b9b7c5a461aae7f5b8487e54d41dc6 Mon Sep 17 00:00:00 2001
From: Pablo Suarez Hernandez <psuarezhernandez@suse.com>
Date: Mon, 4 Jul 2016 16:26:33 +0100
Subject: [PATCH 10/12] snapper execution module
Subject: [PATCH 08/17] snapper execution module
snapper state module
@ -1274,5 +1274,5 @@ index 0000000..f27b2ba
+ from integration import run_tests
+ run_tests(SnapperTestCase, needs_daemon=False)
--
2.9.2
2.10.1

View File

@ -1,7 +1,7 @@
From e3969a80bdf2d0af0c87463af859d8daf314f018 Mon Sep 17 00:00:00 2001
From e915b72abc48bfa3b3a511c3803153fa44cace23 Mon Sep 17 00:00:00 2001
From: Michael Calmer <mc@suse.de>
Date: Tue, 21 Jun 2016 13:12:48 +0200
Subject: [PATCH 11/12] fix salt --summary to count not responding minions
Subject: [PATCH 09/17] fix salt --summary to count not responding minions
correctly (bsc#972311)
In case a minion is not responding a dict is returned instead of a string.
@ -10,7 +10,7 @@ In case a minion is not responding a dict is returned instead of a string.
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/salt/cli/salt.py b/salt/cli/salt.py
index baeaf23..ec18f2e 100644
index 6b18b6f..2fea2f3 100644
--- a/salt/cli/salt.py
+++ b/salt/cli/salt.py
@@ -264,7 +264,9 @@ class SaltCMD(parsers.SaltCMDOptionParser):
@ -25,5 +25,5 @@ index baeaf23..ec18f2e 100644
isinstance(minion_ret, string_types)
and minion_ret.startswith("Minion did not return")
--
2.9.2
2.10.1

View File

@ -1,26 +0,0 @@
From f186137c0eb7a14697037bf46ec6a12287b9e0c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Wed, 25 May 2016 17:08:16 +0100
Subject: [PATCH 09/12] unit tests for rpm.checksum() and zypper.download()
lint issue fixed
---
tests/unit/modules/zypper_test.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/unit/modules/zypper_test.py b/tests/unit/modules/zypper_test.py
index 308bf94..2f2b323 100644
--- a/tests/unit/modules/zypper_test.py
+++ b/tests/unit/modules/zypper_test.py
@@ -387,6 +387,7 @@ class ZypperTestCase(TestCase):
test_out = {
'nmap': {
+ 'path': u'/var/cache/zypp/packages/SLE-12-x86_64-Pool/x86_64/nmap-6.46-1.72.x86_64.rpm',
'repository-alias': u'SLE-12-x86_64-Pool',
'repository-name': u'SLE-12-x86_64-Pool'
}
--
2.9.2

View File

@ -0,0 +1,27 @@
From e955cae5e0ba5fb5348edad433a01f11f1ca887a Mon Sep 17 00:00:00 2001
From: Michael Calmer <mc@suse.de>
Date: Fri, 29 Jul 2016 10:50:21 +0200
Subject: [PATCH 10/17] Run salt-api as user salt (bsc#990029)
---
pkg/salt-api.service | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pkg/salt-api.service b/pkg/salt-api.service
index c3e67d5..9be2cb8 100644
--- a/pkg/salt-api.service
+++ b/pkg/salt-api.service
@@ -3,8 +3,8 @@ Description=The Salt API
After=network.target
[Service]
-Type=notify
-NotifyAccess=all
+User=salt
+Type=simple
LimitNOFILE=8192
ExecStart=/usr/bin/salt-api
TimeoutStopSec=3
--
2.10.1

View File

@ -1,7 +1,7 @@
From df1f88c51a40e69935830d1664a46dadf514dc69 Mon Sep 17 00:00:00 2001
From 65d1dc94577e9bdbaa6c55f7057a78b2fe6010a7 Mon Sep 17 00:00:00 2001
From: Justin Anderson <janderson@saltstack.com>
Date: Tue, 23 Aug 2016 15:02:31 -0600
Subject: [PATCH 19/19] Fix snapper_test for python26
Subject: [PATCH 11/17] Fix snapper_test for python26
* Use assertCountEqual instead of assertItemsEqual for Python 3
* Skip one Snapper test on 2.6
@ -109,5 +109,5 @@ index f27b2ba..43f8898 100644
fopen_effect = [
mock_open(read_data=FILE_CONTENT["/tmp/foo"]['pre']).return_value,
--
2.8.2
2.10.1

View File

@ -0,0 +1,33 @@
From 956c7636a7cd83de6afb80b1cd9f0621419497c5 Mon Sep 17 00:00:00 2001
From: "C. R. Oldham" <cro@ncbt.org>
Date: Wed, 21 Sep 2016 20:05:33 -0600
Subject: [PATCH 12/17] Fix pkg.upgrade for zypper
---
salt/modules/zypper.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index b2a4e0b..49ce5ec 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -1146,7 +1146,7 @@ def upgrade(refresh=True,
if dryrun:
# Creates a solver test case for debugging.
log.info('Executing debugsolver and performing a dry-run dist-upgrade')
- __zypper__.noraise.call(*cmd_update + ['--debug-solver'])
+ __zypper__(systemd_scope=_systemd_scope()).noraise.call(*cmd_update + ['--debug-solver'])
if fromrepo:
for repo in fromrepo:
@@ -1167,6 +1167,7 @@ def upgrade(refresh=True,
old = list_pkgs()
__zypper__(systemd_scope=_systemd_scope()).noraise.call(*cmd_update)
+
if __zypper__.exit_code not in __zypper__.SUCCESS_EXIT_CODES:
ret['result'] = False
else:
--
2.10.1

View File

@ -1,24 +0,0 @@
From af2ff55739187c59dc04e396b7787301a49a9dba Mon Sep 17 00:00:00 2001
From: Michael Calmer <mc@suse.de>
Date: Fri, 29 Jul 2016 10:50:21 +0200
Subject: [PATCH 12/12] Run salt-api as user salt (bsc#990029)
---
pkg/salt-api.service | 1 +
1 file changed, 1 insertion(+)
diff --git a/pkg/salt-api.service b/pkg/salt-api.service
index 72379ba..9be2cb8 100644
--- a/pkg/salt-api.service
+++ b/pkg/salt-api.service
@@ -3,6 +3,7 @@ Description=The Salt API
After=network.target
[Service]
+User=salt
Type=simple
LimitNOFILE=8192
ExecStart=/usr/bin/salt-api
--
2.9.2

View File

@ -1,25 +0,0 @@
From d19c9591c1dfbafec24a7d76402dcc9e2b17b047 Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de>
Date: Thu, 4 Aug 2016 11:28:19 +0200
Subject: [PATCH 13/13] Deprecate status.uptime one version later
---
salt/modules/status.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/salt/modules/status.py b/salt/modules/status.py
index 029426b..cebd57b 100644
--- a/salt/modules/status.py
+++ b/salt/modules/status.py
@@ -132,7 +132,7 @@ def custom():
return ret
-@with_deprecated(globals(), "Boron")
+@with_deprecated(globals(), "Carbon")
def uptime():
'''
Return the uptime for this system.
--
2.9.2

View File

@ -0,0 +1,35 @@
From 84bacc068ff10b33b5bd984459d6cfb73b1bf2c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Fri, 30 Sep 2016 13:06:52 +0100
Subject: [PATCH 13/17] Setting up OS grains for SLES Expanded Support (SUSE's
Red Hat compatible platform)
core.py: quote style fixed
---
salt/grains/core.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/salt/grains/core.py b/salt/grains/core.py
index 867924a..12a2959 100644
--- a/salt/grains/core.py
+++ b/salt/grains/core.py
@@ -1038,6 +1038,7 @@ _OS_NAME_MAP = {
'manjaro': 'Manjaro',
'antergos': 'Antergos',
'sles': 'SUSE',
+ 'slesexpand': 'RES',
'linuxmint': 'Mint',
}
@@ -1057,6 +1058,7 @@ _OS_FAMILY_MAP = {
'OEL': 'RedHat',
'XCP': 'RedHat',
'XenServer': 'RedHat',
+ 'RES': 'RedHat',
'Mandrake': 'Mandriva',
'ESXi': 'VMWare',
'Mint': 'Debian',
--
2.10.1

View File

@ -1,82 +0,0 @@
From f860f7ccb3dba6b8f0cef61e2d9658a3116e3c3c Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de>
Date: Mon, 15 Aug 2016 15:03:53 +0200
Subject: [PATCH 14/15] Add ignore_repo_failure option to suppress zypper's
exit code 106 on unavailable repos
---
salt/modules/zypper.py | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 547d72b..1c60f0f 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -100,6 +100,18 @@ class _Zypper(object):
self.__no_lock = False
self.__no_raise = False
self.__refresh = False
+ self.__ignore_repo_failure = False
+
+ def __call__(self, *args, **kwargs):
+ '''
+ :param args:
+ :param kwargs:
+ :return:
+ '''
+ # Ignore exit code for 106 (repo is not available)
+ if 'no_repo_failure' in kwargs:
+ self.__ignore_repo_failure = kwargs['no_repo_failure']
+ return self
def __getattr__(self, item):
'''
@@ -275,7 +287,7 @@ class _Zypper(object):
__salt__['event.fire_master']({'success': not len(self.error_msg),
'info': self.error_msg or 'Zypper has been released'},
self.TAG_RELEASED)
- if self.error_msg and not self.__no_raise:
+ if self.error_msg and not self.__no_raise and not self.__ignore_repo_failure:
raise CommandExecutionError('Zypper command failure: {0}'.format(self.error_msg))
return self._is_xml_mode() and dom.parseString(self.__call_result['stdout']) or self.__call_result['stdout']
@@ -863,6 +875,7 @@ def install(name=None,
downloadonly=None,
skip_verify=False,
version=None,
+ ignore_repo_failure=False,
**kwargs):
'''
Install the passed package(s), add refresh=True to force a 'zypper refresh'
@@ -929,6 +942,10 @@ def install(name=None,
salt '*' pkg.install sources='[{"foo": "salt://foo.rpm"},{"bar": "salt://bar.rpm"}]'
+ ignore_repo_failure
+ Zypper returns error code 106 if one of the repositories are not available for various reasons.
+ In case to set strict check, this parameter needs to be set to True. Default: False.
+
Returns a dict containing the new package names and versions::
@@ -1000,7 +1017,7 @@ def install(name=None,
while targets:
cmd = cmd_install + targets[:500]
targets = targets[500:]
- for line in __zypper__.call(*cmd).splitlines():
+ for line in __zypper__(no_repo_failure=ignore_repo_failure).call(*cmd).splitlines():
match = re.match(r"^The selected package '([^']+)'.+has lower version", line)
if match:
downgrades.append(match.group(1))
@@ -1008,7 +1025,7 @@ def install(name=None,
while downgrades:
cmd = cmd_install + ['--force'] + downgrades[:500]
downgrades = downgrades[500:]
- __zypper__.call(*cmd)
+ __zypper__(no_repo_failure=ignore_repo_failure).call(*cmd)
__context__.pop('pkg.list_pkgs', None)
new = list_pkgs()
--
2.9.3

View File

@ -0,0 +1,42 @@
From 3da08fe5187b0a7279b0fe6d24f969bfe1026e7a Mon Sep 17 00:00:00 2001
From: Joerg Reuter <jreuter@yaina.de>
Date: Wed, 12 Oct 2016 13:02:38 +0200
Subject: [PATCH 14/17] - acl.delfacl: fix position of -X option to setfacl
Adjust linux_acl unit test argument ordering
---
salt/modules/linux_acl.py | 4 +++-
tests/unit/modules/linux_acl_test.py | 2 +-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/salt/modules/linux_acl.py b/salt/modules/linux_acl.py
index c23bc8c..0f5c874 100644
--- a/salt/modules/linux_acl.py
+++ b/salt/modules/linux_acl.py
@@ -250,10 +250,12 @@ def delfacl(acl_type, acl_name='', *args, **kwargs):
_raise_on_no_files(*args)
- cmd = 'setfacl -x'
+ cmd = 'setfacl'
if recursive:
cmd += ' -R'
+ cmd += ' -x'
+
cmd = '{0} {1}:{2}'.format(cmd, _acl_prefix(acl_type), acl_name)
for dentry in args:
diff --git a/tests/unit/modules/linux_acl_test.py b/tests/unit/modules/linux_acl_test.py
index 1398636..36d3202 100644
--- a/tests/unit/modules/linux_acl_test.py
+++ b/tests/unit/modules/linux_acl_test.py
@@ -193,4 +193,4 @@ class LinuxAclTestCase(TestCase):
def test_delfacl__recursive_w_multiple_args(self):
linux_acl.delfacl(*(self.default_user_acl[:-1] + self.files), recursive=True)
- self.cmdrun.assert_called_once_with('setfacl -x -R ' + ' '.join([self.default_user_acl_cmd.rpartition(':')[0]] + self.files), python_shell=False)
+ self.cmdrun.assert_called_once_with('setfacl -R -x ' + ' '.join([self.default_user_acl_cmd.rpartition(':')[0]] + self.files), python_shell=False)
--
2.10.1

View File

@ -0,0 +1,71 @@
From f212d9ae3ecca09808de8a770b1099d94189a2df Mon Sep 17 00:00:00 2001
From: Mihai Dinca <mdinca@suse.de>
Date: Fri, 14 Oct 2016 09:04:47 +0200
Subject: [PATCH 15/17] Change travis configuration file to use salt-toaster
---
.travis.yml | 47 +++++++++++++++++++----------------------------
1 file changed, 19 insertions(+), 28 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 7b4c8ce..3101efb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,35 +1,26 @@
language: python
python:
- - '2.6'
- - '2.7'
+ - 2.7
-before_install:
- - sudo apt-get update
- - sudo apt-get install --fix-broken --ignore-missing -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" swig rabbitmq-server ruby python-apt mysql-server libmysqlclient-dev
- - (git describe && git fetch --tags) || (git remote add upstream git://github.com/saltstack/salt.git && git fetch --tags upstream)
- - pip install mock
- - pip install --allow-external http://dl.dropbox.com/u/174789/m2crypto-0.20.1.tar.gz
- - pip install --upgrade pep8 'pylint<=1.2.0'
- - pip install --upgrade coveralls
- - "if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2 ordereddict; fi"
- - pip install git+https://github.com/saltstack/salt-testing.git#egg=SaltTesting
-
-install:
- - pip install -r requirements/zeromq.txt -r requirements/cloud.txt
- - pip install --allow-all-external -r requirements/opt.txt
+services:
+ - docker
-before_script:
- - "/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pylint --rcfile=.testing.pylintrc salt/ && echo 'Finished Pylint Check Cleanly' || echo 'Finished Pylint Check With Errors'"
- - "/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pep8 --ignore=E501,E12 salt/ && echo 'Finished PEP-8 Check Cleanly' || echo 'Finished PEP-8 Check With Errors'"
+env:
+ global:
+ - VERSION=leap42sp1 FLAVOR=devel NOPULL=true SALT_REPO=..
+ matrix:
+ - TARGET=suse.tests PYTEST_CFG=./configs/$TARGET/$VERSION/$FLAVOR.cfg
+ - TARGET=saltstack.unit PYTEST_CFG=./configs/$TARGET/$VERSION/default.cfg
+ - TARGET=saltstack.integration PYTEST_CFG=./configs/$TARGET/$VERSION/default.cfg
-script: "sudo -E /home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/python setup.py test --runtests-opts='--run-destructive --sysinfo -v --coverage'"
-
-after_success:
- - coveralls
+before_install:
+- git clone --depth 1 https://github.com/openSUSE/salt-toaster.git
+- cd salt-toaster
+- echo "*" > .gitignore
+- tar xfz sandbox.tar.gz
+- sandbox/bin/pip install -r requirements.txt --exists-action w --upgrade
+- VERSION=leap42sp1 FLAVOR=default NOPULL=true make build_image
+- make build_image
-notifications:
- irc:
- channels: "irc.freenode.org#salt-devel"
- on_success: change
- on_failure: change
+script: make $TARGET PYTEST_CFG=$PYTEST_CFG
--
2.10.1

View File

@ -1,78 +0,0 @@
From 0809c60c693eb5d2e9569c24d995818097c6920d Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de>
Date: Mon, 15 Aug 2016 17:35:01 +0200
Subject: [PATCH 15/15] Remove zypper's raise exception if mod_repo has no
arguments and/or no changes
* Fix Unit test for suppressing the exception removal on non-modified repos
---
salt/modules/zypper.py | 11 +++++++----
tests/unit/modules/zypper_test.py | 15 +++------------
2 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 1c60f0f..1ec903e 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -824,6 +824,7 @@ def mod_repo(repo, **kwargs):
cmd_opt = global_cmd_opt + ['mr'] + cmd_opt + [repo]
__zypper__.refreshable.xml.call(*cmd_opt)
+ comment = None
if call_refresh:
# when used with "zypper ar --refresh" or "zypper mr --refresh"
# --gpg-auto-import-keys is not doing anything
@@ -831,11 +832,13 @@ def mod_repo(repo, **kwargs):
refresh_opts = global_cmd_opt + ['refresh'] + [repo]
__zypper__.xml.call(*refresh_opts)
elif not added and not cmd_opt:
- raise CommandExecutionError(
- 'Specified arguments did not result in modification of repo'
- )
+ comment = 'Specified arguments did not result in modification of repo'
+
+ repo = get_repo(repo)
+ if comment:
+ repo['comment'] = comment
- return get_repo(repo)
+ return repo
def refresh_db():
diff --git a/tests/unit/modules/zypper_test.py b/tests/unit/modules/zypper_test.py
index 2f2b323..7caa707 100644
--- a/tests/unit/modules/zypper_test.py
+++ b/tests/unit/modules/zypper_test.py
@@ -73,7 +73,7 @@ class ZypperTestCase(TestCase):
self.zypper_patcher_config = {
'_get_configured_repos': Mock(side_effect=side_effect),
'__zypper__': Mock(),
- 'get_repo': Mock()
+ 'get_repo': Mock(return_value={})
}
def test_list_upgrades(self):
@@ -493,17 +493,8 @@ class ZypperTestCase(TestCase):
'salt.modules.zypper', **self.zypper_patcher_config)
with zypper_patcher:
- with self.assertRaisesRegexp(
- Exception,
- 'Specified arguments did not result in modification of repo'
- ):
- zypper.mod_repo(name, **{'url': url})
- with self.assertRaisesRegexp(
- Exception,
- 'Specified arguments did not result in modification of repo'
- ):
- zypper.mod_repo(name, **{'url': url, 'gpgautoimport': 'a'})
-
+ self.assertEqual(zypper.mod_repo(name, **{'url': url}),
+ {'comment': 'Specified arguments did not result in modification of repo'})
zypper.__zypper__.xml.call.assert_not_called()
zypper.__zypper__.refreshable.xml.call.assert_not_called()
--
2.9.3

View File

@ -0,0 +1,99 @@
From db37086d3322aeba397ed7f66925b51fc61f4fca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Tue, 18 Oct 2016 14:14:42 +0100
Subject: [PATCH 16/18] Adding 'dist-upgrade' support to zypper module
* Unit tests for zypper upgrade and dist-upgrade
* Refactor: Cleanup and pylint fixes
* Fix in log message
* Adds multiple repositories support to 'fromrepo' parameter
* Improves 'dryrun' outputting. Setting 'novendorchange' as not supported for SLE11
* Unit tests fixes
* Minor pylint fixes
* Disables 'novendorchange' for old SLEs versions
---
salt/modules/zypper.py | 45 ++++++++++++++++++++++++++++-----------------
1 file changed, 28 insertions(+), 17 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 49ce5ecc5409..d1febee73597 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -1072,34 +1072,25 @@ def install(name=None,
def upgrade(refresh=True,
+ skip_verify=False,
dryrun=False,
dist_upgrade=False,
fromrepo=None,
novendorchange=False,
- skip_verify=False,
**kwargs): # pylint: disable=unused-argument
'''
- .. versionchanged:: 2015.8.12,2016.3.3,Carbon
- On minions running systemd>=205, `systemd-run(1)`_ is now used to
- isolate commands which modify installed packages from the
- ``salt-minion`` daemon's control group. This is done to keep systemd
- from killing any zypper commands spawned by Salt when the
- ``salt-minion`` service is restarted. (see ``KillMode`` in the
- `systemd.kill(5)`_ manpage for more information). If desired, usage of
- `systemd-run(1)`_ can be suppressed by setting a :mod:`config option
- <salt.modules.config.get>` called ``systemd.scope``, with a value of
- ``False`` (no quotes).
-
- .. _`systemd-run(1)`: https://www.freedesktop.org/software/systemd/man/systemd-run.html
- .. _`systemd.kill(5)`: https://www.freedesktop.org/software/systemd/man/systemd.kill.html
-
Run a full system upgrade, a zypper upgrade
+ Options:
+
refresh
force a refresh if set to True (default).
If set to False it depends on zypper if a refresh is
executed.
+ skip_verify
+ Skip the GPG verification check (e.g., ``--no-gpg-checks``)
+
dryrun
If set to True, it creates a debug solver log file and then perform
a dry-run upgrade (no changes are made). Default: False
@@ -1164,10 +1155,30 @@ def upgrade(refresh=True,
if skip_verify:
cmd_update.append('--no-gpg-checks')
- old = list_pkgs()
+ if dryrun:
+ cmd_update.append('--dry-run')
- __zypper__(systemd_scope=_systemd_scope()).noraise.call(*cmd_update)
+ if dist_upgrade:
+ if dryrun:
+ # Creates a solver test case for debugging.
+ log.info('Executing debugsolver and performing a dry-run dist-upgrade')
+ __zypper__.noraise.call(*cmd_update + ['--debug-solver'])
+
+ if fromrepo:
+ for repo in fromrepo:
+ cmd_update.extend(['--from', repo])
+ log.info('Targeting repos: {0!r}'.format(fromrepo))
+ if novendorchange:
+ # TODO: Grains validation should be moved to Zypper class
+ if __grains__['osrelease_info'][0] > 11:
+ cmd_update.append('--no-allow-vendor-change')
+ log.info('Disabling vendor changes')
+ else:
+ log.warn('Disabling vendor changes is not supported on this Zypper version')
+
+ old = list_pkgs()
+ __zypper__(systemd_scope=_systemd_scope()).noraise.call(*cmd_update)
if __zypper__.exit_code not in __zypper__.SUCCESS_EXIT_CODES:
ret['result'] = False
else:
--
2.10.1

View File

@ -0,0 +1,25 @@
From b784cb1d2dd3b190e8664c2a40e8d3c55ad4ad03 Mon Sep 17 00:00:00 2001
From: Mihai Dinca <mdinca@suse.de>
Date: Fri, 21 Oct 2016 16:25:04 +0200
Subject: [PATCH 16/17] Fix pkg.latest_version when latest already installed
---
salt/states/pkg.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/salt/states/pkg.py b/salt/states/pkg.py
index 8492de7..9cecc07 100644
--- a/salt/states/pkg.py
+++ b/salt/states/pkg.py
@@ -1679,7 +1679,7 @@ def latest(
targets = {}
problems = []
for pkg in desired_pkgs:
- if not avail[pkg]:
+ if not avail.get(pkg):
# Package either a) is up-to-date, or b) does not exist
if not cur[pkg]:
# Package does not exist
--
2.10.1

View File

@ -1,83 +0,0 @@
From 50865e300e6e90c5cc80c8878949a2f3bcaaeeec Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de>
Date: Thu, 25 Aug 2016 16:47:08 +0200
Subject: [PATCH 16/16] Improve Mock to be flexible and able to mock methods
from the mocked modules
* Configure importing Mock to handle 'total' method from psutils properly
---
doc/conf.py | 37 +++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
diff --git a/doc/conf.py b/doc/conf.py
index 9cefed8..b73ca2a 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -15,31 +15,40 @@ from sphinx.directives import TocTree
# pylint: disable=R0903
class Mock(object):
'''
- Mock out specified imports
+ Mock out specified imports.
This allows autodoc to do its thing without having oodles of req'd
installed libs. This doesn't work with ``import *`` imports.
+ This Mock class can be configured to return a specific values at specific names, if required.
+
http://read-the-docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
'''
- def __init__(self, *args, **kwargs):
- pass
+ def __init__(self, mapping=None, *args, **kwargs):
+ """
+ Mapping allows to bypass the Mock object, but actually assign
+ a specific value, expected by a specific attribute returned.
+ """
+ self.__mapping = mapping or {}
__all__ = []
def __call__(self, *args, **kwargs):
- ret = Mock()
# If mocked function is used as a decorator, expose decorated function.
# if args and callable(args[-1]):
# functools.update_wrapper(ret, args[0])
- return ret
-
- @classmethod
- def __getattr__(cls, name):
- if name in ('__file__', '__path__'):
- return '/dev/null'
+ return Mock(mapping=self.__mapping)
+
+ def __getattr__(self, name):
+ #__mapping = {'total': 0}
+ data = None
+ if name in self.__mapping:
+ data = self.__mapping.get(name)
+ elif name in ('__file__', '__path__'):
+ data = '/dev/null'
else:
- return Mock()
+ data = Mock(mapping=self.__mapping)
+ return data
# pylint: enable=R0903
MOCK_MODULES = [
@@ -133,7 +142,11 @@ MOCK_MODULES = [
]
for mod_name in MOCK_MODULES:
- sys.modules[mod_name] = Mock()
+ if mod_name == 'psutil':
+ mock = Mock(mapping={'total': 0}) # Otherwise it will crash Sphinx
+ else:
+ mock = Mock()
+ sys.modules[mod_name] = mock
def mock_decorator_with_params(*oargs, **okwargs):
'''
--
2.9.3

View File

@ -1,35 +0,0 @@
From e9b4a199f48abc94be71082c56b6b059c6694dc0 Mon Sep 17 00:00:00 2001
From: Eric Jackson <swiftgist@gmail.com>
Date: Tue, 30 Aug 2016 15:47:07 -0400
Subject: [PATCH 17/17] Check for single quote before splitting on single quote
Signed-off-by: Eric Jackson <ejackson@suse.com>
Lint for #35916
Merges #35916
---
salt/modules/zypper.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 1ec903e..4bb9a09 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -859,11 +859,11 @@ def refresh_db():
for line in out.splitlines():
if not line:
continue
- if line.strip().startswith('Repository'):
+ if line.strip().startswith('Repository') and '\'' in line:
key = line.split('\'')[1].strip()
if 'is up to date' in line:
ret[key] = False
- elif line.strip().startswith('Building'):
+ elif line.strip().startswith('Building') and '\'' in line:
key = line.split('\'')[1].strip()
if 'done' in line:
ret[key] = True
--
2.8.2

View File

@ -0,0 +1,74 @@
From e572a2774e186681820c6e9fc6df65516eba2abf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Mon, 31 Oct 2016 16:15:36 +0000
Subject: [PATCH 17/17] Including resolver params for Zypper debug-solver
Now '--no-allow-vendor-change' and '--from' parameters are included
into the zypper --debug-solver call before performing a dry-run dist-upgrade.
---
salt/modules/zypper.py | 15 ++++++++-------
tests/unit/modules/zypper_test.py | 7 +++++++
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 49ce5ec..98451bf 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -1136,6 +1136,10 @@ def upgrade(refresh=True,
cmd_update = (['dist-upgrade'] if dist_upgrade else ['update']) + ['--auto-agree-with-licenses']
+ if skip_verify:
+ # The '--no-gpg-checks' needs to be placed before the Zypper command.
+ cmd_update.insert(0, '--no-gpg-checks')
+
if refresh:
refresh_db()
@@ -1143,11 +1147,6 @@ def upgrade(refresh=True,
cmd_update.append('--dry-run')
if dist_upgrade:
- if dryrun:
- # Creates a solver test case for debugging.
- log.info('Executing debugsolver and performing a dry-run dist-upgrade')
- __zypper__(systemd_scope=_systemd_scope()).noraise.call(*cmd_update + ['--debug-solver'])
-
if fromrepo:
for repo in fromrepo:
cmd_update.extend(['--from', repo])
@@ -1161,8 +1160,10 @@ def upgrade(refresh=True,
else:
log.warn('Disabling vendor changes is not supported on this Zypper version')
- if skip_verify:
- cmd_update.append('--no-gpg-checks')
+ if dryrun:
+ # Creates a solver test case for debugging.
+ log.info('Executing debugsolver and performing a dry-run dist-upgrade')
+ __zypper__(systemd_scope=_systemd_scope()).noraise.call(*cmd_update + ['--debug-solver'])
old = list_pkgs()
diff --git a/tests/unit/modules/zypper_test.py b/tests/unit/modules/zypper_test.py
index fe170b4..56f68b6 100644
--- a/tests/unit/modules/zypper_test.py
+++ b/tests/unit/modules/zypper_test.py
@@ -359,6 +359,13 @@ class ZypperTestCase(TestCase):
zypper_mock.assert_any_call('dist-upgrade', '--auto-agree-with-licenses', '--dry-run')
zypper_mock.assert_any_call('dist-upgrade', '--auto-agree-with-licenses', '--dry-run', '--debug-solver')
+ with patch('salt.modules.zypper.list_pkgs', MagicMock(side_effect=[{"vim": "1.1"}, {"vim": "1.1"}])):
+ ret = zypper.upgrade(dist_upgrade=True, dryrun=True, fromrepo=["Dummy", "Dummy2"], novendorchange=True)
+ self.assertTrue(ret['result'])
+ self.assertDictEqual(ret['changes'], {})
+ zypper_mock.assert_any_call('dist-upgrade', '--auto-agree-with-licenses', '--dry-run', '--from', "Dummy", '--from', 'Dummy2', '--no-allow-vendor-change')
+ zypper_mock.assert_any_call('dist-upgrade', '--auto-agree-with-licenses', '--dry-run', '--from', "Dummy", '--from', 'Dummy2', '--no-allow-vendor-change', '--debug-solver')
+
with patch('salt.modules.zypper.list_pkgs', MagicMock(side_effect=[{"vim": "1.1"}, {"vim": "1.2"}])):
ret = zypper.upgrade(dist_upgrade=True, fromrepo=["Dummy", "Dummy2"], novendorchange=True)
self.assertTrue(ret['result'])
--
2.10.1

View File

@ -1,927 +0,0 @@
From e5fc36b5fad0683f57022bf2f3c63f453cda5e8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Tue, 6 Sep 2016 11:21:05 +0100
Subject: [PATCH 18/19] Unit tests fixes for 2016.3.2
* Fixing skipped boto tests to prevent errors if boto3 does not exists.
* Fix tests that assert CommandExecutionError (#32485)
Trying to assert that an exception was raised using
helper_open.write.assertRaises() is bogus--there is no such method. Use
standard unittest.assertRaises() instead.
* Skip utils_test if timelib is not installed (#32699)
date_cast() throws a RuntimeError, not an ImportError
* Fix tests (#35693)
Fix tests/unit/modules/useradd_test.py::UserAddTestCase::test_info
Fix unit/pyobjects_test.py::MapTests::test_map
Fix tests/unit/pyobjects_test.py::RendererTests::test_extend
Fix tests/unit/pyobjects_test.py::RendererTests::test_requisite_implicit_list
* Fix tests to prevent errors when libcloud is not present
* Fixed _interfaces_ifconfig output for SunOS test
* Fix PortageConfigTestCase in case of portage is not present
* Rename dockerio.py unit tests to dockerio_test.py
These tests have never run automatically because of an incorrect file name.
Added a skipIf on these tests as they are currently non-functioning and the
module they're testing has been deprecated.
* Prevent tests failures if boto does not exists
---
salt/modules/boto_elb.py | 2 +-
salt/modules/linux_sysctl.py | 6 +-
tests/unit/cloud/clouds/dimensiondata_test.py | 10 ++-
tests/unit/cloud/clouds/gce_test.py | 10 ++-
tests/unit/modules/boto_cloudtrail_test.py | 10 +--
tests/unit/modules/boto_iot_test.py | 10 +--
tests/unit/modules/boto_lambda_test.py | 10 +--
tests/unit/modules/boto_s3_bucket_test.py | 10 +--
tests/unit/modules/boto_secgroup_test.py | 1 +
tests/unit/modules/boto_vpc_test.py | 14 ++--
tests/unit/modules/linux_sysctl_test.py | 19 +++--
tests/unit/modules/mac_sysctl_test.py | 10 +--
tests/unit/modules/mount_test.py | 14 ++--
tests/unit/modules/portage_config.py | 10 ++-
tests/unit/modules/puppet_test.py | 15 ++--
tests/unit/modules/useradd_test.py | 6 +-
tests/unit/pyobjects_test.py | 11 +++
tests/unit/states/boto_cloudtrail_test.py | 10 +--
tests/unit/states/boto_iot_test.py | 10 +--
tests/unit/states/boto_lambda_test.py | 10 +--
tests/unit/states/boto_s3_bucket_test.py | 10 +--
tests/unit/states/dockerio.py | 112 -------------------------
tests/unit/states/dockerio_test.py | 113 ++++++++++++++++++++++++++
tests/unit/utils/network.py | 12 +--
tests/unit/utils/utils_test.py | 11 +--
25 files changed, 244 insertions(+), 212 deletions(-)
delete mode 100644 tests/unit/states/dockerio.py
create mode 100644 tests/unit/states/dockerio_test.py
diff --git a/salt/modules/boto_elb.py b/salt/modules/boto_elb.py
index 31df1fc..162abcd 100644
--- a/salt/modules/boto_elb.py
+++ b/salt/modules/boto_elb.py
@@ -57,6 +57,7 @@ log = logging.getLogger(__name__)
# Import third party libs
try:
import boto
+ import boto.ec2 # pylint: enable=unused-import
# connection settings were added in 2.33.0
required_boto_version = '2.33.0'
if (_LooseVersion(boto.__version__) <
@@ -64,7 +65,6 @@ try:
msg = 'boto_elb requires boto {0}.'.format(required_boto_version)
logging.debug(msg)
raise ImportError()
- import boto.ec2
from boto.ec2.elb import HealthCheck
from boto.ec2.elb.attributes import AccessLogAttribute
from boto.ec2.elb.attributes import ConnectionDrainingAttribute
diff --git a/salt/modules/linux_sysctl.py b/salt/modules/linux_sysctl.py
index b016ca6..7702d52 100644
--- a/salt/modules/linux_sysctl.py
+++ b/salt/modules/linux_sysctl.py
@@ -41,7 +41,11 @@ def _check_systemd_salt_config():
sysctl_dir = os.path.split(conf)[0]
if not os.path.exists(sysctl_dir):
os.makedirs(sysctl_dir)
- salt.utils.fopen(conf, 'w').close()
+ try:
+ salt.utils.fopen(conf, 'w').close()
+ except (IOError, OSError):
+ msg = 'Could not create file: {0}'
+ raise CommandExecutionError(msg.format(conf))
return conf
diff --git a/tests/unit/cloud/clouds/dimensiondata_test.py b/tests/unit/cloud/clouds/dimensiondata_test.py
index aa7f2c0..ee01d65 100644
--- a/tests/unit/cloud/clouds/dimensiondata_test.py
+++ b/tests/unit/cloud/clouds/dimensiondata_test.py
@@ -8,7 +8,13 @@
# Import Python libs
from __future__ import absolute_import
-import libcloud.security
+
+try:
+ import libcloud.security
+ HAS_LIBCLOUD = True
+except ImportError:
+ HAS_LIBCLOUD = False
+
import platform
import os
@@ -44,7 +50,7 @@ ON_SUSE = True if 'SuSE' in platform.dist() else False
ON_MAC = True if 'Darwin' in platform.system() else False
if not os.path.exists('/etc/ssl/certs/YaST-CA.pem') and ON_SUSE:
- if os.path.isfile('/etc/ssl/ca-bundle.pem'):
+ if os.path.isfile('/etc/ssl/ca-bundle.pem') and HAS_LIBCLOUD:
libcloud.security.CA_CERTS_PATH.append('/etc/ssl/ca-bundle.pem')
else:
HAS_CERTS = False
diff --git a/tests/unit/cloud/clouds/gce_test.py b/tests/unit/cloud/clouds/gce_test.py
index 87824eb..c90f8ab 100644
--- a/tests/unit/cloud/clouds/gce_test.py
+++ b/tests/unit/cloud/clouds/gce_test.py
@@ -8,7 +8,13 @@
# Import Python libs
from __future__ import absolute_import
-import libcloud.security
+
+try:
+ import libcloud.security
+ HAS_LIBCLOUD = True
+except ImportError:
+ HAS_LIBCLOUD = False
+
import platform
import os
@@ -51,7 +57,7 @@ ON_SUSE = True if 'SuSE' in platform.dist() else False
ON_MAC = True if 'Darwin' in platform.system() else False
if not os.path.exists('/etc/ssl/certs/YaST-CA.pem') and ON_SUSE:
- if os.path.isfile('/etc/ssl/ca-bundle.pem'):
+ if os.path.isfile('/etc/ssl/ca-bundle.pem') and HAS_LIBCLOUD:
libcloud.security.CA_CERTS_PATH.append('/etc/ssl/ca-bundle.pem')
else:
HAS_CERTS = False
diff --git a/tests/unit/modules/boto_cloudtrail_test.py b/tests/unit/modules/boto_cloudtrail_test.py
index 2f86101..264a795 100644
--- a/tests/unit/modules/boto_cloudtrail_test.py
+++ b/tests/unit/modules/boto_cloudtrail_test.py
@@ -103,6 +103,11 @@ if _has_required_boto():
StopLoggingTime=None)
+@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
+@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
+ ' or equal to version {0}'
+ .format(required_boto3_version))
+@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoCloudTrailTestCaseBase(TestCase):
conn = None
@@ -128,11 +133,6 @@ class BotoCloudTrailTestCaseMixin(object):
pass
-@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
-@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
- ' or equal to version {0}'
- .format(required_boto3_version))
-@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoCloudTrailTestCase(BotoCloudTrailTestCaseBase, BotoCloudTrailTestCaseMixin):
'''
TestCase for salt.modules.boto_cloudtrail module
diff --git a/tests/unit/modules/boto_iot_test.py b/tests/unit/modules/boto_iot_test.py
index 73c362f..520bfe9 100644
--- a/tests/unit/modules/boto_iot_test.py
+++ b/tests/unit/modules/boto_iot_test.py
@@ -103,6 +103,11 @@ if _has_required_boto():
ruleDisabled=True)
+@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
+@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
+ ' or equal to version {0}'
+ .format(required_boto3_version))
+@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoIoTTestCaseBase(TestCase):
conn = None
@@ -128,11 +133,6 @@ class BotoIoTTestCaseMixin(object):
pass
-@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
-@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
- ' or equal to version {0}'
- .format(required_boto3_version))
-@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoIoTPolicyTestCase(BotoIoTTestCaseBase, BotoIoTTestCaseMixin):
'''
TestCase for salt.modules.boto_iot module
diff --git a/tests/unit/modules/boto_lambda_test.py b/tests/unit/modules/boto_lambda_test.py
index 01ca245..ad7fb33 100644
--- a/tests/unit/modules/boto_lambda_test.py
+++ b/tests/unit/modules/boto_lambda_test.py
@@ -109,6 +109,11 @@ def _has_required_boto():
return True
+@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
+@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
+ ' or equal to version {0}'
+ .format(required_boto3_version))
+@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoLambdaTestCaseBase(TestCase):
conn = None
@@ -145,11 +150,6 @@ class BotoLambdaTestCaseMixin(object):
pass
-@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
-@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
- ' or equal to version {0}'
- .format(required_boto3_version))
-@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoLambdaFunctionTestCase(BotoLambdaTestCaseBase, BotoLambdaTestCaseMixin):
'''
TestCase for salt.modules.boto_lambda module
diff --git a/tests/unit/modules/boto_s3_bucket_test.py b/tests/unit/modules/boto_s3_bucket_test.py
index f4b1992..5e7d6be 100644
--- a/tests/unit/modules/boto_s3_bucket_test.py
+++ b/tests/unit/modules/boto_s3_bucket_test.py
@@ -205,6 +205,11 @@ if _has_required_boto():
}
+@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
+@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
+ ' or equal to version {0}'
+ .format(required_boto3_version))
+@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoS3BucketTestCaseBase(TestCase):
conn = None
@@ -230,11 +235,6 @@ class BotoS3BucketTestCaseMixin(object):
pass
-@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
-@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
- ' or equal to version {0}'
- .format(required_boto3_version))
-@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoS3BucketTestCase(BotoS3BucketTestCaseBase, BotoS3BucketTestCaseMixin):
'''
TestCase for salt.modules.boto_s3_bucket module
diff --git a/tests/unit/modules/boto_secgroup_test.py b/tests/unit/modules/boto_secgroup_test.py
index cc88568..7fd51ad 100644
--- a/tests/unit/modules/boto_secgroup_test.py
+++ b/tests/unit/modules/boto_secgroup_test.py
@@ -23,6 +23,7 @@ import salt.loader
from salt.ext.six.moves import range # pylint: disable=redefined-builtin
try:
import boto
+ import boto.ec2 # pylint: enable=unused-import
HAS_BOTO = True
except ImportError:
HAS_BOTO = False
diff --git a/tests/unit/modules/boto_vpc_test.py b/tests/unit/modules/boto_vpc_test.py
index 64c7976..162bcae 100644
--- a/tests/unit/modules/boto_vpc_test.py
+++ b/tests/unit/modules/boto_vpc_test.py
@@ -124,6 +124,13 @@ def _has_required_moto():
context = {}
+@skipIf(NO_MOCK, NO_MOCK_REASON)
+@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
+@skipIf(HAS_MOTO is False, 'The moto module must be installed.')
+@skipIf(_has_required_boto() is False, 'The boto module must be greater than'
+ ' or equal to version {0}'
+ .format(required_boto_version))
+@skipIf(_has_required_moto() is False, 'The moto version must be >= to version {0}'.format(required_moto_version))
class BotoVpcTestCaseBase(TestCase):
def setUp(self):
boto_vpc.__context__ = {}
@@ -249,13 +256,6 @@ class BotoVpcTestCaseMixin(object):
return rtbl
-@skipIf(NO_MOCK, NO_MOCK_REASON)
-@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
-@skipIf(HAS_MOTO is False, 'The moto module must be installed.')
-@skipIf(_has_required_boto() is False, 'The boto module must be greater than'
- ' or equal to version {0}'
- .format(required_boto_version))
-@skipIf(_has_required_moto() is False, 'The moto version must be >= to version {0}'.format(required_moto_version))
class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
'''
TestCase for salt.modules.boto_vpc module
diff --git a/tests/unit/modules/linux_sysctl_test.py b/tests/unit/modules/linux_sysctl_test.py
index 89bea83..1eca7d5 100644
--- a/tests/unit/modules/linux_sysctl_test.py
+++ b/tests/unit/modules/linux_sysctl_test.py
@@ -84,17 +84,22 @@ class LinuxSysctlTestCase(TestCase):
self.assertEqual(linux_sysctl.assign(
'net.ipv4.ip_forward', 1), ret)
- @patch('os.path.isfile', MagicMock(return_value=False))
def test_persist_no_conf_failure(self):
'''
Tests adding of config file failure
'''
- with patch('salt.utils.fopen', mock_open()) as m_open:
- helper_open = m_open()
- helper_open.write.assertRaises(CommandExecutionError,
- linux_sysctl.persist,
- 'net.ipv4.ip_forward',
- 1, config=None)
+ asn_cmd = {'pid': 1337, 'retcode': 0,
+ 'stderr': "sysctl: permission denied", 'stdout': ''}
+ mock_asn_cmd = MagicMock(return_value=asn_cmd)
+ cmd = "sysctl -w net.ipv4.ip_forward=1"
+ mock_cmd = MagicMock(return_value=cmd)
+ with patch.dict(linux_sysctl.__salt__, {'cmd.run_stdout': mock_cmd,
+ 'cmd.run_all': mock_asn_cmd}):
+ with patch('salt.utils.fopen', mock_open()) as m_open:
+ self.assertRaises(CommandExecutionError,
+ linux_sysctl.persist,
+ 'net.ipv4.ip_forward',
+ 1, config=None)
@patch('os.path.isfile', MagicMock(return_value=False))
@patch('os.path.exists', MagicMock(return_value=True))
diff --git a/tests/unit/modules/mac_sysctl_test.py b/tests/unit/modules/mac_sysctl_test.py
index e90ec64..533397b 100644
--- a/tests/unit/modules/mac_sysctl_test.py
+++ b/tests/unit/modules/mac_sysctl_test.py
@@ -72,11 +72,11 @@ class DarwinSysctlTestCase(TestCase):
Tests adding of config file failure
'''
with patch('salt.utils.fopen', mock_open()) as m_open:
- helper_open = m_open()
- helper_open.write.assertRaises(CommandExecutionError,
- mac_sysctl.persist,
- 'net.inet.icmp.icmplim',
- 50, config=None)
+ m_open.side_effect = IOError(13, 'Permission denied', '/file')
+ self.assertRaises(CommandExecutionError,
+ mac_sysctl.persist,
+ 'net.inet.icmp.icmplim',
+ 50, config=None)
@patch('os.path.isfile', MagicMock(return_value=False))
def test_persist_no_conf_success(self):
diff --git a/tests/unit/modules/mount_test.py b/tests/unit/modules/mount_test.py
index 290c368..b2cf904 100644
--- a/tests/unit/modules/mount_test.py
+++ b/tests/unit/modules/mount_test.py
@@ -141,10 +141,10 @@ class MountTestCase(TestCase):
with patch.dict(mount.__grains__, {'kernel': ''}):
with patch.object(mount, 'fstab', mock_fstab):
with patch('salt.utils.fopen', mock_open()) as m_open:
- helper_open = m_open()
- helper_open.write.assertRaises(CommandExecutionError,
- mount.rm_fstab,
- config=None)
+ m_open.side_effect = IOError(13, 'Permission denied:', '/file')
+ self.assertRaises(CommandExecutionError,
+ mount.rm_fstab,
+ 'name', 'device')
def test_set_fstab(self):
'''
@@ -180,11 +180,7 @@ class MountTestCase(TestCase):
mock = MagicMock(return_value={'name': 'name'})
with patch.object(mount, 'fstab', mock):
- with patch('salt.utils.fopen', mock_open()) as m_open:
- helper_open = m_open()
- helper_open.write.assertRaises(CommandExecutionError,
- mount.rm_automaster,
- 'name', 'device')
+ self.assertTrue(mount.rm_automaster('name', 'device'))
def test_set_automaster(self):
'''
diff --git a/tests/unit/modules/portage_config.py b/tests/unit/modules/portage_config.py
index 8da1ebe..6275442 100644
--- a/tests/unit/modules/portage_config.py
+++ b/tests/unit/modules/portage_config.py
@@ -11,7 +11,7 @@ from __future__ import absolute_import
# Import Salt Testing libs
from salttesting import skipIf, TestCase
from salttesting.helpers import ensure_in_syspath
-from salttesting.mock import NO_MOCK, NO_MOCK_REASON
+from salttesting.mock import NO_MOCK, NO_MOCK_REASON, MagicMock
ensure_in_syspath('../../')
# Import salt libs
@@ -20,6 +20,10 @@ from salt.modules import portage_config
@skipIf(NO_MOCK, NO_MOCK_REASON)
class PortageConfigTestCase(TestCase):
+ class DummyAtom(object):
+ def __init__(self, atom):
+ self.cp, self.repo = atom.split("::") if "::" in atom else (atom, None)
+
def test_get_config_file_wildcards(self):
pairs = [
('*/*::repo', '/etc/portage/package.mask/repo'),
@@ -29,7 +33,11 @@ class PortageConfigTestCase(TestCase):
('cat/pkg::repo', '/etc/portage/package.mask/cat/pkg'),
]
+ portage_config.portage = MagicMock()
for (atom, expected) in pairs:
+ dummy_atom = self.DummyAtom(atom)
+ portage_config.portage.dep.Atom = MagicMock(return_value=dummy_atom)
+ portage_config._p_to_cp = MagicMock(return_value=dummy_atom.cp)
self.assertEqual(portage_config._get_config_file('mask', atom), expected)
if __name__ == '__main__':
diff --git a/tests/unit/modules/puppet_test.py b/tests/unit/modules/puppet_test.py
index 02bc2e1..2cdd696 100644
--- a/tests/unit/modules/puppet_test.py
+++ b/tests/unit/modules/puppet_test.py
@@ -85,10 +85,12 @@ class PuppetTestCase(TestCase):
with patch('salt.utils.fopen', mock_open()):
self.assertTrue(puppet.disable())
- with patch('salt.utils.fopen', mock_open()) as m_open:
- helper_open = m_open()
- helper_open.write.assertRaises(CommandExecutionError,
- puppet.disable)
+ try:
+ with patch('salt.utils.fopen', mock_open()) as m_open:
+ m_open.side_effect = IOError(13, 'Permission denied:', '/file')
+ self.assertRaises(CommandExecutionError, puppet.disable)
+ except StopIteration:
+ pass
def test_status(self):
'''
@@ -145,9 +147,8 @@ class PuppetTestCase(TestCase):
self.assertDictEqual(puppet.summary(), {'resources': 1})
with patch('salt.utils.fopen', mock_open()) as m_open:
- helper_open = m_open()
- helper_open.write.assertRaises(CommandExecutionError,
- puppet.summary)
+ m_open.side_effect = IOError(13, 'Permission denied:', '/file')
+ self.assertRaises(CommandExecutionError, puppet.summary)
def test_plugin_sync(self):
'''
diff --git a/tests/unit/modules/useradd_test.py b/tests/unit/modules/useradd_test.py
index 7e646b6..cc9e610 100644
--- a/tests/unit/modules/useradd_test.py
+++ b/tests/unit/modules/useradd_test.py
@@ -326,7 +326,7 @@ class UserAddTestCase(TestCase):
'''
Test the user information
'''
- self.assertEqual(useradd.info('salt'), {})
+ self.assertEqual(useradd.info('username-that-doesnt-exist'), {})
mock = MagicMock(return_value=pwd.struct_passwd(('_TEST_GROUP',
'*',
@@ -336,9 +336,7 @@ class UserAddTestCase(TestCase):
'/var/virusmails',
'/usr/bin/false')))
with patch.object(pwd, 'getpwnam', mock):
- mock = MagicMock(return_value='Group Name')
- with patch.object(useradd, 'list_groups', mock):
- self.assertEqual(useradd.info('salt')['name'], '_TEST_GROUP')
+ self.assertEqual(useradd.info('username-that-doesnt-exist')['name'], '_TEST_GROUP')
# 'list_groups' function tests: 1
diff --git a/tests/unit/pyobjects_test.py b/tests/unit/pyobjects_test.py
index f1c3e29..3eb4bd5 100644
--- a/tests/unit/pyobjects_test.py
+++ b/tests/unit/pyobjects_test.py
@@ -54,10 +54,18 @@ include('http')
extend_template = '''#!pyobjects
include('http')
+
+from salt.utils.pyobjects import StateFactory
+Service = StateFactory('service')
+
Service.running(extend('apache'), watch=[{'file': '/etc/file'}])
'''
map_template = '''#!pyobjects
+from salt.utils.pyobjects import StateFactory
+Service = StateFactory('service')
+
+
class Samba(Map):
__merge__ = 'samba:lookup'
@@ -127,6 +135,9 @@ from salt://password.sls import password
'''
requisite_implicit_list_template = '''#!pyobjects
+from salt.utils.pyobjects import StateFactory
+Service = StateFactory('service')
+
with Pkg.installed("pkg"):
Service.running("service", watch=File("file"), require=Cmd("cmd"))
'''
diff --git a/tests/unit/states/boto_cloudtrail_test.py b/tests/unit/states/boto_cloudtrail_test.py
index 48fbd32..9e6dd95 100644
--- a/tests/unit/states/boto_cloudtrail_test.py
+++ b/tests/unit/states/boto_cloudtrail_test.py
@@ -104,6 +104,11 @@ if _has_required_boto():
StopLoggingTime=None)
+@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
+@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
+ ' or equal to version {0}'
+ .format(required_boto3_version))
+@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoCloudTrailStateTestCaseBase(TestCase):
conn = None
@@ -124,11 +129,6 @@ class BotoCloudTrailStateTestCaseBase(TestCase):
session_instance.client.return_value = self.conn
-@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
-@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
- ' or equal to version {0}'
- .format(required_boto3_version))
-@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoCloudTrailTestCase(BotoCloudTrailStateTestCaseBase, BotoCloudTrailTestCaseMixin):
'''
TestCase for salt.modules.boto_cloudtrail state.module
diff --git a/tests/unit/states/boto_iot_test.py b/tests/unit/states/boto_iot_test.py
index 8c2549d..81d68c8 100644
--- a/tests/unit/states/boto_iot_test.py
+++ b/tests/unit/states/boto_iot_test.py
@@ -103,6 +103,11 @@ if _has_required_boto():
principal = 'arn:aws:iot:us-east-1:1234:cert/21fc104aaaf6043f5756c1b57bda84ea8395904c43f28517799b19e4c42514'
+@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
+@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
+ ' or equal to version {0}'
+ .format(required_boto3_version))
+@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoIoTStateTestCaseBase(TestCase):
conn = None
@@ -123,11 +128,6 @@ class BotoIoTStateTestCaseBase(TestCase):
session_instance.client.return_value = self.conn
-@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
-@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
- ' or equal to version {0}'
- .format(required_boto3_version))
-@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoIoTPolicyTestCase(BotoIoTStateTestCaseBase, BotoIoTTestCaseMixin):
'''
TestCase for salt.modules.boto_iot state.module
diff --git a/tests/unit/states/boto_lambda_test.py b/tests/unit/states/boto_lambda_test.py
index 4557aed..7b02391 100644
--- a/tests/unit/states/boto_lambda_test.py
+++ b/tests/unit/states/boto_lambda_test.py
@@ -101,6 +101,11 @@ def _has_required_boto():
return True
+@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
+@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
+ ' or equal to version {0}'
+ .format(required_boto3_version))
+@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoLambdaStateTestCaseBase(TestCase):
conn = None
@@ -121,11 +126,6 @@ class BotoLambdaStateTestCaseBase(TestCase):
session_instance.client.return_value = self.conn
-@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
-@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
- ' or equal to version {0}'
- .format(required_boto3_version))
-@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoLambdaFunctionTestCase(BotoLambdaStateTestCaseBase, BotoLambdaTestCaseMixin):
'''
TestCase for salt.modules.boto_lambda state.module
diff --git a/tests/unit/states/boto_s3_bucket_test.py b/tests/unit/states/boto_s3_bucket_test.py
index 4049e9a..03c406f 100644
--- a/tests/unit/states/boto_s3_bucket_test.py
+++ b/tests/unit/states/boto_s3_bucket_test.py
@@ -277,6 +277,11 @@ if _has_required_boto():
}
+@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
+@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
+ ' or equal to version {0}'
+ .format(required_boto3_version))
+@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoS3BucketStateTestCaseBase(TestCase):
conn = None
@@ -297,11 +302,6 @@ class BotoS3BucketStateTestCaseBase(TestCase):
session_instance.client.return_value = self.conn
-@skipIf(HAS_BOTO is False, 'The boto module must be installed.')
-@skipIf(_has_required_boto() is False, 'The boto3 module must be greater than'
- ' or equal to version {0}'
- .format(required_boto3_version))
-@skipIf(NO_MOCK, NO_MOCK_REASON)
class BotoS3BucketTestCase(BotoS3BucketStateTestCaseBase, BotoS3BucketTestCaseMixin):
'''
TestCase for salt.modules.boto_s3_bucket state.module
diff --git a/tests/unit/states/dockerio.py b/tests/unit/states/dockerio.py
deleted file mode 100644
index c73b633..0000000
--- a/tests/unit/states/dockerio.py
+++ /dev/null
@@ -1,112 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Import Python libs
-from __future__ import absolute_import
-from contextlib import contextmanager
-
-# Import Salt Testing libs
-from salttesting import skipIf, TestCase
-from salttesting.mock import NO_MOCK, NO_MOCK_REASON, MagicMock
-
-
-@contextmanager
-def provision_state(module, fixture):
- previous_dict = getattr(module, '__salt__', {}).copy()
- try:
- module.__dict__.setdefault('__salt__', {}).update(fixture)
- yield
- finally:
- setattr(module, '__salt__', previous_dict)
-
-
-@skipIf(NO_MOCK, NO_MOCK_REASON)
-class DockerStateTestCase(TestCase):
- def test_docker_run_success(self):
- from salt.states import dockerio
- salt_fixture = {'docker.retcode': MagicMock(return_value=0),
- 'docker.run_all': MagicMock(
- return_value={'stdout': '.\n..\n',
- 'stderr': '',
- 'status': True,
- 'comment': 'Success',
- 'retcode': 0})}
-
- with provision_state(dockerio, salt_fixture):
- result = dockerio.run('ls /', 'ubuntu')
-
- self.assertEqual(result, {'name': 'ls /',
- 'result': True,
- 'comment': 'Success',
- 'changes': {}})
-
- def test_docker_run_failure(self):
- from salt.states import dockerio
- salt_fixture = {'docker.retcode': MagicMock(return_value=0),
- 'docker.run_all': MagicMock(
- return_value={'stdout': '',
- 'stderr': 'Error',
- 'status': False,
- 'comment': 'Failure',
- 'retcode': 1})}
-
- with provision_state(dockerio, salt_fixture):
- result = dockerio.run('ls /', 'ubuntu')
-
- self.assertEqual(result, {'name': 'ls /',
- 'result': False,
- 'comment': 'Failure',
- 'changes': {}})
-
- def test_docker_run_onlyif(self):
- from salt.states import dockerio
- salt_fixture = {'docker.retcode': MagicMock(return_value=1),
- 'docker.run_all': None}
- with provision_state(dockerio, salt_fixture):
- result = dockerio.run('ls /', 'ubuntu',
- onlyif='ls -l')
- self.assertEqual(result, {'name': 'ls /',
- 'result': True,
- 'comment': 'onlyif execution failed',
- 'changes': {}})
-
- def test_docker_run_unless(self):
- from salt.states import dockerio
- salt_fixture = {'docker.retcode': MagicMock(return_value=0),
- 'docker.run_all': None}
- with provision_state(dockerio, salt_fixture):
- result = dockerio.run('ls /', 'ubuntu',
- unless='ls -l')
- self.assertEqual(result, {'name': 'ls /',
- 'result': True,
- 'comment': 'unless execution succeeded',
- 'changes': {}})
-
- def test_docker_run_docked_onlyif(self):
- from salt.states import dockerio
- salt_fixture = {'docker.retcode': MagicMock(return_value=1),
- 'docker.run_all': None}
- with provision_state(dockerio, salt_fixture):
- result = dockerio.run('ls /', 'ubuntu',
- docked_onlyif='ls -l')
- self.assertEqual(result, {'name': 'ls /',
- 'result': True,
- 'comment': 'docked_onlyif execution failed',
- 'changes': {}})
-
- def test_docker_run_docked_unless(self):
- from salt.states import dockerio
- salt_fixture = {'docker.retcode': MagicMock(return_value=0),
- 'docker.run_all': None}
- with provision_state(dockerio, salt_fixture):
- result = dockerio.run('ls /', 'ubuntu',
- docked_unless='ls -l')
- self.assertEqual(result, {'name': 'ls /',
- 'result': True,
- 'comment': ('docked_unless execution'
- ' succeeded'),
- 'changes': {}})
-
-
-if __name__ == '__main__':
- from integration import run_tests
- run_tests(DockerStateTestCase, needs_daemon=False)
diff --git a/tests/unit/states/dockerio_test.py b/tests/unit/states/dockerio_test.py
new file mode 100644
index 0000000..54f51be
--- /dev/null
+++ b/tests/unit/states/dockerio_test.py
@@ -0,0 +1,113 @@
+# -*- coding: utf-8 -*-
+
+# Import Python libs
+from __future__ import absolute_import
+from contextlib import contextmanager
+
+# Import Salt Testing libs
+from salttesting import skipIf, TestCase
+from salttesting.mock import NO_MOCK, NO_MOCK_REASON, MagicMock
+
+
+@contextmanager
+def provision_state(module, fixture):
+ previous_dict = getattr(module, '__salt__', {}).copy()
+ try:
+ module.__dict__.setdefault('__salt__', {}).update(fixture)
+ yield
+ finally:
+ setattr(module, '__salt__', previous_dict)
+
+
+@skipIf(NO_MOCK, NO_MOCK_REASON)
+@skipIf(True, 'Skipped: This module has been deprecated.')
+class DockerStateTestCase(TestCase):
+ def test_docker_run_success(self):
+ from salt.states import dockerio
+ salt_fixture = {'docker.retcode': MagicMock(return_value=0),
+ 'docker.run_all': MagicMock(
+ return_value={'stdout': '.\n..\n',
+ 'stderr': '',
+ 'status': True,
+ 'comment': 'Success',
+ 'retcode': 0})}
+
+ with provision_state(dockerio, salt_fixture):
+ result = dockerio.run('ls /', 'ubuntu')
+
+ self.assertEqual(result, {'name': 'ls /',
+ 'result': True,
+ 'comment': 'Success',
+ 'changes': {}})
+
+ def test_docker_run_failure(self):
+ from salt.states import dockerio
+ salt_fixture = {'docker.retcode': MagicMock(return_value=0),
+ 'docker.run_all': MagicMock(
+ return_value={'stdout': '',
+ 'stderr': 'Error',
+ 'status': False,
+ 'comment': 'Failure',
+ 'retcode': 1})}
+
+ with provision_state(dockerio, salt_fixture):
+ result = dockerio.run('ls /', 'ubuntu')
+
+ self.assertEqual(result, {'name': 'ls /',
+ 'result': False,
+ 'comment': 'Failure',
+ 'changes': {}})
+
+ def test_docker_run_onlyif(self):
+ from salt.states import dockerio
+ salt_fixture = {'docker.retcode': MagicMock(return_value=1),
+ 'docker.run_all': None}
+ with provision_state(dockerio, salt_fixture):
+ result = dockerio.run('ls /', 'ubuntu',
+ onlyif='ls -l')
+ self.assertEqual(result, {'name': 'ls /',
+ 'result': True,
+ 'comment': 'onlyif execution failed',
+ 'changes': {}})
+
+ def test_docker_run_unless(self):
+ from salt.states import dockerio
+ salt_fixture = {'docker.retcode': MagicMock(return_value=0),
+ 'docker.run_all': None}
+ with provision_state(dockerio, salt_fixture):
+ result = dockerio.run('ls /', 'ubuntu',
+ unless='ls -l')
+ self.assertEqual(result, {'name': 'ls /',
+ 'result': True,
+ 'comment': 'unless execution succeeded',
+ 'changes': {}})
+
+ def test_docker_run_docked_onlyif(self):
+ from salt.states import dockerio
+ salt_fixture = {'docker.retcode': MagicMock(return_value=1),
+ 'docker.run_all': None}
+ with provision_state(dockerio, salt_fixture):
+ result = dockerio.run('ls /', 'ubuntu',
+ docked_onlyif='ls -l')
+ self.assertEqual(result, {'name': 'ls /',
+ 'result': True,
+ 'comment': 'docked_onlyif execution failed',
+ 'changes': {}})
+
+ def test_docker_run_docked_unless(self):
+ from salt.states import dockerio
+ salt_fixture = {'docker.retcode': MagicMock(return_value=0),
+ 'docker.run_all': None}
+ with provision_state(dockerio, salt_fixture):
+ result = dockerio.run('ls /', 'ubuntu',
+ docked_unless='ls -l')
+ self.assertEqual(result, {'name': 'ls /',
+ 'result': True,
+ 'comment': ('docked_unless execution'
+ ' succeeded'),
+ 'changes': {}})
+
+
+if __name__ == '__main__':
+ from integration import run_tests
+ run_tests(DockerStateTestCase, needs_daemon=False)
diff --git a/tests/unit/utils/network.py b/tests/unit/utils/network.py
index 89db848..72ca857 100644
--- a/tests/unit/utils/network.py
+++ b/tests/unit/utils/network.py
@@ -151,15 +151,16 @@ class NetworkTestCase(TestCase):
self.assertEqual(interfaces,
{'ilbext0': {'inet': [{'address': '10.10.11.11',
'broadcast': '10.10.11.31',
+ 'netmask': '255.255.255.224'},
+ {'address': '10.10.11.12',
+ 'broadcast': '10.10.11.31',
'netmask': '255.255.255.224'}],
- 'inet6': [{'address': '::',
- 'prefixlen': '0'}],
+ 'inet6': [],
'up': True},
'ilbint0': {'inet': [{'address': '10.6.0.11',
'broadcast': '10.6.0.255',
'netmask': '255.255.255.0'}],
- 'inet6': [{'address': '::',
- 'prefixlen': '0'}],
+ 'inet6': [],
'up': True},
'lo0': {'inet': [{'address': '127.0.0.1',
'netmask': '255.0.0.0'}],
@@ -174,8 +175,7 @@ class NetworkTestCase(TestCase):
'up': True},
'vpn0': {'inet': [{'address': '10.6.0.14',
'netmask': '255.0.0.0'}],
- 'inet6': [{'address': '::',
- 'prefixlen': '0'}],
+ 'inet6': [],
'up': True}}
)
diff --git a/tests/unit/utils/utils_test.py b/tests/unit/utils/utils_test.py
index 261af69..11f0baf 100644
--- a/tests/unit/utils/utils_test.py
+++ b/tests/unit/utils/utils_test.py
@@ -527,14 +527,9 @@ class UtilsTestCase(TestCase):
ret = utils.date_cast('Mon Dec 23 10:19:15 MST 2013')
expected_ret = datetime.datetime(2013, 12, 23, 10, 19, 15)
self.assertEqual(ret, expected_ret)
- except ImportError:
- try:
- ret = utils.date_cast('Mon Dec 23 10:19:15 MST 2013')
- expected_ret = datetime.datetime(2013, 12, 23, 10, 19, 15)
- self.assertEqual(ret, expected_ret)
- except RuntimeError:
- # Unparseable without timelib installed
- self.skipTest('\'timelib\' is not installed')
+ except RuntimeError:
+ # Unparseable without timelib installed
+ self.skipTest('\'timelib\' is not installed')
@skipIf(not HAS_TIMELIB, '\'timelib\' is not installed')
def test_date_format(self):
--
2.8.2

View File

@ -1,107 +0,0 @@
From 65dba3e9ab088087943f67367dc27fce00e4cd92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?=
<psuarezhernandez@suse.com>
Date: Tue, 13 Sep 2016 11:05:35 +0100
Subject: [PATCH 20/20] Integration tests fixes for 2016.3.2
* Fix PillarModuleTest::test_pillar_items: 'info' does not exist in pillar
* Fixing integration tests if azure is not present
* Fixing integration tests failures if 'git' command is missing
Skip git state integration tests if 'git' does not exists
Prevent OSError if 'git' command not found during _git_version()
---
tests/integration/cloud/providers/msazure.py | 17 +++++++++--------
tests/integration/modules/git.py | 15 +++++++++------
tests/integration/modules/pillar.py | 1 -
tests/integration/states/git.py | 2 +-
4 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/tests/integration/cloud/providers/msazure.py b/tests/integration/cloud/providers/msazure.py
index c4934e4..4e53add 100644
--- a/tests/integration/cloud/providers/msazure.py
+++ b/tests/integration/cloud/providers/msazure.py
@@ -53,14 +53,15 @@ def __has_required_azure():
'''
Returns True/False if the required version of the Azure SDK is installed.
'''
- if hasattr(azure, '__version__'):
- version = LooseVersion(azure.__version__)
- else:
- version = LooseVersion(azure.common.__version__)
- if HAS_AZURE is True and REQUIRED_AZURE <= version:
- return True
- else:
- return False
+ if HAS_AZURE:
+ if hasattr(azure, '__version__'):
+ version = LooseVersion(azure.__version__)
+ else:
+ version = LooseVersion(azure.common.__version__)
+
+ if REQUIRED_AZURE <= version:
+ return True
+ return False
@skipIf(HAS_AZURE is False, 'These tests require the Azure Python SDK to be installed.')
diff --git a/tests/integration/modules/git.py b/tests/integration/modules/git.py
index 7c40664..f5c15f3 100644
--- a/tests/integration/modules/git.py
+++ b/tests/integration/modules/git.py
@@ -36,12 +36,15 @@ log = logging.getLogger(__name__)
def _git_version():
- git_version = subprocess.Popen(
- ['git', '--version'],
- shell=False,
- close_fds=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).communicate()[0]
+ try:
+ git_version = subprocess.Popen(
+ ['git', '--version'],
+ shell=False,
+ close_fds=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE).communicate()[0]
+ except OSError:
+ return False
if not git_version:
log.debug('Git not installed')
return False
diff --git a/tests/integration/modules/pillar.py b/tests/integration/modules/pillar.py
index b081f76..3d55b4c 100644
--- a/tests/integration/modules/pillar.py
+++ b/tests/integration/modules/pillar.py
@@ -119,7 +119,6 @@ class PillarModuleTest(integration.ModuleCase):
from pillar.items
'''
get_items = self.run_function('pillar.items')
- self.assertDictContainsSubset({'info': 'bar'}, get_items)
self.assertDictContainsSubset({'monty': 'python'}, get_items)
self.assertDictContainsSubset(
{'knights': ['Lancelot', 'Galahad', 'Bedevere', 'Robin']},
diff --git a/tests/integration/states/git.py b/tests/integration/states/git.py
index a78b271..87681ba 100644
--- a/tests/integration/states/git.py
+++ b/tests/integration/states/git.py
@@ -20,6 +20,7 @@ import integration
import salt.utils
+@skip_if_binaries_missing('git')
class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
'''
Validate the git state
@@ -254,7 +255,6 @@ class GitTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
finally:
shutil.rmtree(name, ignore_errors=True)
- @skip_if_binaries_missing('git')
def test_config_set_value_with_space_character(self):
'''
git.config
--
2.8.2

View File

@ -1,31 +0,0 @@
From 2cac0c3839af12b0a474f4cb0c0854995cd8dc2a Mon Sep 17 00:00:00 2001
From: "C. R. Oldham" <cro@ncbt.org>
Date: Wed, 21 Sep 2016 20:05:33 -0600
Subject: [PATCH 21/21] Fix pkg.upgrade for zypper
---
salt/modules/zypper.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
index 4bb9a09..21b87b0 100644
--- a/salt/modules/zypper.py
+++ b/salt/modules/zypper.py
@@ -1079,10 +1079,11 @@ def upgrade(refresh=True, skip_verify=False):
refresh_db()
old = list_pkgs()
- to_append = ''
if skip_verify:
- to_append = '--no-gpg-checks'
- __zypper__.noraise.call('update', '--auto-agree-with-licenses', to_append)
+ __zypper__.noraise.call('update', '--auto-agree-with-licenses', '--no-gpg-checks')
+ else:
+ __zypper__.noraise.call('update', '--auto-agree-with-licenses')
+
if __zypper__.exit_code not in __zypper__.SUCCESS_EXIT_CODES:
ret['result'] = False
ret['comment'] = (__zypper__.stdout() + os.linesep + __zypper__.stderr()).strip()
--
2.10.0

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6a84b724d02b0dba438dea57650724064675d82620e66749bd2fe8f21da71be0
size 8014793

3
salt-2016.3.4.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:09112bffb004afc78c68a2cd4cfd30e17570f7f5a37d409143218077ff8c2cc7
size 8441776

View File

@ -1,3 +1,93 @@
-------------------------------------------------------------------
Wed Nov 2 13:44:18 UTC 2016 - kkaempf@suse.com
- Update to 2016.3.4
see https://docs.saltstack.com/en/latest/topics/releases/2016.3.4.html
- Removed Patches, applied upstream
* 0008-checksum-validation-when-zypper-pkg.download.patch
* 0009-unit-tests-for-rpm.checksum-and-zypper.download.patch
* 0010-snapper-execution-module.patch
* 0011-fix-salt-summary-to-count-not-responding-minions-cor.patch
* 0012-Run-salt-api-as-user-salt-bsc-990029.patch
* 0013-Deprecate-status.uptime-one-version-later.patch
* 0014-Add-ignore_repo_failure-option-to-suppress-zypper-s-.patch
* 0015-Remove-zypper-s-raise-exception-if-mod_repo-has-no-a.patch
* 0016-Improve-Mock-to-be-flexible-and-able-to-mock-methods.patch
* 0017-Check-for-single-quote-before-splitting-on-single-qu.patch
* 0018-Unit-tests-fixes-for-2016.3.2.patch
* 0019-Fix-snapper_test-for-python26.patch
* 0020-Integration-tests-fixes-for-2016.3.2.patch
* 0021-Fix-pkg.upgrade-for-zypper.patch
* 0022-Setting-up-OS-grains-for-SLES-Expanded-Support-SUSE-.patch
* 0023-acl.delfacl-fix-position-of-X-option-to-setfacl.patch
* 0024-Change-travis-configuration-file-to-use-salt-toaster.patch
* 0025-Adding-dist-upgrade-support-to-zypper-module.patch
* 0026-Fix-pkg.latest_version-when-latest-already-installed.patch
* 0027-Including-resolver-params-for-Zypper-debug-solver.patch
- Added patches
* 0008-snapper-execution-module.patch
* 0009-fix-salt-summary-to-count-not-responding-minions-cor.patch
* 0010-Run-salt-api-as-user-salt-bsc-990029.patch
* 0011-Fix-snapper_test-for-python26.patch
* 0012-Fix-pkg.upgrade-for-zypper.patch
* 0013-Setting-up-OS-grains-for-SLES-Expanded-Support-SUSE-.patch
* 0014-acl.delfacl-fix-position-of-X-option-to-setfacl.patch
* 0015-Change-travis-configuration-file-to-use-salt-toaster.patch
* 0016-Fix-pkg.latest_version-when-latest-already-installed.patch
* 0017-Including-resolver-params-for-Zypper-debug-solver.patch
-------------------------------------------------------------------
Mon Oct 31 16:40:49 UTC 2016 - pablo.suarezhernandez@suse.com
- Including resolution parameters in the Zypper debug-solver
call during a dry-run dist-upgrade.
Add:
* 0027-Including-resolver-params-for-Zypper-debug-solver.patch
-------------------------------------------------------------------
-------------------------------------------------------------------
Mon Oct 24 08:16:57 UTC 2016 - mihai.dinca@suse.com
- Fix-pkg.latest_version when latest already installed (bsc#1005329)
Add:
* 0026-Fix-pkg.latest_version-when-latest-already-installed.patch
-------------------------------------------------------------------
Wed Oct 19 15:22:46 UTC 2016 - pablo.suarezhernandez@suse.com
- Adding 'dist-upgrade' support to zypper module
Add:
* 0025-Adding-dist-upgrade-support-to-zypper-module.patch
-------------------------------------------------------------------
Mon Oct 17 14:09:02 UTC 2016 - mihai.dinca@suse.com
- Copy .travis.yml from git commit 1829a6086a19a3f887c5216dc8aace9068063cfe
Add:
* travis.yml
- Change travis configuration file to use salt-toaster
Add:
* 0078-Change-travis-configuration-file-to-use-salt-toaster.patch
-------------------------------------------------------------------
Thu Oct 13 15:41:50 UTC 2016 - mihai.dinca@suse.com
- acl.delfacl: fix position of -X option to setfacl (bsc#1004260)
Add:
* 0023-acl.delfacl-fix-position-of-X-option-to-setfacl.patch
-------------------------------------------------------------------
Tue Oct 11 11:59:14 UTC 2016 - mc@suse.com
- fix generated shebang in scripts on SLES-ES 7 (bsc#1004047)
-------------------------------------------------------------------
Wed Oct 5 13:33:25 UTC 2016 - mihai.dinca@suse.com
- Setting up OS grains for SLES-ES (SLES Expanded Support platform)
Add:
* 0022-Setting-up-OS-grains-for-SLES-Expanded-Support-SUSE-.patch
-------------------------------------------------------------------
Wed Sep 28 12:35:32 UTC 2016 - tampakrap@opensuse.org

View File

@ -37,7 +37,7 @@
%bcond_with builddocs
Name: salt
Version: 2016.3.2
Version: 2016.3.4
Release: 0
Summary: A parallel remote execution system
License: Apache-2.0
@ -49,6 +49,7 @@ Source1: README.SUSE
Source2: salt-tmpfiles.d
Source3: html.tar.bz2
Source4: update-documentation.sh
Source5: travis.yml
# PATCH-FIX-OPENSUSE use-forking-daemon.patch tserong@suse.com -- We don't have python-systemd, so notify can't work
# We do not upstream this patch because this is something that we have to fix on our side
@ -73,44 +74,26 @@ Patch6: 0006-Create-salt-proxy-instantiated-service-file.patch
# if Zypper has been used outside the Salt infrastructure
# We do not upstream this because this is for SUSE only (15.08.2016)
Patch7: 0007-Add-zypp-notify-plugin.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/33469
# PR already merged. This will be gone in the next version
Patch8: 0008-checksum-validation-when-zypper-pkg.download.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/33501
# PR already merged. This will be gone in the next version
Patch9: 0009-unit-tests-for-rpm.checksum-and-zypper.download.patch
# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/34599 (backport from dev)
# PR already merged. This will be gone in the next version
Patch10: 0010-snapper-execution-module.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/34165
Patch11: 0011-fix-salt-summary-to-count-not-responding-minions-cor.patch
# PATCH-FIX-OPENSUSE
# We do not upstream this patch because this is suse custom configuration
Patch12: 0012-Run-salt-api-as-user-salt-bsc-990029.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/35196
# PR already merged. This will be gone in the next version
Patch13: 0013-Deprecate-status.uptime-one-version-later.patch
# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/35448
Patch14: 0014-Add-ignore_repo_failure-option-to-suppress-zypper-s-.patch
# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/35451
Patch15: 0015-Remove-zypper-s-raise-exception-if-mod_repo-has-no-a.patch
# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/35763
Patch16: 0016-Improve-Mock-to-be-flexible-and-able-to-mock-methods.patch
# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/36000
Patch17: 0017-Check-for-single-quote-before-splitting-on-single-qu.patch
# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/36139
# https://github.com/saltstack/salt/pull/36158
# https://github.com/saltstack/salt/pull/36227
Patch18: 0018-Unit-tests-fixes-for-2016.3.2.patch
# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/35715
# https://github.com/saltstack/salt/pull/35983
# https://github.com/saltstack/salt/pull/34826
Patch19: 0019-Fix-snapper_test-for-python26.patch
# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/36263
Patch20: 0020-Integration-tests-fixes-for-2016.3.2.patch
# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/36495
Patch21: 0021-Fix-pkg.upgrade-for-zypper.patch
# PATCH-FIX_UPSTREAM
Patch8: 0008-snapper-execution-module.patch
# PATCH-FIX_UPSTREAM
Patch9: 0009-fix-salt-summary-to-count-not-responding-minions-cor.patch
# PATCH-FIX_OPENSUSE
Patch10: 0010-Run-salt-api-as-user-salt-bsc-990029.patch
# PATCH-FIX_UPSTREAM
Patch11: 0011-Fix-snapper_test-for-python26.patch
# PATCH-FIX_UPSTREAM
Patch12: 0012-Fix-pkg.upgrade-for-zypper.patch
# PATCH-FIX_UPSTREAM
Patch13: 0013-Setting-up-OS-grains-for-SLES-Expanded-Support-SUSE-.patch
# PATCH-FIX_UPSTREAM
Patch14: 0014-acl.delfacl-fix-position-of-X-option-to-setfacl.patch
# PATCH-FIX_OPENSUSE
Patch15: 0015-Change-travis-configuration-file-to-use-salt-toaster.patch
# PATCH-FIX_UPSTREAM
Patch16: 0016-Fix-pkg.latest_version-when-latest-already-installed.patch
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/37430
Patch17: 0017-Including-resolver-params-for-Zypper-debug-solver.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: logrotate
@ -152,7 +135,7 @@ BuildRequires: python-xml
%if %{with builddocs}
BuildRequires: python-sphinx
%endif
%if 0%{?suse_version} > 1010
%if 0%{?suse_version} > 1020
BuildRequires: fdupes
%endif
@ -465,6 +448,7 @@ Zsh command line completion support for %{name}.
%prep
%setup -q -n salt-%{version}
cp %{S:1} .
cp %{S:5} ./.travis.yml
%patch1 -p1
%patch2 -p1
%patch3 -p1
@ -486,13 +470,9 @@ cp %{S:1} .
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%build
python setup.py --salt-transport=both build
%{__python} setup.py --salt-transport=both build
%if %{with docs} && %{without builddocs}
# extract docs from the tarball
@ -508,7 +488,7 @@ cd doc && make html && rm _build/html/.buildinfo && rm _build/html/_images/proxy
%endif
%install
python setup.py --salt-transport=both install --prefix=%{_prefix} --root=%{buildroot}
%{__python} setup.py --salt-transport=both install --prefix=%{_prefix} --root=%{buildroot}
## create missing directories
install -Dd -m 0750 %{buildroot}%{_sysconfdir}/salt/master.d
install -Dd -m 0750 %{buildroot}%{_sysconfdir}/salt/minion.d

35
travis.yml Normal file
View File

@ -0,0 +1,35 @@
language: python
python:
- '2.6'
- '2.7'
before_install:
- sudo apt-get update
- sudo apt-get install --fix-broken --ignore-missing -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" swig rabbitmq-server ruby python-apt mysql-server libmysqlclient-dev
- (git describe && git fetch --tags) || (git remote add upstream git://github.com/saltstack/salt.git && git fetch --tags upstream)
- pip install mock
- pip install --allow-external http://dl.dropbox.com/u/174789/m2crypto-0.20.1.tar.gz
- pip install --upgrade pep8 'pylint<=1.2.0'
- pip install --upgrade coveralls
- "if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2 ordereddict; fi"
- pip install git+https://github.com/saltstack/salt-testing.git#egg=SaltTesting
install:
- pip install -r requirements/zeromq.txt -r requirements/cloud.txt
- pip install --allow-all-external -r requirements/opt.txt
before_script:
- "/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pylint --rcfile=.testing.pylintrc salt/ && echo 'Finished Pylint Check Cleanly' || echo 'Finished Pylint Check With Errors'"
- "/home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/pep8 --ignore=E501,E12 salt/ && echo 'Finished PEP-8 Check Cleanly' || echo 'Finished PEP-8 Check With Errors'"
script: "sudo -E /home/travis/virtualenv/python${TRAVIS_PYTHON_VERSION}/bin/python setup.py test --runtests-opts='--run-destructive --sysinfo -v --coverage'"
after_success:
- coveralls
notifications:
irc:
channels: "irc.freenode.org#salt-devel"
on_success: change
on_failure: change