Hello community, here is the log from the commit of package salt for openSUSE:Factory checked in at 2016-09-30 15:34:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/salt (Old) and /work/SRC/openSUSE:Factory/.salt.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "salt" Changes: -------- --- /work/SRC/openSUSE:Factory/salt/salt.changes 2016-05-13 09:24:15.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.salt.new/salt.changes 2016-09-30 15:35:01.000000000 +0200 @@ -1,0 +2,288 @@ +Wed Sep 28 12:35:32 UTC 2016 - [email protected] + +- Rename susemanager plugin to zyppnotify, as it is not SUSE Manager specific +- Remove the subpackage and put the plugin back to the main package + according to upstream + Add: + * 0007-Add-zypp-notify-plugin.patch + Remove: + * 0007-Add-SUSE-Manager-plugin.patch + +------------------------------------------------------------------- +Wed Sep 28 11:40:36 UTC 2016 - [email protected] + +- Add upstream patch to fix pkg.upgrade for zypper + Add: + * 0021-Fix-pkg.upgrade-for-zypper.patch + +------------------------------------------------------------------- +Tue Sep 27 23:55:03 UTC 2016 - [email protected] + +- splitting out the susemanager integration plugins into their own + subpackages. ATM this only contains the zypp plugin to tell + susemanager about manually installed packages. + +------------------------------------------------------------------- +Tue Sep 13 15:07:44 UTC 2016 - [email protected] + +- Unit and integration tests fixes for 2016.3.2 + Add: + * 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 + +------------------------------------------------------------------- +Fri Sep 2 09:50:57 UTC 2016 - [email protected] + +- Prevent pkg.install failure for expired keys (bsc#996455) + Add: + * 0017-Check-for-single-quote-before-splitting-on-single-qu.patch + +------------------------------------------------------------------- +Tue Aug 30 12:24:45 UTC 2016 - [email protected] + +- Required D-Bus and generating machine ID where it is missing + +------------------------------------------------------------------- +Fri Aug 26 13:11:58 UTC 2016 - [email protected] + +- Fix sphinx crashes when documentation is being generated + Add script for documentation update. + + Add: + * 0016-Improve-Mock-to-be-flexible-and-able-to-mock-methods.patch + * update-documentation.sh + +------------------------------------------------------------------- +Tue Aug 16 12:01:59 UTC 2016 - [email protected] + +- Fix pkg.installed refresh repo failure (bsc#993549) + Fix salt.states.pkgrepo.management no change failure (bsc#990440) + Add: + * 0014-Add-ignore_repo_failure-option-to-suppress-zypper-s-.patch + * 0015-Remove-zypper-s-raise-exception-if-mod_repo-has-no-a.patch + +------------------------------------------------------------------- +Tue Aug 9 13:40:37 UTC 2016 - [email protected] + +- Deprecate status.uptime one version later + Add: + * 0013-Deprecate-status.uptime-one-version-later.patch + +------------------------------------------------------------------- +Mon Aug 8 16:25:04 UTC 2016 - [email protected] + +- Fix for 0008-checksum-validation-when-zypper-pkg.download.patch + after upstream merging conflict. Prevent zypper test failure. + Update: + * 0008-checksum-validation-when-zypper-pkg.download.patch + +------------------------------------------------------------------- +Thu Aug 4 14:56:42 UTC 2016 - [email protected] + +- Update to v2016.3.2 + see https://docs.saltstack.com/en/latest/topics/releases/2016.3.2.html +- Removed Patches, applied upstream + * 0010-Getting-the-os-grain-from-CPE_NAME-inside-etc-os-rel.patch + * 0011-snapper-execution-module.patch + * 0012-Force-minion-exit-on-mis-configuration-read.patch + * 0013-fix-salt-summary-to-count-not-responding-minions-cor.patch + * 0014-Move-log-message-from-INFO-to-DEBUG.patch + * 0016-Run-salt-api-as-user-salt-bsc-990029.patch + * 0017-fix-beacon-list-to-include-all-beacons-being-process.patch +- Added Patches back + * 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 + +------------------------------------------------------------------- +Wed Aug 3 14:50:35 UTC 2016 - [email protected] + +- Fix beacon list to include all beacons being process + Add: + * 0017-fix-beacon-list-to-include-all-beacons-being-process.patch + +------------------------------------------------------------------- +Fri Jul 29 11:48:37 UTC 2016 - [email protected] + +- Redo patches, sync with github.com/openSUSE/salt + +- Renamed patches + * 0016-Getting-the-os-grain-from-CPE_NAME-inside-etc-os-rel.patch + -> 0010-Getting-the-os-grain-from-CPE_NAME-inside-etc-os-rel.patch + * 0017-snapper-execution-module.patch + -> 0011-snapper-execution-module.patch + * 0018-Force-minion-exit-on-mis-configuration-read.patch + -> 0012-Force-minion-exit-on-mis-configuration-read.patch + +- Added back (fix upstream merge problems): + * 0008-checksum-validation-when-zypper-pkg.download.patch + * 0009-unit-tests-for-rpm.checksum-and-zypper.download.patch + +- fix salt --summary to count not responding minions correctly + (bsc#972311) + * 0013-fix-salt-summary-to-count-not-responding-minions-cor.patch + +- Move log message from INFO to DEBUG (bsc#985661) + * 0014-Move-log-message-from-INFO-to-DEBUG.patch + +- pkg.list_products on "registerrelease" and "productline" + returns boolean.False if empty (bsc#989193) + * 0015-Bugfix-return-boolean-only-for-isbase-and-installed-.patch + +- Run salt-api as user salt like the master (bsc#990029) + * 0016-Run-salt-api-as-user-salt-bsc-990029.patch + +------------------------------------------------------------------- +Fri Jul 22 15:16:16 UTC 2016 - [email protected] + +- Update to v2016.3.1 + see https://docs.saltstack.com/en/latest/topics/releases/2016.3.1.html +- Removed Patches, applied upstream + * 0008-Prevent-several-minion-processes-on-the-same-machine.patch + * 0009-checksum-validation-when-zypper-pkg.download.patch + * 0010-unit-tests-for-rpm.checksum-and-zypper.download.patch + * 0011-jobs.exit_success-allow-to-check-if-a-job-has-execut.patch + * 0012-Fix-pkgrepo.managed-gpgkey-argument-bsc-979448.patch + * 0013-fix-groupadd-module-for-sles11-systems.patch + * 0014-Fix-crashing-Maintenence-process.patch + * 0015-Insert-no-refresh-before-install-in-Zypper.patch + +------------------------------------------------------------------- +Tue Jul 19 15:03:10 UTC 2016 - [email protected] + +- Bugfix: Exit on configuration read (bsc#985667) + Add: + * 0018-Force-minion-exit-on-mis-configuration-read.patch + +------------------------------------------------------------------- +Mon Jul 18 08:32:04 UTC 2016 - [email protected] + +- Backport: Snapper module for Salt. + Add: + * 0017-snapper-execution-module.patch + +------------------------------------------------------------------- +Wed Jun 22 07:56:44 UTC 2016 - [email protected] + +- Bugfix: Fixed behavior for SUSE OS grains (bsc#970669) + Bugfix: Salt os_family does not detect SLES for SAP (bsc#983017) + Add: + * 0016-Getting-the-os-grain-from-CPE_NAME-inside-etc-os-rel.patch + +------------------------------------------------------------------- +Mon Jun 20 11:26:29 UTC 2016 - [email protected] + +- Insert --no-refresh before install in Zypper + Add: + * 0015-Insert-no-refresh-before-install-in-Zypper.patch + +------------------------------------------------------------------- +Wed Jun 15 11:38:26 UTC 2016 - [email protected] + +- Update to v2016.3.0 + see https://docs.saltstack.com/en/latest/topics/releases/2016.3.0.html + + * backwards-incompatible changes: + - The default path for the extension_modules master config option + has been changed. + +- add 0014-Fix-crashing-Maintenence-process.patch + see release notes + +------------------------------------------------------------------- +Wed Jun 1 09:52:40 UTC 2016 - [email protected] + +- Fix pkgrepo.managed gpgkey argument doesn't work (bsc#979448) + Add: ++++ 91 more lines (skipped) ++++ between /work/SRC/openSUSE:Factory/salt/salt.changes ++++ and /work/SRC/openSUSE:Factory/.salt.new/salt.changes Old: ---- 0006-Update-to-2015.8.8.2.patch 0007-Force-sort-the-RPM-output-to-ensure-latest-version-o.patch 0008-Cleaner-deprecation-process-with-decorators.patch 0009-fix-sorting-by-latest-version-when-called-with-an-at.patch 0010-Prevent-metadata-download-when-getting-installed-pro.patch 0011-Check-if-EOL-is-available-in-a-particular-product-bs.patch 0012-Bugfix-salt-key-crashes-if-tries-to-generate-keys-to.patch 0013-Prevent-crash-if-pygit2-package-is-requesting-re-com.patch 0014-align-OS-grains-from-older-SLES-with-current-one-326.patch 0015-Unblock-Zypper.-Modify-environment.patch 0016-Bugfix-Restore-boolean-values-from-the-repo-configur.patch 0017-Add-SUSE-Manager-plugin.patch salt-2015.8.8.tar.gz New: ---- 0006-Create-salt-proxy-instantiated-service-file.patch 0007-Add-zypp-notify-plugin.patch 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 html.tar.bz2 salt-2016.3.2.tar.gz update-documentation.sh ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ salt.spec ++++++ --- /var/tmp/diff_new_pack.7y20QC/_old 2016-09-30 15:35:06.000000000 +0200 +++ /var/tmp/diff_new_pack.7y20QC/_new 2016-09-30 15:35:06.000000000 +0200 @@ -34,54 +34,83 @@ %bcond_with test %bcond_with raet %bcond_without docs +%bcond_with builddocs Name: salt -Version: 2015.8.8 +Version: 2016.3.2 Release: 0 Summary: A parallel remote execution system License: Apache-2.0 Group: System/Monitoring Url: http://saltstack.org/ # Git: https://github.com/openSUSE/salt.git -Source0: http://pypi.python.org/packages/source/s/%{name}/%{name}-%{version}.tar.gz +Source0: https://pypi.io/packages/source/s/%{name}/%{name}-%{version}.tar.gz Source1: README.SUSE Source2: salt-tmpfiles.d +Source3: html.tar.bz2 +Source4: update-documentation.sh # PATCH-FIX-OPENSUSE use-forking-daemon.patch [email protected] -- 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 Patch1: 0001-tserong-suse.com-We-don-t-have-python-systemd-so-not.patch # PATCH-FIX-OPENSUSE use-salt-user-for-master.patch -- Run salt master as dedicated salt user +# We do not upstream this patch because this is suse custom configuration Patch2: 0002-Run-salt-master-as-dedicated-salt-user.patch # PATCH-FIX-OPENSUSE https://github.com/saltstack/salt/pull/30424 +# We do not upstream this patch because it has been fixed upstream +# (see: https://trello.com/c/wh96lCD4/1528-get-rid-of-0003-check-if-byte-strings-are-properly-encoded-in-utf-8-patch-in-the-salt-package) Patch3: 0003-Check-if-byte-strings-are-properly-encoded-in-UTF-8.patch # PATCH-FIX-OPENSUSE prevent rebuilds in OBS +# We do not upstream this patch because the issue is on our side Patch4: 0004-do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch # PATCH-FIX-OPENSUSE - Upstream default hash type is set to MD5, while we require SHA256 (bsc#955373) +# PR https://github.com/saltstack/salt/pull/35341 (15.08.2016 - not merged yet) Patch5: 0005-Use-SHA256-hash-type-by-default.patch -# PATCH-FIX-UPSTREAM https://docs.saltstack.com/en/latest/topics/releases/2015.8.8.html#salt-2015-8-8-2 -Patch6: 0006-Update-to-2015.8.8.2.patch -# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/32243 -Patch7: 0007-Force-sort-the-RPM-output-to-ensure-latest-version-o.patch -# PATCH-FIX-UPSTREAM https://github.com/saltstack/salt/pull/32068 -Patch8: 0008-Cleaner-deprecation-process-with-decorators.patch -# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/32323 -Patch9: 0009-fix-sorting-by-latest-version-when-called-with-an-at.patch -# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/32353 -Patch10: 0010-Prevent-metadata-download-when-getting-installed-pro.patch -# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/32505 -Patch11: 0011-Check-if-EOL-is-available-in-a-particular-product-bs.patch -# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/32436 -Patch12: 0012-Bugfix-salt-key-crashes-if-tries-to-generate-keys-to.patch -# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/32652 -Patch13: 0013-Prevent-crash-if-pygit2-package-is-requesting-re-com.patch -# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/32649 -Patch14: 0014-align-OS-grains-from-older-SLES-with-current-one-326.patch -# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/32892 -Patch15: 0015-Unblock-Zypper.-Modify-environment.patch -# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/33088 -Patch16: 0016-Bugfix-Restore-boolean-values-from-the-repo-configur.patch +# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/31798 +# PR already merged. This will be gone in the next version +Patch6: 0006-Create-salt-proxy-instantiated-service-file.patch # PATCH-FIX-OPENSUSE Generate events from the Salt minion, # if Zypper has been used outside the Salt infrastructure -Patch17: 0017-Add-SUSE-Manager-plugin.patch +# 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 + BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: logrotate @@ -120,17 +149,27 @@ BuildRequires: python-unittest2 BuildRequires: python-xml %endif -%if %{with docs} -#for docs +%if %{with builddocs} BuildRequires: python-sphinx %endif +%if 0%{?suse_version} > 1010 +BuildRequires: fdupes +%endif Requires(pre): %{_sbindir}/groupadd Requires(pre): %{_sbindir}/useradd + %if 0%{?suse_version} Requires(pre): %fillup_prereq Requires(pre): pwdutils %endif + +%if 0%{?suse_version} +Requires(pre): dbus-1 +%else +Requires(pre): dbus +%endif + Requires: logrotate Requires: python # @@ -432,7 +471,11 @@ %patch4 -p1 %patch5 -p1 %patch6 -p1 + +# This is SUSE-only patch +%if 0%{?suse_version} %patch7 -p1 +%endif %patch8 -p1 %patch9 -p1 %patch10 -p1 @@ -442,16 +485,24 @@ %patch14 -p1 %patch15 -p1 %patch16 -p1 - -# This is SUSE-only patch -%if 0%{?suse_version} %patch17 -p1 -%endif +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 %build python setup.py --salt-transport=both build -%if %{with docs} +%if %{with docs} && %{without builddocs} +# extract docs from the tarball +mkdir -p doc/_build +pushd doc/_build/ +tar xfv %{S:3} +popd +%endif + +%if %{with docs} && %{with builddocs} ## documentation cd doc && make html && rm _build/html/.buildinfo && rm _build/html/_images/proxy_minions.png && cd _build/html && chmod -R -x+X * %endif @@ -498,7 +549,7 @@ ## Install Zypper plugins only on SUSE machines %if 0%{?suse_version} install -Dd -m 0750 %{buildroot}%{_prefix}/lib/zypp/plugins/commit -%{__install} scripts/zypper/plugins/commit/susemanager %{buildroot}%{_prefix}/lib/zypp/plugins/commit/susemanager +%{__install} scripts/zypper/plugins/commit/zyppnotify %{buildroot}%{_prefix}/lib/zypp/plugins/commit/zyppnotify %endif ## install init and systemd scripts @@ -507,6 +558,7 @@ install -Dpm 0644 pkg/salt-minion.service %{buildroot}%{_unitdir}/salt-minion.service install -Dpm 0644 pkg/salt-syndic.service %{buildroot}%{_unitdir}/salt-syndic.service install -Dpm 0644 pkg/salt-api.service %{buildroot}%{_unitdir}/salt-api.service +install -Dpm 0644 pkg/[email protected] %{buildroot}%{_unitdir}/[email protected] ln -s service %{buildroot}%{_sbindir}/rcsalt-master ln -s service %{buildroot}%{_sbindir}/rcsalt-syndic ln -s service %{buildroot}%{_sbindir}/rcsalt-minion @@ -558,6 +610,11 @@ echo "transport: raet" > %{buildroot}%{_sysconfdir}/salt/master.d/transport-raet.conf echo "transport: raet" > %{buildroot}%{_sysconfdir}/salt/minion.d/transport-raet.conf +%if 0%{?suse_version} > 1020 +%fdupes %{buildroot}%{_docdir} +%fdupes %{buildroot}%{python_sitelib} +%endif + %check %if %{with test} python setup.py test --runtests-opts=-u @@ -567,9 +624,50 @@ getent group salt >/dev/null || %{_sbindir}/groupadd -r salt getent passwd salt >/dev/null || %{_sbindir}/useradd -r -g salt -d /srv/salt -s /bin/false -c "salt-master daemon" salt -%if %{with systemd} %post +%if %{with systemd} systemd-tmpfiles --create /usr/lib/tmpfiles.d/salt.conf || true +%else +dbus-uuidgen --ensure +%endif + +%preun proxy +%if %{with systemd} +%service_del_preun [email protected] +%else +%if 0%{?suse_version} +%stop_on_removal salt-proxy +%else + if [ $1 -eq 0 ] ; then + /sbin/service salt-proxy stop >/dev/null 2>&1 + /sbin/chkconfig --del salt-proxy + fi +%endif +%endif + +%pre proxy +%if %{with systemd} +%service_add_pre [email protected] +%endif + +%post proxy +%if %{with systemd} +%service_add_post [email protected] +%fillup_only +%else +%if 0%{?suse_version} +%fillup_and_insserv +%endif +%endif + +%postun proxy +%if %{with systemd} +%service_del_postun [email protected] +%else +%if 0%{?suse_version} +%insserv_cleanup +%restart_on_update salt-proxy +%endif %endif %preun syndic @@ -631,6 +729,20 @@ %endif %post master +if [ $1 -eq 2 ] ; then + # Upgrading from an earlier version. If this is from 2014, where daemons + # ran as root, we need to chown some stuff to salt in order for the new + # version to actually work. It seems a manual restart of salt-master may + # still be required, but at least this will actually work given the file + # ownership is correct. + for file in master.{pem,pub} ; do + [ -f /etc/salt/pki/master/$file ] && chown salt /etc/salt/pki/master/$file + done + for dir in file_lists minions jobs ; do + [ -d /var/cache/salt/master/$dir ] && chown -R salt:salt /var/cache/salt/master/$dir + done + true +fi %if %{with systemd} %service_add_post salt-master.service %fillup_only @@ -779,11 +891,12 @@ %dir %attr(0750, root, root) %{_sysconfdir}/salt/minion.d/ %dir %attr(0750, root, root) %{_sysconfdir}/salt/pki/minion/ %dir %attr(0750, root, root) %{_localstatedir}/cache/salt/minion/ +#%dir %ghost %attr(0750, root, salt) %{_localstatedir}/run/salt/minion %{_sbindir}/rcsalt-minion # Install plugin only on SUSE machines %if 0%{?suse_version} -%{_prefix}/lib/zypp/plugins/commit/susemanager +%{_prefix}/lib/zypp/plugins/commit/zyppnotify %endif %if %{with systemd} @@ -796,6 +909,9 @@ %defattr(-,root,root) %{_bindir}/salt-proxy %{_mandir}/man1/salt-proxy.1.gz +%if %{with systemd} +%{_unitdir}/[email protected] +%endif %files master %defattr(-,root,root) @@ -835,6 +951,7 @@ %dir %attr(0750, salt, salt) %{_localstatedir}/cache/salt/master/roots/ %dir %attr(0750, salt, salt) %{_localstatedir}/cache/salt/master/syndics/ %dir %attr(0750, salt, salt) %{_localstatedir}/cache/salt/master/tokens/ +#%dir %ghost %attr(0750, salt, salt) %{_localstatedir}/run/salt/master/ %files raet %defattr(-,root,root,-) @@ -848,6 +965,7 @@ %{_bindir}/salt-unity %{_mandir}/man1/salt-unity.1.gz %{_mandir}/man1/salt-call.1.gz +%{_mandir}/man1/spm.1.gz %config(noreplace) %{_sysconfdir}/logrotate.d/salt %{python_sitelib}/* %exclude %{python_sitelib}/salt/cloud/deploy/*.sh @@ -858,6 +976,7 @@ %dir %attr(0750, root, salt) %{_sysconfdir}/salt/pki %dir %attr(0750, salt, salt) %{_localstatedir}/log/salt %dir %attr(0750, root, salt) %{_localstatedir}/cache/salt +#%dir %ghost %attr(0750, root, salt) %{_localstatedir}/run/salt %dir %attr(0750, root, salt) /srv/spm %if %{with systemd} /usr/lib/tmpfiles.d/salt.conf ++++++ 0001-tserong-suse.com-We-don-t-have-python-systemd-so-not.patch ++++++ --- /var/tmp/diff_new_pack.7y20QC/_old 2016-09-30 15:35:07.000000000 +0200 +++ /var/tmp/diff_new_pack.7y20QC/_new 2016-09-30 15:35:07.000000000 +0200 @@ -1,7 +1,7 @@ -From f9dbfde1c3e7782d78f6b0b2b6b564f61749941f Mon Sep 17 00:00:00 2001 +From 3f8257601cb1224221e10e712c0377254714f6fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <[email protected]> Date: Wed, 20 Jan 2016 11:00:15 +0100 -Subject: [PATCH 01/12] [email protected] -- We don't have python-systemd, so +Subject: [PATCH 01/13] [email protected] -- We don't have python-systemd, so notify can't work --- @@ -9,7 +9,7 @@ 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/salt-master.service b/pkg/salt-master.service -index 0eadf88..2b0f326 100644 +index 0eadf88a3837..2b0f32623571 100644 --- a/pkg/salt-master.service +++ b/pkg/salt-master.service @@ -4,8 +4,7 @@ After=network.target @@ -23,5 +23,5 @@ KillMode=process -- -2.1.4 +2.8.3 ++++++ 0002-Run-salt-master-as-dedicated-salt-user.patch ++++++ --- /var/tmp/diff_new_pack.7y20QC/_old 2016-09-30 15:35:07.000000000 +0200 +++ /var/tmp/diff_new_pack.7y20QC/_new 2016-09-30 15:35:07.000000000 +0200 @@ -1,7 +1,7 @@ -From af193a109fcae502c4cdd47507aea9f67d809b4b Mon Sep 17 00:00:00 2001 +From e86b0bf279c7faea457dfb8152fe9f5c829e42be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaus=20K=C3=A4mpf?= <[email protected]> Date: Wed, 20 Jan 2016 11:01:06 +0100 -Subject: [PATCH 02/12] Run salt master as dedicated salt user +Subject: [PATCH 02/13] Run salt master as dedicated salt user --- conf/master | 3 ++- @@ -9,7 +9,7 @@ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/conf/master b/conf/master -index aae46ef..064828a 100644 +index 1bbeb50c51b4..54d5f8f3ca75 100644 --- a/conf/master +++ b/conf/master @@ -25,7 +25,8 @@ @@ -23,7 +23,7 @@ # 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 3cd0023..8d970c0 100644 +index 3cd002308e83..8d970c0a64d0 100644 --- a/pkg/salt-common.logrotate +++ b/pkg/salt-common.logrotate @@ -1,4 +1,5 @@ @@ -49,5 +49,5 @@ missingok rotate 7 -- -2.1.4 +2.8.3 ++++++ 0003-Check-if-byte-strings-are-properly-encoded-in-UTF-8.patch ++++++ --- /var/tmp/diff_new_pack.7y20QC/_old 2016-09-30 15:35:07.000000000 +0200 +++ /var/tmp/diff_new_pack.7y20QC/_new 2016-09-30 15:35:07.000000000 +0200 @@ -1,4 +1,4 @@ -From 6035aef0c80ae12a068bee7613c5b7f7f48aa9d3 Mon Sep 17 00:00:00 2001 +From cad9f1a8fda2a4d8c666abcf74e03e7c6a8eb6be Mon Sep 17 00:00:00 2001 From: Bo Maryniuk <[email protected]> Date: Mon, 18 Jan 2016 16:28:48 +0100 Subject: [PATCH 03/12] Check if byte strings are properly encoded in UTF-8 @@ -9,10 +9,10 @@ 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py -index fecb671..27b00d5 100644 +index 7dd73dd..92c604e 100644 --- a/salt/modules/zypper.py +++ b/salt/modules/zypper.py -@@ -164,9 +164,9 @@ def info_installed(*names, **kwargs): +@@ -335,9 +335,9 @@ def info_installed(*names, **kwargs): summary, description. :param errors: @@ -25,7 +25,7 @@ Valid attributes are: ignore, report -@@ -179,7 +179,8 @@ def info_installed(*names, **kwargs): +@@ -350,7 +350,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 @@ ''' ret = dict() for pkg_name, pkg_nfo in __salt__['lowpkg.info'](*names, **kwargs).items(): -@@ -190,7 +191,7 @@ def info_installed(*names, **kwargs): +@@ -361,7 +362,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 @@ if key == 'source_rpm': t_nfo['source'] = value -- -2.1.4 +2.9.2 ++++++ 0004-do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch ++++++ --- /var/tmp/diff_new_pack.7y20QC/_old 2016-09-30 15:35:07.000000000 +0200 +++ /var/tmp/diff_new_pack.7y20QC/_new 2016-09-30 15:35:07.000000000 +0200 @@ -1,7 +1,7 @@ -From a2ffa8e54f3cd8dba3c4b73cad086a6b93fb3a41 Mon Sep 17 00:00:00 2001 +From a831380a6d7f323c9824d26d6f6e5966b10cbc6e Mon Sep 17 00:00:00 2001 From: Michael Calmer <[email protected]> Date: Fri, 4 Mar 2016 09:51:22 +0100 -Subject: [PATCH 04/12] do not generate a date in a comment to prevent rebuilds +Subject: [PATCH 04/13] do not generate a date in a comment to prevent rebuilds (bsc#969407) --- @@ -9,10 +9,10 @@ 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py -index 742eae5..d2dd8f7 100755 +index c84c19824a6f..819ec2b875d1 100755 --- a/setup.py +++ b/setup.py -@@ -605,8 +605,7 @@ class Clean(clean): +@@ -618,8 +618,7 @@ class Clean(clean): INSTALL_VERSION_TEMPLATE = '''\ @@ -23,5 +23,5 @@ from salt.version import SaltStackVersion -- -2.1.4 +2.8.3 ++++++ 0005-Use-SHA256-hash-type-by-default.patch ++++++ --- /var/tmp/diff_new_pack.7y20QC/_old 2016-09-30 15:35:07.000000000 +0200 +++ /var/tmp/diff_new_pack.7y20QC/_new 2016-09-30 15:35:07.000000000 +0200 @@ -1,4 +1,4 @@ -From d5fc00efc2f73018c4c6bf3bea03648dfd1340fc Mon Sep 17 00:00:00 2001 +From 03732c6879c45596b0a9a0e6500957ec4f9d8415 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk <[email protected]> Date: Thu, 17 Mar 2016 12:30:23 +0100 Subject: [PATCH 05/12] Use SHA256 hash type by default @@ -10,10 +10,10 @@ 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/master b/conf/master -index 064828a..5e75b15 100644 +index 8bbe490..118f53b 100644 --- a/conf/master +++ b/conf/master -@@ -474,7 +474,7 @@ syndic_user: salt +@@ -509,7 +509,7 @@ syndic_user: salt # # Prior to changing this value, the master should be stopped and all Salt # caches should be cleared. @@ -23,10 +23,10 @@ # The buffer size in the file server can be adjusted here: #file_buffer_size: 1048576 diff --git a/conf/minion b/conf/minion -index b408942..32b0d0a 100644 +index 3ba8ba0..8e4dbd0 100644 --- a/conf/minion +++ b/conf/minion -@@ -451,7 +451,7 @@ +@@ -542,7 +542,7 @@ # # Warning: Prior to changing this value, the minion should be stopped and all # Salt caches should be cleared. @@ -36,10 +36,10 @@ # 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 e6ca631..e697357 100644 +index 7b835e2..ab500f9 100644 --- a/conf/proxy +++ b/conf/proxy -@@ -427,7 +427,7 @@ +@@ -435,7 +435,7 @@ # # Warning: Prior to changing this value, the minion should be stopped and all # Salt caches should be cleared. @@ -49,5 +49,5 @@ # 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.1.4 +2.9.2 ++++++ 0006-Create-salt-proxy-instantiated-service-file.patch ++++++ >From 46476c37aa00d9cbbd0ac58e56b7e1c134d33b13 Mon Sep 17 00:00:00 2001 From: Christian McHugh <[email protected]> Date: Thu, 10 Mar 2016 13:25:01 -0600 Subject: [PATCH 06/13] Create salt-proxy instantiated service file Add a systemd service file for salt-proxy. Instantiate a new proxy service with proxyid=p8000: # systemctl enable salt-proxy\@p8000.service # systemctl start salt-proxy\@p8000.service --- pkg/[email protected] | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 pkg/[email protected] diff --git a/pkg/[email protected] b/pkg/[email protected] new file mode 100644 index 000000000000..f97120a05589 --- /dev/null +++ b/pkg/[email protected] @@ -0,0 +1,12 @@ +[Unit] +Description=salt-proxy service +After=network.target + +[Service] +ExecStart=/usr/bin/salt-proxy --proxyid=%I +Type=simple +Restart=on-failure +RestartSec=5s + +[Install] +WantedBy=multi-user.target -- 2.8.3 ++++++ 0007-Add-zypp-notify-plugin.patch ++++++ >From c0aacf83fa51015fb6e50ab96204a7b3c31413a8 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk <[email protected]> Date: Mon, 9 May 2016 10:33:44 +0200 Subject: [PATCH 07/21] Add zypp-notify plugin * Add unit test to the libzypp drift detector plugin --- scripts/zypper/plugins/commit/README.md | 3 ++ scripts/zypper/plugins/commit/zyppnotify | 59 +++++++++++++++++++++++++++++ tests/unit/zypp_plugins_test.py | 51 +++++++++++++++++++++++++ tests/zypp_plugin.py | 64 ++++++++++++++++++++++++++++++++ 4 files changed, 177 insertions(+) create mode 100644 scripts/zypper/plugins/commit/README.md create mode 100755 scripts/zypper/plugins/commit/zyppnotify create mode 100644 tests/unit/zypp_plugins_test.py create mode 100644 tests/zypp_plugin.py diff --git a/scripts/zypper/plugins/commit/README.md b/scripts/zypper/plugins/commit/README.md new file mode 100644 index 0000000..01c8917 --- /dev/null +++ b/scripts/zypper/plugins/commit/README.md @@ -0,0 +1,3 @@ +# Zypper plugins + +Plugins here are required to interact with SUSE Manager in conjunction of SaltStack and Zypper. diff --git a/scripts/zypper/plugins/commit/zyppnotify b/scripts/zypper/plugins/commit/zyppnotify new file mode 100755 index 0000000..268298b --- /dev/null +++ b/scripts/zypper/plugins/commit/zyppnotify @@ -0,0 +1,59 @@ +#!/usr/bin/python +# +# Copyright (c) 2016 SUSE Linux LLC +# All Rights Reserved. +# +# Author: Bo Maryniuk <[email protected]> + +import sys +import os +import hashlib + +from zypp_plugin import Plugin + + +class DriftDetector(Plugin): + """ + Return diff of the installed packages outside the Salt. + """ + def __init__(self): + Plugin.__init__(self) + self.ck_path = "/var/cache/salt/minion/rpmdb.cookie" + self.rpm_path = "/var/lib/rpm/Packages" + + def _get_mtime(self): + ''' + Get the modified time of the RPM Database. + Returns: + Unix ticks + ''' + return os.path.exists(self.rpm_path) and int(os.path.getmtime(self.rpm_path)) or 0 + + def _get_checksum(self): + ''' + Get the checksum of the RPM Database. + Returns: + hexdigest + ''' + digest = hashlib.md5() + with open(self.rpm_path, "rb") as rpm_db_fh: + while True: + buff = rpm_db_fh.read(0x1000) + if not buff: + break + digest.update(buff) + + return digest.hexdigest() + + def PLUGINEND(self, headers, body): + """ + Hook when plugin closes Zypper's transaction. + """ + if 'SALT_RUNNING' not in os.environ: + with open(self.ck_path, 'w') as ck_fh: + ck_fh.write('{chksum} {mtime}\n'.format(chksum=self._get_checksum(), mtime=self._get_mtime())) + + self.ack() + + +DriftDetector().main() diff --git a/tests/unit/zypp_plugins_test.py b/tests/unit/zypp_plugins_test.py new file mode 100644 index 0000000..550403c --- /dev/null +++ b/tests/unit/zypp_plugins_test.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +''' + :codeauthor: :email:`Bo Maryniuk <[email protected]>` +''' + +# Import Python Libs +from __future__ import absolute_import + +# Import Salt Testing Libs +from salttesting.helpers import ensure_in_syspath +from salttesting import TestCase, skipIf +from salttesting.mock import ( + MagicMock, + patch, + NO_MOCK, + NO_MOCK_REASON +) + +ensure_in_syspath('../') + +import os +import imp +from zypp_plugin import BogusIO + +zyppnotify = imp.load_source('zyppnotify', os.path.sep.join(os.path.dirname(__file__).split( + os.path.sep)[:-2] + ['scripts', 'zypper', 'plugins', 'commit', 'zyppnotify'])) + +@skipIf(NO_MOCK, NO_MOCK_REASON) +class ZyppPluginsTestCase(TestCase): + ''' + Test shipped libzypp plugins. + ''' + def test_drift_detector(self): + ''' + Test drift detector for a correct cookie file. + Returns: + + ''' + drift = zyppnotify.DriftDetector() + drift._get_mtime = MagicMock(return_value=123) + drift._get_checksum = MagicMock(return_value='deadbeef') + bogus_io = BogusIO() + with patch('zyppnotify.open', bogus_io): + drift.PLUGINEND(None, None) + self.assertEqual(str(bogus_io), 'deadbeef 123\n') + self.assertEqual(bogus_io.mode, 'w') + self.assertEqual(bogus_io.path, '/var/cache/salt/minion/rpmdb.cookie') + +if __name__ == '__main__': + from integration import run_tests + run_tests(ZyppPluginsTestCase, needs_daemon=False) diff --git a/tests/zypp_plugin.py b/tests/zypp_plugin.py new file mode 100644 index 0000000..218f703 --- /dev/null +++ b/tests/zypp_plugin.py @@ -0,0 +1,64 @@ +''' +Related to zypp_plugins_test.py module. +''' + + +class Plugin(object): + ''' + Bogus module for Zypp Plugins tests. + ''' + def ack(self): + ''' + Acknowledge that the plugin had finished the transaction + Returns: + + ''' + + def main(self): + ''' + Register plugin + Returns: + + ''' + + +class BogusIO(object): + ''' + Read/write logger. + ''' + + def __init__(self): + self.content = list() + self.closed = False + + def __str__(self): + return '\n'.join(self.content) + + def __call__(self, *args, **kwargs): + self.path, self.mode = args + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + self.close() + + def __enter__(self): + return self + + def write(self, data): + ''' + Simulate writing data + Args: + data: + + Returns: + + ''' + self.content.append(data) + + def close(self): + ''' + Simulate closing the IO object. + Returns: + + ''' + self.closed = True -- 2.10.0 ++++++ 0008-checksum-validation-when-zypper-pkg.download.patch ++++++ >From c80528b9aad5305b06a07cadf752a45392d4a147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= <[email protected]> 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 ++++++ 0009-unit-tests-for-rpm.checksum-and-zypper.download.patch ++++++ >From f186137c0eb7a14697037bf46ec6a12287b9e0c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= <[email protected]> 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 ++++++ 0010-snapper-execution-module.patch ++++++ ++++ 1278 lines (skipped) ++++++ 0011-fix-salt-summary-to-count-not-responding-minions-cor.patch ++++++ >From e3969a80bdf2d0af0c87463af859d8daf314f018 Mon Sep 17 00:00:00 2001 From: Michael Calmer <[email protected]> Date: Tue, 21 Jun 2016 13:12:48 +0200 Subject: [PATCH 11/12] 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. --- salt/cli/salt.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/salt/cli/salt.py b/salt/cli/salt.py index baeaf23..ec18f2e 100644 --- a/salt/cli/salt.py +++ b/salt/cli/salt.py @@ -264,7 +264,9 @@ class SaltCMD(parsers.SaltCMDOptionParser): not_connected_minions = [] failed_minions = [] for each_minion in ret: - minion_ret = ret[each_minion].get('ret') + minion_ret = ret[each_minion] + if (isinstance(minion_ret, dict) and 'ret' in minion_ret): + minion_ret = ret[each_minion].get('ret') if ( isinstance(minion_ret, string_types) and minion_ret.startswith("Minion did not return") -- 2.9.2 ++++++ 0012-Run-salt-api-as-user-salt-bsc-990029.patch ++++++ >From af2ff55739187c59dc04e396b7787301a49a9dba Mon Sep 17 00:00:00 2001 From: Michael Calmer <[email protected]> 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 ++++++ 0013-Deprecate-status.uptime-one-version-later.patch ++++++ >From d19c9591c1dfbafec24a7d76402dcc9e2b17b047 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk <[email protected]> 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 ++++++ 0014-Add-ignore_repo_failure-option-to-suppress-zypper-s-.patch ++++++ >From f860f7ccb3dba6b8f0cef61e2d9658a3116e3c3c Mon Sep 17 00:00:00 2001 From: Bo Maryniuk <[email protected]> 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 ++++++ 0015-Remove-zypper-s-raise-exception-if-mod_repo-has-no-a.patch ++++++ >From 0809c60c693eb5d2e9569c24d995818097c6920d Mon Sep 17 00:00:00 2001 From: Bo Maryniuk <[email protected]> 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 ++++++ 0016-Improve-Mock-to-be-flexible-and-able-to-mock-methods.patch ++++++ >From 50865e300e6e90c5cc80c8878949a2f3bcaaeeec Mon Sep 17 00:00:00 2001 From: Bo Maryniuk <[email protected]> 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 ++++++ 0017-Check-for-single-quote-before-splitting-on-single-qu.patch ++++++ >From e9b4a199f48abc94be71082c56b6b059c6694dc0 Mon Sep 17 00:00:00 2001 From: Eric Jackson <[email protected]> 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 <[email protected]> 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 ++++++ 0018-Unit-tests-fixes-for-2016.3.2.patch ++++++ ++++ 927 lines (skipped) ++++++ 0019-Fix-snapper_test-for-python26.patch ++++++ >From df1f88c51a40e69935830d1664a46dadf514dc69 Mon Sep 17 00:00:00 2001 From: Justin Anderson <[email protected]> Date: Tue, 23 Aug 2016 15:02:31 -0600 Subject: [PATCH 19/19] Fix snapper_test for python26 * Use assertCountEqual instead of assertItemsEqual for Python 3 * Skip one Snapper test on 2.6 There's a slight difference in the diff comparison but we should be able to catch true failures here with 2.7. --- tests/unit/modules/snapper_test.py | 41 ++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/tests/unit/modules/snapper_test.py b/tests/unit/modules/snapper_test.py index f27b2ba..43f8898 100644 --- a/tests/unit/modules/snapper_test.py +++ b/tests/unit/modules/snapper_test.py @@ -6,19 +6,26 @@ Unit tests for the Snapper module :codeauthor: Pablo Suárez Hernández <[email protected]> ''' +# Import Python libs from __future__ import absolute_import +import sys -from salttesting import TestCase +# Import Salt Testing libs +from salttesting import TestCase, skipIf from salttesting.mock import ( + NO_MOCK, + NO_MOCK_REASON, MagicMock, patch, mock_open, ) - -from salt.exceptions import CommandExecutionError from salttesting.helpers import ensure_in_syspath + ensure_in_syspath('../../') +# Import Salt libs +import salt.ext.six as six +from salt.exceptions import CommandExecutionError from salt.modules import snapper # Globals @@ -123,6 +130,13 @@ MODULE_RET = { "@@ -0,0 +1 @@\n" "+another foobar", }, + '/tmp/foo26': { + 'comment': 'text file created', + 'diff': "--- /.snapshots/55/snapshot/tmp/foo2 \n" + "+++ /tmp/foo2 \n" + "@@ -1,0 +1,1 @@\n" + "+another foobar", + }, '/tmp/foo3': { 'comment': 'binary file changed', 'old_sha256_digest': 'e61f8b762d83f3b4aeb3689564b0ffbe54fa731a69a1e208dc9440ce0f69d19b', @@ -132,6 +146,7 @@ MODULE_RET = { } +@skipIf(NO_MOCK, NO_MOCK_REASON) class SnapperTestCase(TestCase): def setUp(self): self.dbus_mock = MagicMock() @@ -220,10 +235,16 @@ class SnapperTestCase(TestCase): @patch('salt.modules.snapper.snapper.GetComparison', MagicMock()) @patch('salt.modules.snapper.snapper.GetFiles', MagicMock(return_value=DBUS_RET['GetFiles'])) def test_status(self): - self.assertItemsEqual(snapper.status(), MODULE_RET['GETFILES']) - self.assertItemsEqual(snapper.status(num_pre="42", num_post=43), MODULE_RET['GETFILES']) - self.assertItemsEqual(snapper.status(num_pre=42), MODULE_RET['GETFILES']) - self.assertItemsEqual(snapper.status(num_post=43), MODULE_RET['GETFILES']) + if six.PY3: + self.assertCountEqual(snapper.status(), MODULE_RET['GETFILES']) + self.assertCountEqual(snapper.status(num_pre="42", num_post=43), MODULE_RET['GETFILES']) + self.assertCountEqual(snapper.status(num_pre=42), MODULE_RET['GETFILES']) + self.assertCountEqual(snapper.status(num_post=43), MODULE_RET['GETFILES']) + else: + self.assertItemsEqual(snapper.status(), MODULE_RET['GETFILES']) + self.assertItemsEqual(snapper.status(num_pre="42", num_post=43), MODULE_RET['GETFILES']) + self.assertItemsEqual(snapper.status(num_pre=42), MODULE_RET['GETFILES']) + self.assertItemsEqual(snapper.status(num_post=43), MODULE_RET['GETFILES']) @patch('salt.modules.snapper.status', MagicMock(return_value=MODULE_RET['GETFILES'])) def test_changed_files(self): @@ -268,7 +289,10 @@ class SnapperTestCase(TestCase): @patch('os.path.isfile', MagicMock(side_effect=[False, True])) @patch('salt.utils.fopen', mock_open(read_data=FILE_CONTENT["/tmp/foo2"]['post'])) def test_diff_text_file(self): - self.assertEqual(snapper.diff(), {"/tmp/foo2": MODULE_RET['DIFF']['/tmp/foo2']}) + if sys.version_info < (2, 7): + self.assertEqual(snapper.diff(), {"/tmp/foo2": MODULE_RET['DIFF']['/tmp/foo26']}) + else: + self.assertEqual(snapper.diff(), {"/tmp/foo2": MODULE_RET['DIFF']['/tmp/foo2']}) @patch('salt.modules.snapper._get_num_interval', MagicMock(return_value=(55, 0))) @patch('salt.modules.snapper.snapper.MountSnapshot', MagicMock( @@ -278,6 +302,7 @@ class SnapperTestCase(TestCase): @patch('salt.modules.snapper._is_text_file', MagicMock(return_value=True)) @patch('os.path.isfile', MagicMock(side_effect=[True, True, False, True])) @patch('os.path.isdir', MagicMock(return_value=False)) + @skipIf(sys.version_info < (2, 7), 'Python 2.7 required to compare diff properly') def test_diff_text_files(self): fopen_effect = [ mock_open(read_data=FILE_CONTENT["/tmp/foo"]['pre']).return_value, -- 2.8.2 ++++++ 0020-Integration-tests-fixes-for-2016.3.2.patch ++++++ >From 65dba3e9ab088087943f67367dc27fce00e4cd92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= <[email protected]> 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 ++++++ 0021-Fix-pkg.upgrade-for-zypper.patch ++++++ >From 2cac0c3839af12b0a474f4cb0c0854995cd8dc2a Mon Sep 17 00:00:00 2001 From: "C. R. Oldham" <[email protected]> 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 ++++++ salt-2015.8.8.tar.gz -> salt-2016.3.2.tar.gz ++++++ /work/SRC/openSUSE:Factory/salt/salt-2015.8.8.tar.gz /work/SRC/openSUSE:Factory/.salt.new/salt-2016.3.2.tar.gz differ: char 5, line 1 ++++++ update-documentation.sh ++++++ #!/bin/bash # # Update html.tar.bz2 documentation tarball # Author: Bo Maryniuk <[email protected]> # function check_env() { for cmd in "sphinx-build" "make" "quilt"; do if [ -z "$(which $cmd 2>/dev/null)" ]; then echo "Error: '$cmd' is missing." exit 1; fi done } function quilt_setup() { quilt setup salt.spec cd $1 quilt push -a } function build_docs() { cd $1 make html rm _build/html/.buildinfo cd _build/html chmod -R -x+X * cd .. tar cvf - html | bzip2 > /tmp/html.tar.bz2 } function write_changelog() { mv salt.changes salt.changes.previous TIME=$(date -u +'%a %b %d %T %Z %Y') MAIL=$1 SEP="-------------------------------------------------------------------" cat <<EOF > salt.changes $SEP $TIME - $MAIL - Updated html.tar.bz2 documentation tarball. EOF cat salt.changes.previous >> salt.changes rm salt.changes.previous } if [ -z "$1" ]; then echo "Usage: $0 <your e-mail>" exit 1; fi check_env; START=$(pwd) SRC_DIR="salt-$(cat salt.spec | grep ^Version: | cut -d: -f2 | sed -e 's/[[:blank:]]//g')"; quilt_setup $SRC_DIR build_docs doc cd $START rm -rf $SRC_DIR mv /tmp/html.tar.bz2 $START echo "Done" echo "---------------"
