Accepting request 517184 from systemsmanagement:saltstack
1 OBS-URL: https://build.opensuse.org/request/show/517184 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/salt?expand=0&rev=64
This commit is contained in:
commit
487b8d0a65
@ -1,35 +0,0 @@
|
||||
From 69eeaf17252a2912ed33f2160c14282c2ff703bc Mon Sep 17 00:00:00 2001
|
||||
From: Bo Maryniuk <bo@suse.de>
|
||||
Date: Wed, 18 Jan 2017 15:38:53 +0100
|
||||
Subject: [PATCH] Add a salt-minion service control file
|
||||
|
||||
---
|
||||
pkg/suse/salt-minion.service | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
create mode 100644 pkg/suse/salt-minion.service
|
||||
|
||||
diff --git a/pkg/suse/salt-minion.service b/pkg/suse/salt-minion.service
|
||||
new file mode 100644
|
||||
index 0000000000..1dbaa77755
|
||||
--- /dev/null
|
||||
+++ b/pkg/suse/salt-minion.service
|
||||
@@ -0,0 +1,15 @@
|
||||
+[Unit]
|
||||
+Description=The Salt Minion
|
||||
+After=network.target
|
||||
+
|
||||
+[Service]
|
||||
+Type=notify
|
||||
+NotifyAccess=all
|
||||
+LimitNOFILE=8192
|
||||
+ExecStart=/usr/bin/salt-minion
|
||||
+KillMode=process
|
||||
+Restart=on-failure
|
||||
+RestartSec=15
|
||||
+
|
||||
+[Install]
|
||||
+WantedBy=multi-user.target
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,252 +0,0 @@
|
||||
From 95d547d3e6c98f927eaad77346b84b2ccef95627 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Calmer <mc@suse.de>
|
||||
Date: Thu, 19 Jan 2017 15:39:10 +0100
|
||||
Subject: [PATCH] add options for dockerng
|
||||
|
||||
* add buildargs option to dockerng.build
|
||||
* docker buildargs require minimal dockerpy 1.6.0 and docker version 1.9.0
|
||||
* update version in the docs
|
||||
* support dryrun for dockerng.sls_build
|
||||
|
||||
provide the possibility to put extra modules into the thin
|
||||
|
||||
added unit test for dockerng.sls_build dryrun option
|
||||
---
|
||||
salt/modules/dockerng.py | 51 ++++++++++++++++++-----
|
||||
tests/unit/modules/dockerng_test.py | 82 +++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 122 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/salt/modules/dockerng.py b/salt/modules/dockerng.py
|
||||
index 29af703ffa..c199fede1e 100644
|
||||
--- a/salt/modules/dockerng.py
|
||||
+++ b/salt/modules/dockerng.py
|
||||
@@ -28,13 +28,13 @@ to replace references to ``dockerng`` with ``docker``.
|
||||
Installation Prerequisites
|
||||
--------------------------
|
||||
|
||||
-This execution module requires at least version 1.4.0 of both docker-py_ and
|
||||
-Docker_. docker-py can easily be installed using :py:func:`pip.install
|
||||
-<salt.modules.pip.install>`:
|
||||
+This execution module requires at least version 1.6.0 of docker-py_ and
|
||||
+version 1.9.0 of Docker_. docker-py can easily be installed using
|
||||
+:py:func:`pip.install <salt.modules.pip.install>`:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
- salt myminion pip.install docker-py>=1.4.0
|
||||
+ salt myminion pip.install docker-py>=1.6.0
|
||||
|
||||
.. _docker-py: https://pypi.python.org/pypi/docker-py
|
||||
.. _Docker: https://www.docker.com/
|
||||
@@ -332,8 +332,8 @@ __func_alias__ = {
|
||||
}
|
||||
|
||||
# Minimum supported versions
|
||||
-MIN_DOCKER = (1, 6, 0)
|
||||
-MIN_DOCKER_PY = (1, 4, 0)
|
||||
+MIN_DOCKER = (1, 9, 0)
|
||||
+MIN_DOCKER_PY = (1, 6, 0)
|
||||
|
||||
VERSION_RE = r'([\d.]+)'
|
||||
|
||||
@@ -3557,7 +3557,8 @@ def build(path=None,
|
||||
rm=True,
|
||||
api_response=False,
|
||||
fileobj=None,
|
||||
- dockerfile=None):
|
||||
+ dockerfile=None,
|
||||
+ buildargs=None):
|
||||
'''
|
||||
Builds a docker image from a Dockerfile or a URL
|
||||
|
||||
@@ -3591,6 +3592,10 @@ def build(path=None,
|
||||
|
||||
.. versionadded:: develop
|
||||
|
||||
+ buildargs
|
||||
+ A dictionary of build arguments provided to the docker build process.
|
||||
+
|
||||
+
|
||||
**RETURN DATA**
|
||||
|
||||
A dictionary containing one or more of the following keys:
|
||||
@@ -3637,7 +3642,8 @@ def build(path=None,
|
||||
fileobj=fileobj,
|
||||
rm=rm,
|
||||
nocache=not cache,
|
||||
- dockerfile=dockerfile)
|
||||
+ dockerfile=dockerfile,
|
||||
+ buildargs=buildargs)
|
||||
ret = {'Time_Elapsed': time.time() - time_started}
|
||||
_clear_context()
|
||||
|
||||
@@ -5755,7 +5761,9 @@ def call(name, function, *args, **kwargs):
|
||||
raise CommandExecutionError('Missing function parameter')
|
||||
|
||||
# move salt into the container
|
||||
- thin_path = salt.utils.thin.gen_thin(__opts__['cachedir'])
|
||||
+ thin_path = salt.utils.thin.gen_thin(__opts__['cachedir'],
|
||||
+ extra_mods=__salt__['config.option']("thin_extra_mods", ''),
|
||||
+ so_mods=__salt__['config.option']("thin_so_mods", ''))
|
||||
with io.open(thin_path, 'rb') as file:
|
||||
_client_wrapper('put_archive', name, thin_dest_path, file)
|
||||
try:
|
||||
@@ -5865,7 +5873,7 @@ def sls(name, mods=None, saltenv='base', **kwargs):
|
||||
|
||||
|
||||
def sls_build(name, base='opensuse/python', mods=None, saltenv='base',
|
||||
- **kwargs):
|
||||
+ dryrun=False, **kwargs):
|
||||
'''
|
||||
Build a docker image using the specified sls modules and base image.
|
||||
|
||||
@@ -5873,6 +5881,24 @@ def sls_build(name, base='opensuse/python', mods=None, saltenv='base',
|
||||
can build a docker image inside myminion that results of applying those
|
||||
states by doing:
|
||||
|
||||
+ base
|
||||
+ the base image
|
||||
+
|
||||
+ mods
|
||||
+ the state modules to execute during build
|
||||
+
|
||||
+ saltenv
|
||||
+ the salt environment to use
|
||||
+
|
||||
+ dryrun: False
|
||||
+ when set to True the container will not be commited at the end of
|
||||
+ the build. The dryrun succeed also when the state contains errors.
|
||||
+
|
||||
+ **RETURN DATA**
|
||||
+
|
||||
+ A dictionary with the ID of the new container. In case of a dryrun,
|
||||
+ the state result is returned and the container gets removed.
|
||||
+
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
@@ -5905,9 +5931,12 @@ def sls_build(name, base='opensuse/python', mods=None, saltenv='base',
|
||||
# Now execute the state into the container
|
||||
ret = __salt__['dockerng.sls'](id_, mods, saltenv, **kwargs)
|
||||
# fail if the state was not successful
|
||||
- if not salt.utils.check_state_result(ret):
|
||||
+ if not dryrun and not salt.utils.check_state_result(ret):
|
||||
raise CommandExecutionError(ret)
|
||||
finally:
|
||||
__salt__['dockerng.stop'](id_)
|
||||
|
||||
+ if dryrun:
|
||||
+ __salt__['dockerng.rm'](id_)
|
||||
+ return ret
|
||||
return __salt__['dockerng.commit'](id_, name)
|
||||
diff --git a/tests/unit/modules/dockerng_test.py b/tests/unit/modules/dockerng_test.py
|
||||
index ec4901e275..546635577a 100644
|
||||
--- a/tests/unit/modules/dockerng_test.py
|
||||
+++ b/tests/unit/modules/dockerng_test.py
|
||||
@@ -680,6 +680,84 @@ class DockerngTestCase(TestCase):
|
||||
self.assertEqual(
|
||||
{'Id': 'ID2', 'Image': 'foo', 'Time_Elapsed': 42}, ret)
|
||||
|
||||
+ def test_sls_build_dryrun(self, *args):
|
||||
+ '''
|
||||
+ test build sls image in dryrun mode.
|
||||
+ '''
|
||||
+ docker_start_mock = MagicMock(
|
||||
+ return_value={})
|
||||
+ docker_create_mock = MagicMock(
|
||||
+ return_value={'Id': 'ID', 'Name': 'NAME'})
|
||||
+ docker_stop_mock = MagicMock(
|
||||
+ return_value={'state': {'old': 'running', 'new': 'stopped'},
|
||||
+ 'result': True})
|
||||
+ docker_rm_mock = MagicMock(
|
||||
+ return_value={})
|
||||
+
|
||||
+ docker_sls_mock = MagicMock(
|
||||
+ return_value={
|
||||
+ "file_|-/etc/test.sh_|-/etc/test.sh_|-managed": {
|
||||
+ "comment": "File /etc/test.sh is in the correct state",
|
||||
+ "name": "/etc/test.sh",
|
||||
+ "start_time": "07:04:26.834792",
|
||||
+ "result": True,
|
||||
+ "duration": 13.492,
|
||||
+ "__run_num__": 0,
|
||||
+ "changes": {}
|
||||
+ },
|
||||
+ "test_|-always-passes_|-foo_|-succeed_without_changes": {
|
||||
+ "comment": "Success!",
|
||||
+ "name": "foo",
|
||||
+ "start_time": "07:04:26.848915",
|
||||
+ "result": True,
|
||||
+ "duration": 0.363,
|
||||
+ "__run_num__": 1,
|
||||
+ "changes": {}
|
||||
+ }
|
||||
+ })
|
||||
+
|
||||
+ ret = None
|
||||
+ with patch.dict(dockerng_mod.__salt__, {
|
||||
+ 'dockerng.start': docker_start_mock,
|
||||
+ 'dockerng.create': docker_create_mock,
|
||||
+ 'dockerng.stop': docker_stop_mock,
|
||||
+ 'dockerng.rm': docker_rm_mock,
|
||||
+ 'dockerng.sls': docker_sls_mock}):
|
||||
+ ret = dockerng_mod.sls_build(
|
||||
+ 'foo',
|
||||
+ mods='foo',
|
||||
+ dryrun=True
|
||||
+ )
|
||||
+ docker_create_mock.assert_called_once_with(
|
||||
+ cmd='sleep infinity',
|
||||
+ image='opensuse/python', interactive=True, name='foo', tty=True)
|
||||
+ docker_start_mock.assert_called_once_with('ID')
|
||||
+ docker_sls_mock.assert_called_once_with('ID', 'foo', 'base')
|
||||
+ docker_stop_mock.assert_called_once_with('ID')
|
||||
+ docker_rm_mock.assert_called_once_with('ID')
|
||||
+ self.assertEqual(
|
||||
+ {
|
||||
+ "file_|-/etc/test.sh_|-/etc/test.sh_|-managed": {
|
||||
+ "comment": "File /etc/test.sh is in the correct state",
|
||||
+ "name": "/etc/test.sh",
|
||||
+ "start_time": "07:04:26.834792",
|
||||
+ "result": True,
|
||||
+ "duration": 13.492,
|
||||
+ "__run_num__": 0,
|
||||
+ "changes": {}
|
||||
+ },
|
||||
+ "test_|-always-passes_|-foo_|-succeed_without_changes": {
|
||||
+ "comment": "Success!",
|
||||
+ "name": "foo",
|
||||
+ "start_time": "07:04:26.848915",
|
||||
+ "result": True,
|
||||
+ "duration": 0.363,
|
||||
+ "__run_num__": 1,
|
||||
+ "changes": {}
|
||||
+ }
|
||||
+ },
|
||||
+ ret)
|
||||
+
|
||||
def test_call_success(self):
|
||||
'''
|
||||
test module calling inside containers
|
||||
@@ -694,6 +772,9 @@ class DockerngTestCase(TestCase):
|
||||
return_value={
|
||||
'retcode': 0
|
||||
})
|
||||
+ docker_config_mock = MagicMock(
|
||||
+ return_value=''
|
||||
+ )
|
||||
client = Mock()
|
||||
client.put_archive = Mock()
|
||||
|
||||
@@ -704,6 +785,7 @@ class DockerngTestCase(TestCase):
|
||||
dockerng_mod.__salt__, {
|
||||
'dockerng.run_all': docker_run_all_mock,
|
||||
'dockerng.copy_to': docker_copy_to_mock,
|
||||
+ 'config.option': docker_config_mock
|
||||
}),
|
||||
patch.dict(
|
||||
dockerng_mod.__context__, {
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,163 +0,0 @@
|
||||
From c4c6610bf7314cc4c6ecf656bef341e2d1ca1587 Mon Sep 17 00:00:00 2001
|
||||
From: Matei Albu <malbu@suse.de>
|
||||
Date: Mon, 19 Dec 2016 16:54:52 +0100
|
||||
Subject: [PATCH] Add --ssh-option to salt-ssh
|
||||
|
||||
--ssh-option can be used to pass -o options to the ssh client.
|
||||
(cherry picked from commit 16f21e5)
|
||||
|
||||
Add spaces around =
|
||||
|
||||
Fix salt-ssh err when -ssh-option is missing
|
||||
---
|
||||
salt/client/ssh/__init__.py | 7 ++++++-
|
||||
salt/client/ssh/shell.py | 19 ++++++++++++++++---
|
||||
salt/utils/parsers.py | 18 +++++++++++++-----
|
||||
3 files changed, 35 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/salt/client/ssh/__init__.py b/salt/client/ssh/__init__.py
|
||||
index 23ec948fe0..bbef9d8de1 100644
|
||||
--- a/salt/client/ssh/__init__.py
|
||||
+++ b/salt/client/ssh/__init__.py
|
||||
@@ -295,6 +295,9 @@ class SSH(object):
|
||||
'remote_port_forwards': self.opts.get(
|
||||
'ssh_remote_port_forwards'
|
||||
),
|
||||
+ 'ssh_options': self.opts.get(
|
||||
+ 'ssh_options'
|
||||
+ )
|
||||
}
|
||||
if self.opts.get('rand_thin_dir'):
|
||||
self.defaults['thin_dir'] = os.path.join(
|
||||
@@ -693,6 +696,7 @@ class Single(object):
|
||||
identities_only=False,
|
||||
sudo_user=None,
|
||||
remote_port_forwards=None,
|
||||
+ ssh_options=None,
|
||||
**kwargs):
|
||||
# Get mine setting and mine_functions if defined in kwargs (from roster)
|
||||
self.mine = mine
|
||||
@@ -749,7 +753,8 @@ class Single(object):
|
||||
'mods': self.mods,
|
||||
'identities_only': identities_only,
|
||||
'sudo_user': sudo_user,
|
||||
- 'remote_port_forwards': remote_port_forwards}
|
||||
+ 'remote_port_forwards': remote_port_forwards,
|
||||
+ 'ssh_options': ssh_options}
|
||||
# Pre apply changeable defaults
|
||||
self.minion_opts = {
|
||||
'grains_cache': True,
|
||||
diff --git a/salt/client/ssh/shell.py b/salt/client/ssh/shell.py
|
||||
index f78cb623e1..613660fe34 100644
|
||||
--- a/salt/client/ssh/shell.py
|
||||
+++ b/salt/client/ssh/shell.py
|
||||
@@ -64,7 +64,8 @@ class Shell(object):
|
||||
mods=None,
|
||||
identities_only=False,
|
||||
sudo_user=None,
|
||||
- remote_port_forwards=None):
|
||||
+ remote_port_forwards=None,
|
||||
+ ssh_options=None):
|
||||
self.opts = opts
|
||||
# ssh <ipv6>, but scp [<ipv6]:/path
|
||||
self.host = host.strip('[]')
|
||||
@@ -78,6 +79,7 @@ class Shell(object):
|
||||
self.mods = mods
|
||||
self.identities_only = identities_only
|
||||
self.remote_port_forwards = remote_port_forwards
|
||||
+ self.ssh_options = ssh_options
|
||||
|
||||
def get_error(self, errstr):
|
||||
'''
|
||||
@@ -169,6 +171,12 @@ class Shell(object):
|
||||
ret.append('-o {0} '.format(option))
|
||||
return ''.join(ret)
|
||||
|
||||
+ def _ssh_opts(self):
|
||||
+ if self.ssh_options:
|
||||
+ return ' '.join(['-o {0}'.format(opt)
|
||||
+ for opt in self.ssh_options])
|
||||
+ return ''
|
||||
+
|
||||
def _copy_id_str_old(self):
|
||||
'''
|
||||
Return the string to execute ssh-copy-id
|
||||
@@ -176,11 +184,12 @@ class Shell(object):
|
||||
if self.passwd:
|
||||
# Using single quotes prevents shell expansion and
|
||||
# passwords containing '$'
|
||||
- return "{0} {1} '{2} -p {3} {4}@{5}'".format(
|
||||
+ return "{0} {1} '{2} -p {3} {4} {5}@{6}'".format(
|
||||
'ssh-copy-id',
|
||||
'-i {0}.pub'.format(self.priv),
|
||||
self._passwd_opts(),
|
||||
self.port,
|
||||
+ self._ssh_opts(),
|
||||
self.user,
|
||||
self.host)
|
||||
return None
|
||||
@@ -193,11 +202,12 @@ class Shell(object):
|
||||
if self.passwd:
|
||||
# Using single quotes prevents shell expansion and
|
||||
# passwords containing '$'
|
||||
- return "{0} {1} {2} -p {3} {4}@{5}".format(
|
||||
+ return "{0} {1} {2} -p {3} {4} {5}@{6}".format(
|
||||
'ssh-copy-id',
|
||||
'-i {0}.pub'.format(self.priv),
|
||||
self._passwd_opts(),
|
||||
self.port,
|
||||
+ self._ssh_opts(),
|
||||
self.user,
|
||||
self.host)
|
||||
return None
|
||||
@@ -229,6 +239,9 @@ class Shell(object):
|
||||
if ssh != 'scp' and self.remote_port_forwards:
|
||||
command.append(' '.join(['-R {0}'.format(item)
|
||||
for item in self.remote_port_forwards.split(',')]))
|
||||
+ if self.ssh_options:
|
||||
+ command.append(self._ssh_opts())
|
||||
+
|
||||
command.append(cmd)
|
||||
|
||||
return ' '.join(command)
|
||||
diff --git a/salt/utils/parsers.py b/salt/utils/parsers.py
|
||||
index 6330ed6596..c38506f3c5 100644
|
||||
--- a/salt/utils/parsers.py
|
||||
+++ b/salt/utils/parsers.py
|
||||
@@ -2828,11 +2828,11 @@ class SaltSSHOptionParser(six.with_metaclass(OptionParserMeta,
|
||||
help='Pass a JID to be used instead of generating one.'
|
||||
)
|
||||
|
||||
- ports_group = optparse.OptionGroup(
|
||||
- self, 'Port Forwarding Options',
|
||||
- 'Parameters for setting up SSH port forwarding.'
|
||||
+ ssh_group = optparse.OptionGroup(
|
||||
+ self, 'SSH Options',
|
||||
+ 'Parameters for the SSH client.'
|
||||
)
|
||||
- ports_group.add_option(
|
||||
+ ssh_group.add_option(
|
||||
'--remote-port-forwards',
|
||||
dest='ssh_remote_port_forwards',
|
||||
help='Setup remote port forwarding using the same syntax as with '
|
||||
@@ -2840,7 +2840,15 @@ class SaltSSHOptionParser(six.with_metaclass(OptionParserMeta,
|
||||
'forwarding definitions will be translated into multiple '
|
||||
'-R parameters.'
|
||||
)
|
||||
- self.add_option_group(ports_group)
|
||||
+ ssh_group.add_option(
|
||||
+ '--ssh-option',
|
||||
+ dest='ssh_options',
|
||||
+ action='append',
|
||||
+ help='Equivalent to the -o ssh command option. Passes options to '
|
||||
+ 'the SSH client in the format used in the client configuration file. '
|
||||
+ 'Can be used multiple times.'
|
||||
+ )
|
||||
+ self.add_option_group(ssh_group)
|
||||
|
||||
auth_group = optparse.OptionGroup(
|
||||
self, 'Authentication Options',
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,116 +0,0 @@
|
||||
From a0523ac82a1dcca7a7c77f9b3816f237f211b94e Mon Sep 17 00:00:00 2001
|
||||
From: Bo Maryniuk <bo@suse.de>
|
||||
Date: Thu, 29 Sep 2016 17:00:14 +0200
|
||||
Subject: [PATCH] Add YUM plugin
|
||||
|
||||
* Add plugin for Yum-Salt integration
|
||||
* Add configuration for the yumnotify plugin
|
||||
* Fixes wrong 'enabled' opts for yumnotify plugin
|
||||
---
|
||||
scripts/yum/plugins/README.md | 20 ++++++++++++++
|
||||
scripts/yum/plugins/yumnotify.conf | 2 ++
|
||||
scripts/yum/plugins/yumnotify.py | 55 ++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 77 insertions(+)
|
||||
create mode 100644 scripts/yum/plugins/README.md
|
||||
create mode 100644 scripts/yum/plugins/yumnotify.conf
|
||||
create mode 100644 scripts/yum/plugins/yumnotify.py
|
||||
|
||||
diff --git a/scripts/yum/plugins/README.md b/scripts/yum/plugins/README.md
|
||||
new file mode 100644
|
||||
index 0000000000..cb3abd2260
|
||||
--- /dev/null
|
||||
+++ b/scripts/yum/plugins/README.md
|
||||
@@ -0,0 +1,20 @@
|
||||
+## What it is
|
||||
+
|
||||
+Plugin which provides a notification mechanism to Salt, if Yum is
|
||||
+used outside of it.
|
||||
+
|
||||
+## Installation
|
||||
+
|
||||
+Configuration files are going to:
|
||||
+
|
||||
+ `/etc/yum/pluginconf.d/[name].conf`
|
||||
+
|
||||
+Plugin itself goes to:
|
||||
+
|
||||
+ `/usr/share/yum-plugins/[name].conf`
|
||||
+
|
||||
+## Permissions
|
||||
+
|
||||
+User: root
|
||||
+Group: root
|
||||
+Mode: 644
|
||||
diff --git a/scripts/yum/plugins/yumnotify.conf b/scripts/yum/plugins/yumnotify.conf
|
||||
new file mode 100644
|
||||
index 0000000000..8e4d76c728
|
||||
--- /dev/null
|
||||
+++ b/scripts/yum/plugins/yumnotify.conf
|
||||
@@ -0,0 +1,2 @@
|
||||
+[main]
|
||||
+enabled=1
|
||||
diff --git a/scripts/yum/plugins/yumnotify.py b/scripts/yum/plugins/yumnotify.py
|
||||
new file mode 100644
|
||||
index 0000000000..268e1e9531
|
||||
--- /dev/null
|
||||
+++ b/scripts/yum/plugins/yumnotify.py
|
||||
@@ -0,0 +1,55 @@
|
||||
+# Copyright (c) 2016 SUSE Linux LLC
|
||||
+# All Rights Reserved.
|
||||
+#
|
||||
+# Author: Bo Maryniuk <bo@suse.de>
|
||||
+
|
||||
+from yum.plugins import TYPE_CORE
|
||||
+from yum import config
|
||||
+import os
|
||||
+import hashlib
|
||||
+
|
||||
+CK_PATH = "/var/cache/salt/minion/rpmdb.cookie"
|
||||
+RPM_PATH = "/var/lib/rpm/Packages"
|
||||
+
|
||||
+requires_api_version = '2.5'
|
||||
+plugin_type = TYPE_CORE
|
||||
+
|
||||
+
|
||||
+def _get_mtime():
|
||||
+ """
|
||||
+ Get the modified time of the RPM Database.
|
||||
+
|
||||
+ Returns:
|
||||
+ Unix ticks
|
||||
+ """
|
||||
+ return os.path.exists(RPM_PATH) and int(os.path.getmtime(RPM_PATH)) or 0
|
||||
+
|
||||
+
|
||||
+def _get_checksum():
|
||||
+ """
|
||||
+ Get the checksum of the RPM Database.
|
||||
+
|
||||
+ Returns:
|
||||
+ hexdigest
|
||||
+ """
|
||||
+ digest = hashlib.md5()
|
||||
+ with open(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 posttrans_hook(conduit):
|
||||
+ """
|
||||
+ Hook after the package installation transaction.
|
||||
+
|
||||
+ :param conduit:
|
||||
+ :return:
|
||||
+ """
|
||||
+ # Integrate Yum with Salt
|
||||
+ if 'SALT_RUNNING' not in os.environ:
|
||||
+ with open(CK_PATH, 'w') as ck_fh:
|
||||
+ ck_fh.write('{chksum} {mtime}\n'.format(chksum=_get_checksum(), mtime=_get_mtime()))
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,222 +0,0 @@
|
||||
From 2616f36c3a1131a73546449d33d917783f6f1f7b Mon Sep 17 00:00:00 2001
|
||||
From: Bo Maryniuk <bo@suse.de>
|
||||
Date: Mon, 9 May 2016 10:33:44 +0200
|
||||
Subject: [PATCH] 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 0000000000..01c8917c8e
|
||||
--- /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 0000000000..268298b108
|
||||
--- /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 <bo@suse.de>
|
||||
+
|
||||
+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 0000000000..550403cc24
|
||||
--- /dev/null
|
||||
+++ b/tests/unit/zypp_plugins_test.py
|
||||
@@ -0,0 +1,51 @@
|
||||
+# -*- coding: utf-8 -*-
|
||||
+'''
|
||||
+ :codeauthor: :email:`Bo Maryniuk <bo@suse.de>`
|
||||
+'''
|
||||
+
|
||||
+# 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 0000000000..218f703811
|
||||
--- /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.11.0
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
From b338b21fe340ee4efa0045894315fcf20be1dc49 Mon Sep 17 00:00:00 2001
|
||||
From: Silvio Moioli <smoioli@suse.de>
|
||||
Date: Wed, 14 Dec 2016 10:33:39 +0100
|
||||
Subject: [PATCH] Avoid failures on SLES 12 SP2 because of new systemd
|
||||
TaskMax limit (bsc#985112)
|
||||
|
||||
---
|
||||
pkg/salt-master.service | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/pkg/salt-master.service b/pkg/salt-master.service
|
||||
index 59be50301a..ecd3edd467 100644
|
||||
--- a/pkg/salt-master.service
|
||||
+++ b/pkg/salt-master.service
|
||||
@@ -6,6 +6,7 @@ After=network.target
|
||||
LimitNOFILE=16384
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/salt-master
|
||||
+TasksMax=infinity
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,72 +0,0 @@
|
||||
From 79f9f4c06813d70cd03ad32c6c8ef8fec1656e88 Mon Sep 17 00:00:00 2001
|
||||
From: Mihai Dinca <mdinca@suse.de>
|
||||
Date: Fri, 14 Oct 2016 09:04:47 +0200
|
||||
Subject: [PATCH] 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 7b4c8ce0e5..3101efb372 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.11.0
|
||||
|
||||
|
@ -1,50 +0,0 @@
|
||||
From df521307c4bff21ab7891e0086fc4dc8b7c2207c Mon Sep 17 00:00:00 2001
|
||||
From: Bo Maryniuk <bo@suse.de>
|
||||
Date: Mon, 18 Jan 2016 16:28:48 +0100
|
||||
Subject: [PATCH] Check if byte strings are properly encoded in UTF-8
|
||||
|
||||
Rename keywords arguments variable to a default name.
|
||||
---
|
||||
salt/modules/zypper.py | 11 ++++++-----
|
||||
1 file changed, 6 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/salt/modules/zypper.py b/salt/modules/zypper.py
|
||||
index 53837e5e73..75e529c3f9 100644
|
||||
--- a/salt/modules/zypper.py
|
||||
+++ b/salt/modules/zypper.py
|
||||
@@ -366,9 +366,9 @@ def info_installed(*names, **kwargs):
|
||||
summary, description.
|
||||
|
||||
:param errors:
|
||||
- Handle RPM field errors (true|false). By default, various mistakes in the textual fields are simply ignored and
|
||||
- omitted from the data. Otherwise a field with a mistake is not returned, instead a 'N/A (bad UTF-8)'
|
||||
- (not available, broken) text is returned.
|
||||
+ Handle RPM field errors. If 'ignore' is chosen, then various mistakes are simply ignored and omitted
|
||||
+ from the texts or strings. If 'report' is chonen, then a field with a mistake is not returned, instead
|
||||
+ a 'N/A (broken)' (not available, broken) text is placed.
|
||||
|
||||
Valid attributes are:
|
||||
ignore, report
|
||||
@@ -381,7 +381,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
|
||||
- salt '*' pkg.info_installed <package1> <package2> <package3> ... attr=version,vendor errors=true
|
||||
+ salt '*' pkg.info_installed <package1> <package2> <package3> ... attr=version,vendor errors=ignore
|
||||
+ salt '*' pkg.info_installed <package1> <package2> <package3> ... attr=version,vendor errors=report
|
||||
'''
|
||||
ret = dict()
|
||||
for pkg_name, pkg_nfo in __salt__['lowpkg.info'](*names, **kwargs).items():
|
||||
@@ -395,7 +396,7 @@ def info_installed(*names, **kwargs):
|
||||
else:
|
||||
value_ = value.decode('UTF-8', 'ignore').encode('UTF-8', 'ignore')
|
||||
if value != value_:
|
||||
- value = kwargs.get('errors') and value_ or 'N/A (invalid UTF-8)'
|
||||
+ value = kwargs.get('errors', 'ignore') == 'ignore' and value_ or 'N/A (invalid UTF-8)'
|
||||
log.error('Package {0} has bad UTF-8 code in {1}: {2}'.format(pkg_name, key, value))
|
||||
if key == 'source_rpm':
|
||||
t_nfo['source'] = value
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 7eeddadbf5ad309045b77762ac9f2f526af83b03 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Calmer <mc@suse.de>
|
||||
Date: Fri, 4 Mar 2016 09:51:22 +0100
|
||||
Subject: [PATCH] do not generate a date in a comment to prevent rebuilds
|
||||
(bsc#969407)
|
||||
|
||||
---
|
||||
setup.py | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/setup.py b/setup.py
|
||||
index f9e9437e71..2356b2ada1 100755
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -667,8 +667,7 @@ class Clean(clean):
|
||||
|
||||
|
||||
INSTALL_VERSION_TEMPLATE = '''\
|
||||
-# This file was auto-generated by salt's setup on \
|
||||
-{date:%A, %d %B %Y @ %H:%m:%S UTC}.
|
||||
+# This file was auto-generated by salt's setup
|
||||
|
||||
from salt.version import SaltStackVersion
|
||||
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
From 036be5f7300bbf6c5ef3967b5cc935fd678cd1e1 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Calmer <mc@suse.de>
|
||||
Date: Thu, 23 Feb 2017 12:01:05 +0100
|
||||
Subject: [PATCH] fix case in os_family for Suse
|
||||
|
||||
---
|
||||
salt/modules/service.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/salt/modules/service.py b/salt/modules/service.py
|
||||
index bb7133ee99..49186e4c9d 100644
|
||||
--- a/salt/modules/service.py
|
||||
+++ b/salt/modules/service.py
|
||||
@@ -53,7 +53,7 @@ def __virtual__():
|
||||
if __grains__['kernel'] != 'Linux':
|
||||
return (False, 'Non Linux OSes are not supported')
|
||||
# SUSE >=12.0 uses systemd
|
||||
- if __grains__.get('os_family', '') == 'SUSE':
|
||||
+ if __grains__.get('os_family', '') == 'Suse':
|
||||
try:
|
||||
# osrelease might be in decimal format (e.g. "12.1"), or for
|
||||
# SLES might include service pack (e.g. "11 SP3"), so split on
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,196 +0,0 @@
|
||||
From 89fd1a83d282a10728077a08466627271a052733 Mon Sep 17 00:00:00 2001
|
||||
From: Erik Johnson <palehose@gmail.com>
|
||||
Date: Wed, 1 Mar 2017 10:19:33 -0600
|
||||
Subject: [PATCH] Fix regression in file.get_managed, add unit tests
|
||||
|
||||
This is no longer needed since we're invoking the state module directly
|
||||
and not via the state compiler.
|
||||
|
||||
* Fix regression in file.get_managed when skip_verify=True
|
||||
* Add integration tests for remote file sources
|
||||
* Remove next(iter()) extraction
|
||||
---
|
||||
salt/modules/file.py | 6 +--
|
||||
salt/states/archive.py | 11 ----
|
||||
tests/integration/states/file.py | 105 +++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 108 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/salt/modules/file.py b/salt/modules/file.py
|
||||
index 8f0c6914b6..381800bc1a 100644
|
||||
--- a/salt/modules/file.py
|
||||
+++ b/salt/modules/file.py
|
||||
@@ -3745,13 +3745,13 @@ def get_managed(
|
||||
if cached_dest and (source_hash or skip_verify):
|
||||
htype = source_sum.get('hash_type', 'sha256')
|
||||
cached_sum = get_hash(cached_dest, form=htype)
|
||||
- if cached_sum != source_sum['hsum']:
|
||||
- cache_refetch = True
|
||||
- elif skip_verify:
|
||||
+ if skip_verify:
|
||||
# prev: if skip_verify or cached_sum == source_sum['hsum']:
|
||||
# but `cached_sum == source_sum['hsum']` is elliptical as prev if
|
||||
sfn = cached_dest
|
||||
source_sum = {'hsum': cached_sum, 'hash_type': htype}
|
||||
+ elif cached_sum != source_sum['hsum']:
|
||||
+ cache_refetch = True
|
||||
|
||||
# If we didn't have the template or remote file, let's get it
|
||||
# Similarly when the file has been updated and the cache has to be refreshed
|
||||
diff --git a/salt/states/archive.py b/salt/states/archive.py
|
||||
index c5df213620..46146e971e 100644
|
||||
--- a/salt/states/archive.py
|
||||
+++ b/salt/states/archive.py
|
||||
@@ -897,17 +897,6 @@ def extracted(name,
|
||||
ret['comment'] = '\n'.join([str(x) for x in file_result])
|
||||
return ret
|
||||
|
||||
- # Get actual state result. The state.single return is a single-element
|
||||
- # dictionary with the state's unique ID at the top level, and its value
|
||||
- # being the state's return dictionary. next(iter(dict_name)) will give
|
||||
- # us the value of the first key, so
|
||||
- # file_result[next(iter(file_result))] will give us the results of the
|
||||
- # state.single we just ran.
|
||||
- try:
|
||||
- file_result = file_result[next(iter(file_result))]
|
||||
- except AttributeError:
|
||||
- pass
|
||||
-
|
||||
try:
|
||||
if not file_result['result']:
|
||||
log.debug('failed to download {0}'.format(source_match))
|
||||
diff --git a/tests/integration/states/file.py b/tests/integration/states/file.py
|
||||
index d63f318064..faa83d00e8 100644
|
||||
--- a/tests/integration/states/file.py
|
||||
+++ b/tests/integration/states/file.py
|
||||
@@ -9,15 +9,22 @@ from __future__ import absolute_import
|
||||
from distutils.version import LooseVersion
|
||||
import errno
|
||||
import glob
|
||||
+import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import shutil
|
||||
+import socket
|
||||
import stat
|
||||
import tempfile
|
||||
import textwrap
|
||||
+import threading
|
||||
+import tornado.ioloop
|
||||
+import tornado.web
|
||||
import filecmp
|
||||
|
||||
+log = logging.getLogger(__name__)
|
||||
+
|
||||
# Import 3rd-party libs
|
||||
from salt.ext.six.moves import range # pylint: disable=import-error,redefined-builtin
|
||||
|
||||
@@ -2392,6 +2399,104 @@ class FileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
||||
if check_file:
|
||||
self.run_function('file.remove', [file])
|
||||
|
||||
+
|
||||
+PORT = 9999
|
||||
+FILE_SOURCE = 'http://localhost:{0}/grail/scene33'.format(PORT)
|
||||
+FILE_HASH = 'd2feb3beb323c79fc7a0f44f1408b4a3'
|
||||
+STATE_DIR = os.path.join(integration.FILES, 'file', 'base')
|
||||
+
|
||||
+
|
||||
+class RemoteFileTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
||||
+ '''
|
||||
+ Uses a local tornado webserver to test http(s) file.managed states with and
|
||||
+ without skip_verify
|
||||
+ '''
|
||||
+ @classmethod
|
||||
+ def webserver(cls):
|
||||
+ '''
|
||||
+ method to start tornado static web app
|
||||
+ '''
|
||||
+ application = tornado.web.Application([
|
||||
+ (r'/(.*)', tornado.web.StaticFileHandler, {'path': STATE_DIR})
|
||||
+ ])
|
||||
+ application.listen(PORT)
|
||||
+ tornado.ioloop.IOLoop.instance().start()
|
||||
+
|
||||
+ @classmethod
|
||||
+ def setUpClass(cls):
|
||||
+ '''
|
||||
+ start tornado app on thread and wait until it is running
|
||||
+ '''
|
||||
+ cls.server_thread = threading.Thread(target=cls.webserver)
|
||||
+ cls.server_thread.daemon = True
|
||||
+ cls.server_thread.start()
|
||||
+ # check if tornado app is up
|
||||
+ port_closed = True
|
||||
+ while port_closed:
|
||||
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
+ result = sock.connect_ex(('127.0.0.1', PORT))
|
||||
+ if result == 0:
|
||||
+ port_closed = False
|
||||
+
|
||||
+ @classmethod
|
||||
+ def tearDownClass(cls):
|
||||
+ tornado.ioloop.IOLoop.instance().stop()
|
||||
+ cls.server_thread.join()
|
||||
+
|
||||
+ def setUp(self):
|
||||
+ fd_, self.name = tempfile.mkstemp(dir=integration.TMP)
|
||||
+ try:
|
||||
+ os.close(fd_)
|
||||
+ except OSError as exc:
|
||||
+ if exc.errno != errno.EBADF:
|
||||
+ raise exc
|
||||
+ # Remove the file that mkstemp just created so that the states can test
|
||||
+ # creating a new file instead of a diff from a zero-length file.
|
||||
+ self.tearDown()
|
||||
+
|
||||
+ def tearDown(self):
|
||||
+ try:
|
||||
+ os.remove(self.name)
|
||||
+ except OSError as exc:
|
||||
+ if exc.errno != errno.ENOENT:
|
||||
+ raise exc
|
||||
+
|
||||
+ def test_file_managed_http_source_no_hash(self):
|
||||
+ '''
|
||||
+ Test a remote file with no hash
|
||||
+ '''
|
||||
+ ret = self.run_state('file.managed',
|
||||
+ name=self.name,
|
||||
+ source=FILE_SOURCE,
|
||||
+ skip_verify=False)
|
||||
+ log.debug('ret = %s', ret)
|
||||
+ # This should fail because no hash was provided
|
||||
+ self.assertSaltFalseReturn(ret)
|
||||
+
|
||||
+ def test_file_managed_http_source(self):
|
||||
+ '''
|
||||
+ Test a remote file with no hash
|
||||
+ '''
|
||||
+ ret = self.run_state('file.managed',
|
||||
+ name=self.name,
|
||||
+ source=FILE_SOURCE,
|
||||
+ source_hash=FILE_HASH,
|
||||
+ skip_verify=False)
|
||||
+ log.debug('ret = %s', ret)
|
||||
+ self.assertSaltTrueReturn(ret)
|
||||
+
|
||||
+ def test_file_managed_http_source_skip_verify(self):
|
||||
+ '''
|
||||
+ Test a remote file using skip_verify
|
||||
+ '''
|
||||
+ ret = self.run_state('file.managed',
|
||||
+ name=self.name,
|
||||
+ source=FILE_SOURCE,
|
||||
+ skip_verify=True)
|
||||
+ log.debug('ret = %s', ret)
|
||||
+ self.assertSaltTrueReturn(ret)
|
||||
+
|
||||
+
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
run_tests(FileTest)
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 54fa5d2b6d47d242e98e9a7f4cc597e03084d4d2 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Calmer <mc@suse.de>
|
||||
Date: Tue, 21 Jun 2016 13:12:48 +0200
|
||||
Subject: [PATCH] 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 1fc9a83508..88ac65e7c2 100644
|
||||
--- a/salt/cli/salt.py
|
||||
+++ b/salt/cli/salt.py
|
||||
@@ -281,7 +281,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.11.0
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:0899b89ef230b42097f7c147a9babb30d65eac7968bd05318eac42ec9d8a7ec9
|
||||
size 5486695
|
||||
oid sha256:6b82846ed4005af7655290cd9bdc62c1d4912d4809acaca2ff37ebff0960b18c
|
||||
size 1250836
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 7bbbd3b6ebaf3988a4f97b905040b56be065f201 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Calmer <mc@suse.de>
|
||||
Date: Fri, 29 Jul 2016 10:50:21 +0200
|
||||
Subject: [PATCH] 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 c3e67d510c..9be2cb8ee6 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.11.0
|
||||
|
||||
|
@ -1,54 +0,0 @@
|
||||
From d1d0fec1dd0fbf6a67c313718975ceb72c10cd2f 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] Run salt master as dedicated salt user
|
||||
|
||||
---
|
||||
conf/master | 3 ++-
|
||||
pkg/salt-common.logrotate | 3 +++
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/conf/master b/conf/master
|
||||
index 3930c9832d..f58eb496bf 100644
|
||||
--- a/conf/master
|
||||
+++ b/conf/master
|
||||
@@ -25,7 +25,8 @@
|
||||
# permissions to allow the specified user to run the master. The exception is
|
||||
# the job cache, which must be deleted if this user is changed. If the
|
||||
# modified files cause conflicts, set verify_env to False.
|
||||
-#user: root
|
||||
+user: salt
|
||||
+syndic_user: salt
|
||||
|
||||
# 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 3cd002308e..8d970c0a64 100644
|
||||
--- a/pkg/salt-common.logrotate
|
||||
+++ b/pkg/salt-common.logrotate
|
||||
@@ -1,4 +1,5 @@
|
||||
/var/log/salt/master {
|
||||
+ su salt salt
|
||||
weekly
|
||||
missingok
|
||||
rotate 7
|
||||
@@ -7,6 +8,7 @@
|
||||
}
|
||||
|
||||
/var/log/salt/minion {
|
||||
+ su salt salt
|
||||
weekly
|
||||
missingok
|
||||
rotate 7
|
||||
@@ -15,6 +17,7 @@
|
||||
}
|
||||
|
||||
/var/log/salt/key {
|
||||
+ su salt salt
|
||||
weekly
|
||||
missingok
|
||||
rotate 7
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9d5849f38a858288ebc6ef790ced86ae724e61b06e3ee27e6cecf3f6c1ecbc51
|
||||
size 9163351
|
233
salt.changes
233
salt.changes
@ -1,3 +1,236 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Aug 16 09:26:01 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
- Update to 2017.7.1
|
||||
See https://docs.saltstack.com/en/develop/topics/releases/2017.7.1.html
|
||||
for full changelog
|
||||
- Fix for CVE-2017-12791 (bsc#1053955)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sat Aug 12 21:26:49 UTC 2017 - jengelh@inai.de
|
||||
|
||||
- Run fdupes over all of /usr because it still warns about
|
||||
duplicate files. Remove ancient suse_version > 1020 conditional.
|
||||
- Replace unnecessary %__ indirections. Use grep -q in favor of
|
||||
>/dev/null.
|
||||
- Avoid bashisms in %pre.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jul 21 12:53:26 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
- Update to 2017.7.0
|
||||
See https://docs.saltstack.com/en/develop/topics/releases/2017.7.0.html
|
||||
for full changelog
|
||||
- fix ownership for whole master cache directory (bsc#1035914)
|
||||
- fix setting the language on SUSE systems (bsc#1038855)
|
||||
- wrong os_family grains on SUSE - fix unittests (bsc#1038855)
|
||||
- speed-up cherrypy by removing sleep call
|
||||
- Disable 3rd party runtime packages to be explicitly recommended.
|
||||
(bsc#1040886)
|
||||
- fix format error (bsc#1043111)
|
||||
- Add a salt-minion watchdog for RHEL6 and SLES11 systems (sysV)
|
||||
to restart salt-minion in case of crashes during upgrade.
|
||||
- Add procps as dependency.
|
||||
- Bugfix: jobs scheduled to run at a future time stay
|
||||
pending for Salt minions (bsc#1036125)
|
||||
- All current patches has been removed as they were added upstream:
|
||||
* add-a-salt-minion-service-control-file.patch
|
||||
* add-options-for-dockerng.patch
|
||||
* add-ssh-option-to-salt-ssh.patch
|
||||
* add-unit-test-for-skip-false-values-from-preferred_i.patch
|
||||
* add-yum-plugin.patch
|
||||
* add-zypp-notify-plugin.patch
|
||||
* adding-support-for-installing-patches-in-yum-dnf-exe.patch
|
||||
* avoid-failures-on-sles-12-sp2-because-of-new-systemd.patch
|
||||
* bugfix-unable-to-use-127-as-hostname.patch
|
||||
* change-travis-configuration-file-to-use-salt-toaster.patch
|
||||
* check-if-byte-strings-are-properly-encoded-in-utf-8.patch
|
||||
* clean-up-change-attribute-from-interface-dict.patch
|
||||
* do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch
|
||||
* fix-grain-for-os_family-on-suse-series.patch
|
||||
* fix-os_family-case-in-unittest.patch
|
||||
* fix-regression-in-file.get_managed-add-unit-tests.patch
|
||||
* fix-salt-summary-to-count-not-responding-minions-cor.patch
|
||||
* fix-setting-language-on-suse-systems.patch
|
||||
* fixed-issue-with-parsing-of-master-minion-returns-wh.patch
|
||||
* fixing-beacons.list-integration-test-failure.patch
|
||||
* rest_cherrypy-remove-sleep-call.patch
|
||||
* run-salt-api-as-user-salt-bsc-990029.patch
|
||||
* run-salt-master-as-dedicated-salt-user.patch
|
||||
* search-the-entire-cache_dir-because-storage-paths-ch.patch
|
||||
* setting-up-os-grains-for-sles-expanded-support-suse-.patch
|
||||
* special-salt-minion.service-file-for-rhel7.patch
|
||||
* translate-variable-arguments-if-they-contain-hidden-.patch
|
||||
* tserong-suse.com-we-don-t-have-python-systemd-so-not.patch
|
||||
* use-correct-grain-constants-for-timezone.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 6 15:47:12 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
- Bugfix: clean up `change` attribute from interface dict (upstream)
|
||||
Issue: https://github.com/saltstack/salt/issues/41461
|
||||
PR: 1. https://github.com/saltstack/salt/pull/41487
|
||||
2. https://github.com/saltstack/salt/pull/41533
|
||||
|
||||
Added:
|
||||
* clean-up-change-attribute-from-interface-dict.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon May 22 14:23:49 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
- Bugfix: orchestrate and batches returns false failed information
|
||||
https://github.com/saltstack/salt/issues/40635
|
||||
- speed-up cherrypy by removing sleep call
|
||||
- wrong os_family grains on SUSE - fix unittests (bsc#1038855)
|
||||
- fix setting the language on SUSE systems (bsc#1038855)
|
||||
- Bugfix: unable to use hostname for minion ID as '127' (upstream)
|
||||
- Bugfix: remove sleep call in CheppryPy API handler (upstream)
|
||||
- Fix core grains constants for timezone (bsc#1032931)
|
||||
|
||||
- Added:
|
||||
* bugfix-unable-to-use-127-as-hostname.patch
|
||||
* fix-grain-for-os_family-on-suse-series.patch
|
||||
* fix-os_family-case-in-unittest.patch
|
||||
* fix-setting-language-on-suse-systems.patch
|
||||
* fixed-issue-with-parsing-of-master-minion-returns-wh.patch
|
||||
* rest_cherrypy-remove-sleep-call.patch
|
||||
* use-correct-grain-constants-for-timezone.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 4 14:05:54 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
- Update to 2016.11.4
|
||||
See https://docs.saltstack.com/en/develop/topics/releases/2016.11.4.html
|
||||
for full changelog
|
||||
|
||||
- Changed:
|
||||
* add-options-for-dockerng.patch
|
||||
* fix-regression-in-file.get_managed-add-unit-tests.patch
|
||||
|
||||
- Added:
|
||||
* add-unit-test-for-skip-false-values-from-preferred_i.patch
|
||||
* fixing-beacons.list-integration-test-failure.patch
|
||||
|
||||
- Removed:
|
||||
* adding-downloadonly-support-to-yum-dnf-module.patch
|
||||
* adds-custom-timeout-and-gather_job_timeout-to-local_.patch
|
||||
* allows-to-set-timeout-and-gather_job_timeout-via-kwa.patch
|
||||
* fix-case-in-os_family-for-suse.patch
|
||||
* fix-race-condition-on-cache-directory-creation.patch
|
||||
* makes-sure-gather_job_timeout-is-an-integer.patch
|
||||
* merge-output-from-master_tops.patch
|
||||
* openscap-module.patch
|
||||
* use-salt-s-ordereddict-for-comparison.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue May 2 11:41:11 UTC 2017 - pablo.suarezhernandez@suse.com
|
||||
|
||||
- Adding "yum-plugin-security" as required for RHEL 6
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Apr 26 14:24:33 UTC 2017 - pablo.suarezhernandez@suse.com
|
||||
|
||||
- Minor fixes on new pkg.list_downloaded
|
||||
- Listing all type of advisory patches for Yum module
|
||||
- Prevents zero length error on Python 2.6
|
||||
- Fixes zypper test error after backporting
|
||||
|
||||
- Added:
|
||||
* search-the-entire-cache_dir-because-storage-paths-ch.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 17 15:24:02 UTC 2017 - pablo.suarezhernandez@suse.com
|
||||
|
||||
- Refactoring on Zypper and Yum execution and state modules to allow
|
||||
installation of patches/errata.
|
||||
|
||||
- Added:
|
||||
* adding-support-for-installing-patches-in-yum-dnf-exe.patch
|
||||
- Removed:
|
||||
* allows-using-downloadonly-in-a-pkg.installed-state.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Apr 10 09:56:50 UTC 2017 - pablo.suarezhernandez@suse.com
|
||||
|
||||
- Fixes 'timeout' and 'gather_job_timeout' kwargs parameters
|
||||
for 'local_batch' client
|
||||
|
||||
- Added:
|
||||
* adds-custom-timeout-and-gather_job_timeout-to-local_.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 7 10:53:39 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
- Add missing bootstrap script for Salt Cloud (bsc#1032452)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 4 14:58:20 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
- raet protocol is no longer supported (bsc#1020831)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 4 14:52:02 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
- Fix: add missing /var/cache/salt/cloud directory (bsc#1032213)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 31 12:27:35 UTC 2017 - pablo.suarezhernandez@suse.com
|
||||
|
||||
- Adding "pkg.install downloadonly=True" support to yum/dnf
|
||||
execution module
|
||||
- Makes sure "gather_job_timeout" is an Integer
|
||||
- Adding "pkg.downloaded" state and support for installing
|
||||
patches/erratas
|
||||
|
||||
- Added:
|
||||
* adding-downloadonly-support-to-yum-dnf-module.patch
|
||||
* allows-using-downloadonly-in-a-pkg.installed-state.patch
|
||||
* makes-sure-gather_job_timeout-is-an-integer.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 31 12:03:18 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
- Added test case for race conditions on cache directory creation
|
||||
- Modified:
|
||||
* fix-race-condition-on-cache-directory-creation.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 24 09:41:01 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
- Cleanup salt user environment preparation (bsc#1027722)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Mar 23 15:53:22 UTC 2017 - moio@suse.com
|
||||
|
||||
- Fix: race condition on cache directory creation
|
||||
|
||||
- Added:
|
||||
* fix-race-condition-on-cache-directory-creation.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 20 10:35:36 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
- Fix: /var/log/salt/minion fails logrotate (bsc#1030009)
|
||||
- Fix: Result of master_tops extension is mutually overwritten
|
||||
(bsc#1030073)
|
||||
- Allows to set 'timeout' and 'gather_job_timeout' via kwargs
|
||||
- Allows to set custom timeouts for 'manage.up' and 'manage.status'
|
||||
- Use salt's ordereddict for comparison (fixes failing tests)
|
||||
- add special salt-minion.service file for RES7
|
||||
- fix scripts for salt-proxy
|
||||
- openscap module
|
||||
|
||||
- Changed:
|
||||
* run-salt-master-as-dedicated-salt-user.patch
|
||||
|
||||
- Added:
|
||||
* allows-to-set-timeout-and-gather_job_timeout-via-kwa.patch
|
||||
* merge-output-from-master_tops.patch
|
||||
* openscap-module.patch
|
||||
* special-salt-minion.service-file-for-rhel7.patch
|
||||
* use-salt-s-ordereddict-for-comparison.patch
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 3 09:36:17 UTC 2017 - bmaryniuk@suse.com
|
||||
|
||||
|
264
salt.spec
264
salt.spec
@ -16,7 +16,7 @@
|
||||
#
|
||||
|
||||
|
||||
%if 0%{?suse_version} > 1210
|
||||
%if 0%{?suse_version} > 1210 || 0%{?rhel} >= 7 || 0%{?fedora}
|
||||
%bcond_without systemd
|
||||
%else
|
||||
%bcond_with systemd
|
||||
@ -32,67 +32,25 @@
|
||||
%bcond_with zsh_completion
|
||||
%endif
|
||||
%bcond_with test
|
||||
%bcond_with raet
|
||||
%bcond_without docs
|
||||
%bcond_with builddocs
|
||||
|
||||
Name: salt
|
||||
Version: 2016.11.3
|
||||
Version: 2017.7.1
|
||||
Release: 0
|
||||
Summary: A parallel remote execution system
|
||||
License: Apache-2.0
|
||||
Group: System/Management
|
||||
Url: http://saltstack.org/
|
||||
# Git: https://github.com/openSUSE/salt.git
|
||||
Source0: https://pypi.io/packages/source/s/%{name}/%{name}-%{version}.tar.gz
|
||||
Source: https://github.com/saltstack/salt/archive/v2017.7.1.tar.gz
|
||||
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
|
||||
Patch1: 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: 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: 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: do-not-generate-a-date-in-a-comment-to-prevent-rebui.patch
|
||||
# PATCH-FIX-OPENSUSE Generate events from the Salt minion,
|
||||
# We do not upstream this because this is for SUSE only (15.08.2016) if Zypper has been used outside the Salt infrastructure
|
||||
Patch5: add-zypp-notify-plugin.patch
|
||||
# PATCH-FIX_OPENSUSE
|
||||
Patch6: run-salt-api-as-user-salt-bsc-990029.patch
|
||||
# PATCH-FIX_OPENSUSE
|
||||
Patch7: change-travis-configuration-file-to-use-salt-toaster.patch
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/37856 (pending to include in 2016.11)
|
||||
Patch8: setting-up-os-grains-for-sles-expanded-support-suse-.patch
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/34165
|
||||
Patch9: fix-salt-summary-to-count-not-responding-minions-cor.patch
|
||||
# PATCH-FIX_OPENSUSE
|
||||
Patch10: avoid-failures-on-sles-12-sp2-because-of-new-systemd.patch
|
||||
# PATCH-FIX_OPENSUSE
|
||||
Patch11: add-yum-plugin.patch
|
||||
# PATCH-FIX_OPENSUSE
|
||||
Patch12: add-ssh-option-to-salt-ssh.patch
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/38806
|
||||
Patch13: add-a-salt-minion-service-control-file.patch
|
||||
# PATCH-FIX-OPENSUSE
|
||||
Patch14: add-options-for-dockerng.patch
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/39591
|
||||
Patch15: fix-case-in-os_family-for-suse.patch
|
||||
# PATCH-FIX_OPENSUSE
|
||||
Patch16: translate-variable-arguments-if-they-contain-hidden-.patch
|
||||
# PATCH-FIX_UPSTREAM https://github.com/saltstack/salt/pull/39762
|
||||
Patch17: fix-regression-in-file.get_managed-add-unit-tests.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: logrotate
|
||||
BuildRequires: python
|
||||
BuildRequires: python-devel
|
||||
@ -102,24 +60,14 @@ BuildRequires: python-jinja2
|
||||
%else
|
||||
BuildRequires: python-Jinja2
|
||||
%endif
|
||||
BuildRequires: python-MarkupSafe
|
||||
BuildRequires: python-PyYAML
|
||||
BuildRequires: python-futures >= 2.0
|
||||
BuildRequires: python-markupsafe
|
||||
BuildRequires: python-msgpack-python > 0.3
|
||||
BuildRequires: python-psutil
|
||||
BuildRequires: python-requests >= 1.0.0
|
||||
BuildRequires: python-tornado >= 4.2.1
|
||||
# requirements/opt.txt (not all)
|
||||
# BuildRequires: python-MySQL-python
|
||||
# BuildRequires: python-timelib
|
||||
# BuildRequires: python-gnupg
|
||||
# BuildRequires: python-cherrypy >= 3.2.2
|
||||
%if %{with raet}
|
||||
# requirements/raet.txt
|
||||
BuildRequires: python-ioflo >= 1.1.7
|
||||
BuildRequires: python-libnacl >= 1.0.0
|
||||
BuildRequires: python-raet >= 0.6.0
|
||||
%endif
|
||||
BuildRequires: python-yaml
|
||||
|
||||
# requirements/zeromq.txt
|
||||
BuildRequires: python-pycrypto >= 2.6.1
|
||||
BuildRequires: python-pyzmq >= 2.2.0
|
||||
@ -136,9 +84,6 @@ BuildRequires: python-xml
|
||||
%if %{with builddocs}
|
||||
BuildRequires: python-sphinx
|
||||
%endif
|
||||
%if 0%{?suse_version} > 1020
|
||||
BuildRequires: fdupes
|
||||
%endif
|
||||
|
||||
Requires(pre): %{_sbindir}/groupadd
|
||||
Requires(pre): %{_sbindir}/useradd
|
||||
@ -155,6 +100,7 @@ Requires(pre): dbus
|
||||
%endif
|
||||
|
||||
Requires: logrotate
|
||||
Requires: procps
|
||||
Requires: python
|
||||
#
|
||||
%if ! 0%{?suse_version} > 1110
|
||||
@ -164,27 +110,28 @@ Requires: python-certifi
|
||||
%if 0%{?rhel}
|
||||
Requires: python-jinja2
|
||||
Requires: yum
|
||||
%if 0%{?rhel} == 6
|
||||
Requires: yum-plugin-security
|
||||
%endif
|
||||
%else
|
||||
Requires: python-Jinja2
|
||||
%endif
|
||||
Requires: python-MarkupSafe
|
||||
Requires: python-PyYAML
|
||||
Requires: python-futures >= 2.0
|
||||
Requires: python-markupsafe
|
||||
Requires: python-msgpack-python > 0.3
|
||||
Requires: python-psutil
|
||||
Requires: python-requests >= 1.0.0
|
||||
Requires: python-tornado >= 4.2.1
|
||||
Requires: python-yaml
|
||||
%if 0%{?suse_version}
|
||||
# required for zypper.py
|
||||
Requires: rpm-python
|
||||
Requires(pre): libzypp(plugin:system) >= 0
|
||||
Requires: zypp-plugin-python
|
||||
# requirements/opt.txt (not all)
|
||||
Recommends: python-MySQL-python
|
||||
Recommends: python-timelib
|
||||
Recommends: python-gnupg
|
||||
# requirements/raet.txt
|
||||
# Recommends: salt-raet
|
||||
# Suggests: python-MySQL-python ## Disabled for now, originally Recommended
|
||||
Suggests: python-timelib
|
||||
Suggests: python-gnupg
|
||||
# requirements/zeromq.txt
|
||||
%endif
|
||||
Requires: python-pycrypto >= 2.6.1
|
||||
@ -193,7 +140,7 @@ Requires: python-pyzmq >= 2.2.0
|
||||
%if 0%{?suse_version}
|
||||
# python-xml is part of python-base in all rhel versions
|
||||
Requires: python-xml
|
||||
Recommends: python-Mako
|
||||
Suggests: python-Mako
|
||||
Recommends: python-netaddr
|
||||
%endif
|
||||
|
||||
@ -272,7 +219,7 @@ This contains the documentation of salt, it is an offline version of http://docs
|
||||
%endif
|
||||
|
||||
%package master
|
||||
Summary: The management component of Saltstack both protocols zmq and raet supported
|
||||
Summary: The management component of Saltstack with zmq protocol supported
|
||||
Group: System/Management
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
%if 0%{?suse_version}
|
||||
@ -323,28 +270,6 @@ Requires(pre): %fillup_prereq
|
||||
Salt minion is queried and controlled from the master.
|
||||
Listens to the salt master and execute the commands.
|
||||
|
||||
%package raet
|
||||
Summary: Raet Support for Saltstack
|
||||
Group: System/Management
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: python-enum34
|
||||
Requires: python-ioflo >= 1.1.7
|
||||
Requires: python-libnacl >= 1.0.0
|
||||
Requires: python-raet >= 0.6.0
|
||||
|
||||
%description raet
|
||||
The Reliable Asynchronous Event Transport, or RAET, is an alternative transport
|
||||
medium developed specifically with Salt in mind. It has been developed to allow
|
||||
queuing to happen up on the application layer and comes with socket layer
|
||||
encryption. It also abstracts a great deal of control over the socket layer and
|
||||
makes it easy to bubble up errors and exceptions.
|
||||
|
||||
RAET also offers very powerful message routing capabilities, allowing for
|
||||
messages to be routed between processes on a single machine all the way up to
|
||||
processes on multiple machines. Messages can also be restricted, allowing
|
||||
processes to be sent messages of specific types from specific sources allowing
|
||||
for trust to be established.
|
||||
|
||||
%package proxy
|
||||
Summary: Component for salt that enables controlling arbitrary devices
|
||||
Group: System/Management
|
||||
@ -460,28 +385,6 @@ Zsh command line completion support for %{name}.
|
||||
%setup -q -n salt-%{version}
|
||||
cp %{S:1} .
|
||||
cp %{S:5} ./.travis.yml
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
|
||||
# This is SUSE-only patch
|
||||
%if 0%{?suse_version}
|
||||
%patch5 -p1
|
||||
%endif
|
||||
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
|
||||
%build
|
||||
%{__python} setup.py --salt-transport=both build
|
||||
@ -490,7 +393,7 @@ cp %{S:5} ./.travis.yml
|
||||
# extract docs from the tarball
|
||||
mkdir -p doc/_build
|
||||
pushd doc/_build/
|
||||
tar xfv %{S:3}
|
||||
tar -xvf %{S:3}
|
||||
popd
|
||||
%endif
|
||||
|
||||
@ -519,6 +422,7 @@ install -Dd -m 0750 %{buildroot}%{_localstatedir}/cache/salt/master/queues
|
||||
install -Dd -m 0750 %{buildroot}%{_localstatedir}/cache/salt/master/roots
|
||||
install -Dd -m 0750 %{buildroot}%{_localstatedir}/cache/salt/master/syndics
|
||||
install -Dd -m 0750 %{buildroot}%{_localstatedir}/cache/salt/master/tokens
|
||||
install -Dd -m 0750 %{buildroot}%{_localstatedir}/cache/salt/cloud
|
||||
install -Dd -m 0750 %{buildroot}/var/lib/salt
|
||||
install -Dd -m 0750 %{buildroot}/srv/salt
|
||||
install -Dd -m 0750 %{buildroot}/srv/pillar
|
||||
@ -542,23 +446,27 @@ install -Dd -m 0750 %{buildroot}%{_sysconfdir}/salt/pki/minion
|
||||
## 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/zyppnotify %{buildroot}%{_prefix}/lib/zypp/plugins/commit/zyppnotify
|
||||
install scripts/suse/zypper/plugins/commit/zyppnotify %{buildroot}%{_prefix}/lib/zypp/plugins/commit/zyppnotify
|
||||
%endif
|
||||
|
||||
# Install Yum plugins only on RH machines
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
install -Dd %{buildroot}%{_prefix}/share/yum-plugins
|
||||
install -Dd %{buildroot}/etc/yum/pluginconf.d
|
||||
%{__install} scripts/yum/plugins/yumnotify.py %{buildroot}%{_prefix}/share/yum-plugins
|
||||
%{__install} scripts/yum/plugins/yumnotify.conf %{buildroot}/etc/yum/pluginconf.d
|
||||
install scripts/suse/yum/plugins/yumnotify.py %{buildroot}%{_prefix}/share/yum-plugins
|
||||
install scripts/suse/yum/plugins/yumnotify.conf %{buildroot}/etc/yum/pluginconf.d
|
||||
%endif
|
||||
|
||||
## install init and systemd scripts
|
||||
%if %{with systemd}
|
||||
install -Dpm 0644 pkg/salt-master.service %{buildroot}%{_unitdir}/salt-master.service
|
||||
%if 0%{?suse_version}
|
||||
install -Dpm 0644 pkg/suse/salt-minion.service %{buildroot}%{_unitdir}/salt-minion.service
|
||||
%else
|
||||
install -Dpm 0644 pkg/suse/salt-minion.service.rhel7 %{buildroot}%{_unitdir}/salt-minion.service
|
||||
%endif
|
||||
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/suse/salt-api.service %{buildroot}%{_unitdir}/salt-api.service
|
||||
install -Dpm 0644 pkg/salt-proxy@.service %{buildroot}%{_unitdir}/salt-proxy@.service
|
||||
ln -s service %{buildroot}%{_sbindir}/rcsalt-master
|
||||
ln -s service %{buildroot}%{_sbindir}/rcsalt-syndic
|
||||
@ -578,6 +486,11 @@ ln -sf %{_initddir}/salt-minion %{buildroot}%{_sbindir}/rcsalt-minion
|
||||
ln -sf %{_initddir}/salt-api %{buildroot}%{_sbindir}/rcsalt-api
|
||||
%endif
|
||||
|
||||
## Install sysV salt-minion watchdog for SLES11 and RHEL6
|
||||
%if 0%{?rhel} == 6 || 0%{?suse_version} == 1110
|
||||
install -Dpm 0755 scripts/suse/watchdog/salt-daemon-watcher %{buildroot}%{_bindir}/salt-daemon-watcher
|
||||
%endif
|
||||
|
||||
#
|
||||
## install config files
|
||||
install -Dpm 0640 conf/minion %{buildroot}%{_sysconfdir}/salt/minion
|
||||
@ -588,8 +501,12 @@ install -Dpm 0640 conf/cloud %{buildroot}%{_sysconfdir}/salt/cloud
|
||||
install -Dpm 0640 conf/cloud.profiles %{buildroot}%{_sysconfdir}/salt/cloud.profiles
|
||||
install -Dpm 0640 conf/cloud.providers %{buildroot}%{_sysconfdir}/salt/cloud.providers
|
||||
#
|
||||
## install logrotate file
|
||||
## install logrotate file (for RHEL6 we use without sudo)
|
||||
%if 0%{?rhel} > 6 || 0%{?suse_version}
|
||||
install -Dpm 0644 pkg/suse/salt-common.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/salt
|
||||
%else
|
||||
install -Dpm 0644 pkg/salt-common.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/salt
|
||||
%endif
|
||||
#
|
||||
## install SuSEfirewall2 rules
|
||||
install -Dpm 0644 pkg/suse/salt.SuSEfirewall2 %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/salt
|
||||
@ -607,13 +524,8 @@ mkdir -p %{buildroot}%{fish_completions_dir}
|
||||
install -Dpm 0644 pkg/fish-completions/* %{buildroot}%{fish_completions_dir}
|
||||
%endif
|
||||
|
||||
# raet transport config
|
||||
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}
|
||||
%fdupes %{buildroot}/%{_prefix}
|
||||
%endif
|
||||
|
||||
%check
|
||||
@ -622,9 +534,14 @@ python setup.py test --runtests-opts=-u
|
||||
%endif
|
||||
|
||||
%pre
|
||||
getent passwd salt | grep srv\/salt >/dev/null && usermod -d /var/lib/salt salt
|
||||
S_HOME="/var/lib/salt"
|
||||
S_PHOME="/srv/salt"
|
||||
getent passwd salt | grep -q $S_PHOME && usermod -d $S_HOME salt
|
||||
getent group salt >/dev/null || %{_sbindir}/groupadd -r salt
|
||||
getent passwd salt >/dev/null || %{_sbindir}/useradd -r -g salt -d /var/lib/salt -s /bin/false -c "salt-master daemon" salt
|
||||
getent passwd salt >/dev/null || %{_sbindir}/useradd -r -g salt -d $S_HOME -s /bin/false -c "salt-master daemon" salt
|
||||
if [ -d "$S_PHOME/.ssh" ]; then
|
||||
mv $S_PHOME/.ssh $S_HOME
|
||||
fi
|
||||
|
||||
%post
|
||||
%if %{with systemd}
|
||||
@ -635,8 +552,12 @@ dbus-uuidgen --ensure
|
||||
|
||||
%preun proxy
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_del_preun salt-proxy@.service
|
||||
%else
|
||||
%systemd_preun salt-proxy@.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%stop_on_removal salt-proxy
|
||||
%endif
|
||||
@ -644,14 +565,20 @@ dbus-uuidgen --ensure
|
||||
|
||||
%pre proxy
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_add_pre salt-proxy@.service
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%post proxy
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_add_post salt-proxy@.service
|
||||
%fillup_only
|
||||
%else
|
||||
%systemd_post salt-proxy@.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%fillup_and_insserv
|
||||
%endif
|
||||
@ -659,8 +586,12 @@ dbus-uuidgen --ensure
|
||||
|
||||
%postun proxy
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_del_postun salt-proxy@.service
|
||||
%else
|
||||
%systemd_postun_with_restart salt-proxy@.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%insserv_cleanup
|
||||
%restart_on_update salt-proxy
|
||||
@ -669,8 +600,12 @@ dbus-uuidgen --ensure
|
||||
|
||||
%preun syndic
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_del_preun salt-syndic.service
|
||||
%else
|
||||
%systemd_preun salt-syndic.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%stop_on_removal salt-syndic
|
||||
%else
|
||||
@ -683,14 +618,20 @@ dbus-uuidgen --ensure
|
||||
|
||||
%pre syndic
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_add_pre salt-syndic.service
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%post syndic
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_add_post salt-syndic.service
|
||||
%fillup_only
|
||||
%else
|
||||
%systemd_post salt-syndic.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%fillup_and_insserv
|
||||
%endif
|
||||
@ -698,8 +639,12 @@ dbus-uuidgen --ensure
|
||||
|
||||
%postun syndic
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_del_postun salt-syndic.service
|
||||
%else
|
||||
%systemd_postun_with_restart salt-syndic.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%insserv_cleanup
|
||||
%restart_on_update salt-syndic
|
||||
@ -708,8 +653,12 @@ dbus-uuidgen --ensure
|
||||
|
||||
%preun master
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_del_preun salt-master.service
|
||||
%else
|
||||
%systemd_preun salt-master.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%stop_on_removal salt-master
|
||||
%else
|
||||
@ -722,8 +671,10 @@ dbus-uuidgen --ensure
|
||||
|
||||
%pre master
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_add_pre salt-master.service
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%post master
|
||||
if [ $1 -eq 2 ] ; then
|
||||
@ -735,15 +686,19 @@ if [ $1 -eq 2 ] ; then
|
||||
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
|
||||
MASTER_CACHE_DIR="/var/cache/salt/master"
|
||||
[ -d $MASTER_CACHE_DIR ] && chown -R salt:salt $MASTER_CACHE_DIR
|
||||
[ -f $MASTER_CACHE_DIR/.root_key ] && chown root:root $MASTER_CACHE_DIR/.root_key
|
||||
true
|
||||
fi
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_add_post salt-master.service
|
||||
%fillup_only
|
||||
%else
|
||||
%systemd_post salt-master.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%fillup_and_insserv
|
||||
%else
|
||||
@ -753,8 +708,12 @@ fi
|
||||
|
||||
%postun master
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_del_postun salt-master.service
|
||||
%else
|
||||
%systemd_postun_with_restart salt-master.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%restart_on_update salt-master
|
||||
%insserv_cleanup
|
||||
@ -767,8 +726,12 @@ fi
|
||||
|
||||
%preun minion
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_del_preun salt-minion.service
|
||||
%else
|
||||
%systemd_preun salt-minion.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%stop_on_removal salt-minion
|
||||
%else
|
||||
@ -781,14 +744,20 @@ fi
|
||||
|
||||
%pre minion
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_add_pre salt-minion.service
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%post minion
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_add_post salt-minion.service
|
||||
%fillup_only
|
||||
%else
|
||||
%systemd_post salt-minion.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%fillup_and_insserv
|
||||
%else
|
||||
@ -798,8 +767,12 @@ fi
|
||||
|
||||
%postun minion
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_del_postun salt-minion.service
|
||||
%else
|
||||
%systemd_postun_with_restart salt-minion.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%insserv_cleanup
|
||||
%restart_on_update salt-minion
|
||||
@ -812,20 +785,30 @@ fi
|
||||
|
||||
%preun api
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_del_preun salt-api.service
|
||||
%else
|
||||
%systemd_preun salt-api.service
|
||||
%endif
|
||||
%else
|
||||
%stop_on_removal
|
||||
%endif
|
||||
|
||||
%pre api
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_add_pre salt-api.service
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%post api
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_add_post salt-api.service
|
||||
%else
|
||||
%systemd_post salt-api.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%fillup_and_insserv
|
||||
%endif
|
||||
@ -833,8 +816,12 @@ fi
|
||||
|
||||
%postun api
|
||||
%if %{with systemd}
|
||||
%if 0%{?suse_version}
|
||||
%service_del_postun salt-api.service
|
||||
%else
|
||||
%systemd_postun_with_restart salt-api.service
|
||||
%endif
|
||||
%else
|
||||
%if 0%{?suse_version}
|
||||
%insserv_cleanup
|
||||
%restart_on_update
|
||||
@ -861,6 +848,9 @@ fi
|
||||
%config(noreplace) %attr(0640, root, salt) %{_sysconfdir}/salt/cloud
|
||||
%config(noreplace) %attr(0640, root, salt) %{_sysconfdir}/salt/cloud.profiles
|
||||
%config(noreplace) %attr(0640, root, salt) %{_sysconfdir}/salt/cloud.providers
|
||||
%dir %attr(0750, root, salt) %{_localstatedir}/cache/salt/cloud
|
||||
%{python_sitelib}/salt/cloud/deploy/bootstrap-salt.sh
|
||||
%attr(755,root,root)%{python_sitelib}/salt/cloud/deploy/bootstrap-salt.sh
|
||||
%{_mandir}/man1/salt-cloud.1.*
|
||||
|
||||
%files ssh
|
||||
@ -908,6 +898,11 @@ fi
|
||||
%config(noreplace) %{_initddir}/salt-minion
|
||||
%endif
|
||||
|
||||
## Install sysV salt-minion watchdog for SLES11 and RHEL6
|
||||
%if 0%{?rhel} == 6 || 0%{?suse_version} == 1110
|
||||
%{_bindir}/salt-daemon-watcher
|
||||
%endif
|
||||
|
||||
%files proxy
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/salt-proxy
|
||||
@ -957,11 +952,6 @@ fi
|
||||
%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,-)
|
||||
%config(noreplace) %attr(0640, root, salt) %{_sysconfdir}/salt/master.d/transport-raet.conf
|
||||
%config(noreplace) %attr(0640, root, root) %{_sysconfdir}/salt/minion.d/transport-raet.conf
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_bindir}/spm
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 5a07f204d45b2b86d8bc0279527723e030cc4e21 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] Setting up OS grains for SLES Expanded Support (SUSE's
|
||||
Red Hat compatible platform)
|
||||
|
||||
core.py: quote style fixed
|
||||
---
|
||||
salt/grains/core.py | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/salt/grains/core.py b/salt/grains/core.py
|
||||
index 6a42cc734f..fce35cb313 100644
|
||||
--- a/salt/grains/core.py
|
||||
+++ b/salt/grains/core.py
|
||||
@@ -1049,6 +1049,7 @@ _OS_NAME_MAP = {
|
||||
'sles': 'SUSE',
|
||||
'slesexpand': 'RES',
|
||||
'void': 'Void',
|
||||
+ 'slesexpand': 'RES',
|
||||
'linuxmint': 'Mint',
|
||||
}
|
||||
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,91 +0,0 @@
|
||||
From 7313bf5574a72557a6389b9a991316d0b2c6f848 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Calmer <mc@suse.de>
|
||||
Date: Wed, 1 Mar 2017 15:37:04 +0100
|
||||
Subject: [PATCH] translate variable arguments if they contain hidden
|
||||
keywords (bsc#1025896)
|
||||
|
||||
- includes a test
|
||||
---
|
||||
salt/states/module.py | 30 ++++++++++++++++++++++--------
|
||||
tests/unit/states/module_test.py | 14 ++++++++++++++
|
||||
2 files changed, 36 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/salt/states/module.py b/salt/states/module.py
|
||||
index 686546832f..adc6e12c9d 100644
|
||||
--- a/salt/states/module.py
|
||||
+++ b/salt/states/module.py
|
||||
@@ -218,16 +218,30 @@ def run(name, **kwargs):
|
||||
ret['result'] = False
|
||||
return ret
|
||||
|
||||
- if aspec.varargs and aspec.varargs in kwargs:
|
||||
- varargs = kwargs.pop(aspec.varargs)
|
||||
+ if aspec.varargs:
|
||||
+ if aspec.varargs == 'name':
|
||||
+ rarg = 'm_name'
|
||||
+ elif aspec.varargs == 'fun':
|
||||
+ rarg = 'm_fun'
|
||||
+ elif aspec.varargs == 'names':
|
||||
+ rarg = 'm_names'
|
||||
+ elif aspec.varargs == 'state':
|
||||
+ rarg = 'm_state'
|
||||
+ elif aspec.varargs == 'saltenv':
|
||||
+ rarg = 'm_saltenv'
|
||||
+ else:
|
||||
+ rarg = aspec.varargs
|
||||
|
||||
- if not isinstance(varargs, list):
|
||||
- msg = "'{0}' must be a list."
|
||||
- ret['comment'] = msg.format(aspec.varargs)
|
||||
- ret['result'] = False
|
||||
- return ret
|
||||
+ if rarg in kwargs:
|
||||
+ varargs = kwargs.pop(rarg)
|
||||
+
|
||||
+ if not isinstance(varargs, list):
|
||||
+ msg = "'{0}' must be a list."
|
||||
+ ret['comment'] = msg.format(aspec.varargs)
|
||||
+ ret['result'] = False
|
||||
+ return ret
|
||||
|
||||
- args.extend(varargs)
|
||||
+ args.extend(varargs)
|
||||
|
||||
nkwargs = {}
|
||||
if aspec.keywords and aspec.keywords in kwargs:
|
||||
diff --git a/tests/unit/states/module_test.py b/tests/unit/states/module_test.py
|
||||
index 0c025e3861..20dda73938 100644
|
||||
--- a/tests/unit/states/module_test.py
|
||||
+++ b/tests/unit/states/module_test.py
|
||||
@@ -38,6 +38,10 @@ class ModuleStateTest(TestCase):
|
||||
varargs=None,
|
||||
keywords=None,
|
||||
defaults=False)
|
||||
+ bspec = ArgSpec(args=[],
|
||||
+ varargs='names',
|
||||
+ keywords='kwargs',
|
||||
+ defaults=None)
|
||||
|
||||
def test_module_run_module_not_available(self):
|
||||
'''
|
||||
@@ -69,6 +73,16 @@ class ModuleStateTest(TestCase):
|
||||
comment = 'The following arguments are missing: world hello'
|
||||
self.assertEqual(ret['comment'], comment)
|
||||
|
||||
+ @patch('salt.utils.args.get_function_argspec', MagicMock(return_value=bspec))
|
||||
+ def test_module_run_hidden_varargs(self):
|
||||
+ '''
|
||||
+ Tests the return of module.run state when hidden varargs are used with
|
||||
+ wrong type.
|
||||
+ '''
|
||||
+ ret = module.run(CMD, m_names = 'anyname')
|
||||
+ comment = "'names' must be a list."
|
||||
+ self.assertEqual(ret['comment'], comment)
|
||||
+
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -1,28 +0,0 @@
|
||||
From a9f1be35b0c158fcdd460dcc8c501fe039d97258 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] tserong@suse.com -- We don't have python-systemd, so
|
||||
notify can't work
|
||||
|
||||
---
|
||||
pkg/salt-master.service | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pkg/salt-master.service b/pkg/salt-master.service
|
||||
index 1f4650f872..59be50301a 100644
|
||||
--- a/pkg/salt-master.service
|
||||
+++ b/pkg/salt-master.service
|
||||
@@ -4,8 +4,7 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
LimitNOFILE=16384
|
||||
-Type=notify
|
||||
-NotifyAccess=all
|
||||
+Type=simple
|
||||
ExecStart=/usr/bin/salt-master
|
||||
|
||||
[Install]
|
||||
--
|
||||
2.11.0
|
||||
|
||||
|
@ -4,10 +4,35 @@
|
||||
# Author: Bo Maryniuk <bo@suse.de>
|
||||
#
|
||||
|
||||
NO_SPHINX_PARAM="--without-sphinx"
|
||||
|
||||
function build_virtenv() {
|
||||
virtualenv --system-site-packages $1
|
||||
source $1/bin/activate
|
||||
pip install --upgrade pip
|
||||
if [ -z "$2" ]; then
|
||||
pip install -I Sphinx
|
||||
fi
|
||||
}
|
||||
|
||||
function check_env() {
|
||||
for cmd in "sphinx-build" "make" "quilt"; do
|
||||
if [[ -z "$1" || "$1" != "$NO_SPHINX_PARAM" ]] && [ ! -z "$(which sphinx-build 2>/dev/null)" ]; then
|
||||
cat <<EOF
|
||||
You've installed Spinx globally. But it might be outdated or
|
||||
clash with the version I am going to install into the temporary
|
||||
virtual environment from PIP.
|
||||
|
||||
Please consider to remove Sphinx from your system, perhaps?
|
||||
Or pass me "$NO_SPHINX_PARAM" param so I will try reusing yours
|
||||
and see what happens. :)
|
||||
|
||||
EOF
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
for cmd in "make" "quilt" "virtualenv" "pip"; do
|
||||
if [ -z "$(which $cmd 2>/dev/null)" ]; then
|
||||
echo "Error: '$cmd' is missing."
|
||||
echo "Error: '$cmd' is still missing. Install it, please."
|
||||
exit 1;
|
||||
fi
|
||||
done
|
||||
@ -26,7 +51,7 @@ function build_docs() {
|
||||
cd _build/html
|
||||
chmod -R -x+X *
|
||||
cd ..
|
||||
tar cvf - html | bzip2 > /tmp/html.tar.bz2
|
||||
tar cvf - html | bzip2 > $2/html.tar.bz2
|
||||
}
|
||||
|
||||
function write_changelog() {
|
||||
@ -46,19 +71,30 @@ EOF
|
||||
}
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 <your e-mail>"
|
||||
echo "Usage: $0 <your e-mail> [--without-sphinx]"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
check_env;
|
||||
check_env $2;
|
||||
|
||||
START=$(pwd)
|
||||
V_ENV="sphinx_doc_gen"
|
||||
V_TMP=$(mktemp -d)
|
||||
|
||||
for f in "salt.spec" "salt*tar.gz"; do
|
||||
cp -v $f $V_TMP
|
||||
done
|
||||
|
||||
cd $V_TMP;
|
||||
build_virtenv $V_ENV $2;
|
||||
|
||||
SRC_DIR="salt-$(cat salt.spec | grep ^Version: | cut -d: -f2 | sed -e 's/[[:blank:]]//g')";
|
||||
quilt_setup $SRC_DIR
|
||||
build_docs doc
|
||||
build_docs doc $V_TMP
|
||||
|
||||
cd $START
|
||||
rm -rf $SRC_DIR
|
||||
mv /tmp/html.tar.bz2 $START
|
||||
mv $V_TMP/html.tar.bz2 $START
|
||||
rm -rf $V_TMP
|
||||
|
||||
echo "Done"
|
||||
echo "---------------"
|
||||
|
3
v2017.7.1.tar.gz
Normal file
3
v2017.7.1.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:232b7fbe27f07670e8dc9f869bffc7681d780f3b1711926ac812391b05f272b8
|
||||
size 11420619
|
Loading…
x
Reference in New Issue
Block a user