diff options
Diffstat (limited to 'app-admin/salt/files')
31 files changed, 885 insertions, 0 deletions
diff --git a/app-admin/salt/files/api-confd-1 b/app-admin/salt/files/api-confd-1 new file mode 100644 index 000000000000..c70e8e766da0 --- /dev/null +++ b/app-admin/salt/files/api-confd-1 @@ -0,0 +1,5 @@ +# /etc/conf.d/salt-master: config file for /etc/init.d/salt-master + +# see man pages for salt-minion or run `salt-master --help` +# for valid cmdline options +SALT_OPTS="--log-level=warning" diff --git a/app-admin/salt/files/api-initd-4 b/app-admin/salt/files/api-initd-4 new file mode 100644 index 000000000000..a0cb8265047d --- /dev/null +++ b/app-admin/salt/files/api-initd-4 @@ -0,0 +1,14 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +command="/usr/bin/salt-api" +command_args="${SALT_OPTS}" +command_background="1" +pidfile="/var/run/salt-api.pid" +name="SALT API daemon" +retry="20" + +depend() { + use net logger +} diff --git a/app-admin/salt/files/master-confd-1 b/app-admin/salt/files/master-confd-1 new file mode 100644 index 000000000000..c70e8e766da0 --- /dev/null +++ b/app-admin/salt/files/master-confd-1 @@ -0,0 +1,5 @@ +# /etc/conf.d/salt-master: config file for /etc/init.d/salt-master + +# see man pages for salt-minion or run `salt-master --help` +# for valid cmdline options +SALT_OPTS="--log-level=warning" diff --git a/app-admin/salt/files/master-initd-4 b/app-admin/salt/files/master-initd-4 new file mode 100644 index 000000000000..e07e72b0dae7 --- /dev/null +++ b/app-admin/salt/files/master-initd-4 @@ -0,0 +1,14 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +command="/usr/bin/salt-master" +command_args="${SALT_OPTS}" +command_background="1" +pidfile="/var/run/salt-master.pid" +name="SALT master daemon" +retry="20" + +depend() { + use net logger +} diff --git a/app-admin/salt/files/minion-confd-1 b/app-admin/salt/files/minion-confd-1 new file mode 100644 index 000000000000..d69d83fcd60d --- /dev/null +++ b/app-admin/salt/files/minion-confd-1 @@ -0,0 +1,5 @@ +# /etc/conf.d/salt-minion: config file for /etc/init.d/salt-minion + +# see man pages for salt-minion or run `salt-minion --help` +# for valid cmdline options +SALT_OPTS="--log-level=warning" diff --git a/app-admin/salt/files/minion-initd-4 b/app-admin/salt/files/minion-initd-4 new file mode 100644 index 000000000000..c658ccf5c1df --- /dev/null +++ b/app-admin/salt/files/minion-initd-4 @@ -0,0 +1,15 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +command="/usr/bin/salt-minion" +command_args="${SALT_OPTS}" +command_background="1" +pidfile="/var/run/salt-minion.pid" +name="SALT minion daemon" +retry="20" + +depend() { + need net + use logger +} diff --git a/app-admin/salt/files/salt-2014.7.1-remove-pydsl-includes-test.patch b/app-admin/salt/files/salt-2014.7.1-remove-pydsl-includes-test.patch new file mode 100644 index 000000000000..7c33c12f5c71 --- /dev/null +++ b/app-admin/salt/files/salt-2014.7.1-remove-pydsl-includes-test.patch @@ -0,0 +1,104 @@ +diff --git a/tests/unit/pydsl_test.py b/tests/unit/pydsl_test.py +index 57ba81e..b26154e 100644 +--- a/tests/unit/pydsl_test.py ++++ b/tests/unit/pydsl_test.py +@@ -298,99 +298,6 @@ class PyDSLRendererTestCase(TestCase): + finally: + shutil.rmtree(dirpath, ignore_errors=True) + +- def test_rendering_includes(self): +- dirpath = tempfile.mkdtemp(dir=integration.SYS_TMP_DIR) +- if not os.path.isdir(dirpath): +- self.skipTest( +- 'The temporary directory {0!r} was not created'.format( +- dirpath +- ) +- ) +- output = os.path.join(dirpath, 'output') +- try: +- write_to(os.path.join(dirpath, 'aaa.sls'), textwrap.dedent('''\ +- #!pydsl|stateconf -ps +- +- include('xxx') +- yyy = include('yyy') +- +- # ensure states in xxx are run first, then those in yyy and then those in aaa last. +- extend(state('yyy::start').stateconf.require(stateconf='xxx::goal')) +- extend(state('.start').stateconf.require(stateconf='yyy::goal')) +- +- extend(state('yyy::Y2').cmd.run('echo Y2 extended >> {0}')) +- +- __pydsl__.set(ordered=True) +- +- yyy.hello('red', 1) +- yyy.hello('green', 2) +- yyy.hello('blue', 3) +- '''.format(output))) +- +- write_to(os.path.join(dirpath, 'xxx.sls'), textwrap.dedent('''\ +- #!stateconf -os yaml . jinja +- +- include: +- - yyy +- +- extend: +- yyy::start: +- stateconf.set: +- - require: +- - stateconf: .goal +- +- yyy::Y1: +- cmd.run: +- - name: 'echo Y1 extended >> {0}' +- +- .X1: +- cmd.run: +- - name: echo X1 >> {1} +- - cwd: / +- .X2: +- cmd.run: +- - name: echo X2 >> {2} +- - cwd: / +- .X3: +- cmd.run: +- - name: echo X3 >> {3} +- - cwd: / +- +- '''.format(output, output, output, output))) +- +- write_to(os.path.join(dirpath, 'yyy.sls'), textwrap.dedent('''\ +- #!pydsl|stateconf -ps +- +- include('xxx') +- __pydsl__.set(ordered=True) +- +- state('.Y1').cmd.run('echo Y1 >> {0}', cwd='/') +- state('.Y2').cmd.run('echo Y2 >> {1}', cwd='/') +- state('.Y3').cmd.run('echo Y3 >> {2}', cwd='/') +- +- def hello(color, number): +- state(color).cmd.run('echo hello '+color+' '+str(number)+' >> {3}', cwd='/') +- '''.format(output, output, output, output))) +- +- state_highstate({'base': ['aaa']}, dirpath) +- expected = textwrap.dedent('''\ +- X1 +- X2 +- X3 +- Y1 extended +- Y2 extended +- Y3 +- hello red 1 +- hello green 2 +- hello blue 3 +- ''') +- +- with salt.utils.fopen(output, 'r') as f: +- self.assertEqual(sorted(f.read()), sorted(expected)) +- +- finally: +- shutil.rmtree(dirpath, ignore_errors=True) +- + def test_compile_time_state_execution(self): + if not sys.stdin.isatty(): + self.skipTest('Not attached to a TTY') diff --git a/app-admin/salt/files/salt-2015.5.10-buggy-tests.patch b/app-admin/salt/files/salt-2015.5.10-buggy-tests.patch new file mode 100644 index 000000000000..e9330bd255b5 --- /dev/null +++ b/app-admin/salt/files/salt-2015.5.10-buggy-tests.patch @@ -0,0 +1,38 @@ +diff --git a/tests/unit/modules/boto_vpc_test.py b/tests/unit/modules/boto_vpc_test.py +index 82dfe28..ced9ee5 100644 +--- a/tests/unit/modules/boto_vpc_test.py ++++ b/tests/unit/modules/boto_vpc_test.py +@@ -441,9 +441,9 @@ class BotoVpcTestCase(BotoVpcTestCaseBase): + describe_vpc = boto_vpc.describe(vpc_id=vpc.id, **conn_parameters) + + vpc_properties = dict(cidr_block=unicode(cidr_block), +- is_default=None, ++ is_default=False, + state=u'available', +- tags={'Name': 'test', 'test': 'testvalue'}, ++ tags={u'Name': u'test', u'test': u'testvalue'}, + dhcp_options_id=u'dopt-7a8b9c2d', + instance_tenancy=u'default') + +diff --git a/tests/unit/states/pip_test.py b/tests/unit/states/pip_test.py +index 6e7d083..9a83951 100644 +--- a/tests/unit/states/pip_test.py ++++ b/tests/unit/states/pip_test.py +@@ -37,17 +37,6 @@ class PipStateTest(TestCase, integration.SaltReturnAssertsMixIn): + def test_install_requirements_parsing(self): + mock = MagicMock(return_value={'retcode': 0, 'stdout': ''}) + pip_list = MagicMock(return_value={'pep8': '1.3.3'}) +- with patch.dict(pip_state.__salt__, {'cmd.run_all': mock, +- 'pip.list': pip_list}): +- with patch.dict(pip_state.__opts__, {'test': True}): +- ret = pip_state.installed('pep8=1.3.2') +- self.assertSaltFalseReturn({'test': ret}) +- self.assertInSaltComment( +- 'Invalid version specification in package pep8=1.3.2. ' +- '\'=\' is not supported, use \'==\' instead.', +- {'test': ret} +- ) +- + mock = MagicMock(return_value={'retcode': 0, 'stdout': ''}) + pip_list = MagicMock(return_value={'pep8': '1.3.3'}) + pip_install = MagicMock(return_value={'retcode': 0}) diff --git a/app-admin/salt/files/salt-2015.5.5-auth-tests.patch b/app-admin/salt/files/salt-2015.5.5-auth-tests.patch new file mode 100644 index 000000000000..fa092d1f3eaf --- /dev/null +++ b/app-admin/salt/files/salt-2015.5.5-auth-tests.patch @@ -0,0 +1,34 @@ +diff --git a/tests/unit/auth_test.py b/tests/unit/auth_test.py +index 10b77e9..c40f439 100644 +--- a/tests/unit/auth_test.py ++++ b/tests/unit/auth_test.py +@@ -38,12 +38,12 @@ class LoadAuthTestCase(TestCase): + + # Test a case with valid params + with patch('salt.utils.format_call') as format_call_mock: +- expected_ret = call('fake_func_str', { ++ expected_ret = [call('fake_func_str', { + 'username': 'test_user', + 'test_password': '', + 'show_timeout': False, + 'eauth': 'pam' +- }, expected_extra_kws=auth.AUTH_INTERNAL_KEYWORDS) ++ }, expected_extra_kws=auth.AUTH_INTERNAL_KEYWORDS)] + ret = self.lauth.load_name(valid_eauth_load) + format_call_mock.assert_has_calls(expected_ret) + +@@ -53,12 +53,12 @@ class LoadAuthTestCase(TestCase): + 'test_password': '', + 'eauth': 'pam'} + with patch('salt.utils.format_call') as format_call_mock: +- expected_ret = call('fake_groups_function_str', { ++ expected_ret = [call('fake_groups_function_str', { + 'username': 'test_user', + 'test_password': '', + 'show_timeout': False, + 'eauth': 'pam' +- }, expected_extra_kws=auth.AUTH_INTERNAL_KEYWORDS) ++ }, expected_extra_kws=auth.AUTH_INTERNAL_KEYWORDS)] + self.lauth.get_groups(valid_eauth_load) + format_call_mock.assert_has_calls(expected_ret) + diff --git a/app-admin/salt/files/salt-2015.5.5-cron-tests.patch b/app-admin/salt/files/salt-2015.5.5-cron-tests.patch new file mode 100644 index 000000000000..d0c4ffc92df1 --- /dev/null +++ b/app-admin/salt/files/salt-2015.5.5-cron-tests.patch @@ -0,0 +1,17 @@ +diff --git a/tests/unit/modules/cron_test.py b/tests/unit/modules/cron_test.py +index 017eabd..dac0122 100644 +--- a/tests/unit/modules/cron_test.py ++++ b/tests/unit/modules/cron_test.py +@@ -573,10 +573,10 @@ class PsTestCase(TestCase): + @patch('salt.modules.cron._write_cron_lines') + @patch('salt.modules.cron.list_tab', new=MagicMock(return_value=STUB_SIMPLE_CRON_DICT)) + def test_set_special(self, write_cron_lines_mock): +- expected_write_call = call('DUMMY_USER', ++ expected_write_call = [call('DUMMY_USER', + ['5 0 * * * /tmp/no_script.sh\n', + '# Lines below here are managed by Salt, do not edit\n', +- '@hourly echo Hi!\n']) ++ '@hourly echo Hi!\n'])] + ret = cron.set_special('DUMMY_USER', '@hourly', 'echo Hi!') + write_cron_lines_mock.assert_has_calls(expected_write_call) + diff --git a/app-admin/salt/files/salt-2015.5.5-remove-buggy-tests.patch b/app-admin/salt/files/salt-2015.5.5-remove-buggy-tests.patch new file mode 100644 index 000000000000..b36e35fb9a58 --- /dev/null +++ b/app-admin/salt/files/salt-2015.5.5-remove-buggy-tests.patch @@ -0,0 +1,46 @@ +diff --git a/tests/unit/modules/darwin_sysctl_test.py b/tests/unit/modules/darwin_sysctl_test.py +index 51e8f23..36d005f 100644 +--- a/tests/unit/modules/darwin_sysctl_test.py ++++ b/tests/unit/modules/darwin_sysctl_test.py +@@ -64,18 +64,6 @@ class DarwinSysctlTestCase(TestCase): + 'net.inet.icmp.icmplim', 50), ret) + + @patch('os.path.isfile', MagicMock(return_value=False)) +- def test_persist_no_conf_failure(self): +- ''' +- Tests adding of config file failure +- ''' +- with patch('salt.utils.fopen', mock_open()) as m_open: +- helper_open = m_open() +- helper_open.write.assertRaises(CommandExecutionError, +- darwin_sysctl.persist, +- 'net.inet.icmp.icmplim', +- 50, config=None) +- +- @patch('os.path.isfile', MagicMock(return_value=False)) + def test_persist_no_conf_success(self): + ''' + Tests successful add of config file when previously not one +diff --git a/tests/unit/modules/linux_sysctl_test.py b/tests/unit/modules/linux_sysctl_test.py +index 08fc80f..c6e40b8 100644 +--- a/tests/unit/modules/linux_sysctl_test.py ++++ b/tests/unit/modules/linux_sysctl_test.py +@@ -82,18 +82,6 @@ class LinuxSysctlTestCase(TestCase): + 'net.ipv4.ip_forward', 1), ret) + + @patch('os.path.isfile', MagicMock(return_value=False)) +- def test_persist_no_conf_failure(self): +- ''' +- Tests adding of config file failure +- ''' +- with patch('salt.utils.fopen', mock_open()) as m_open: +- helper_open = m_open() +- helper_open.write.assertRaises(CommandExecutionError, +- linux_sysctl.persist, +- 'net.ipv4.ip_forward', +- 1, config=None) +- +- @patch('os.path.isfile', MagicMock(return_value=False)) + def test_persist_no_conf_success(self): + ''' + Tests successful add of config file when previously not one diff --git a/app-admin/salt/files/salt-2015.5.7-tmpdir.patch b/app-admin/salt/files/salt-2015.5.7-tmpdir.patch new file mode 100644 index 000000000000..8a19c32e0f71 --- /dev/null +++ b/app-admin/salt/files/salt-2015.5.7-tmpdir.patch @@ -0,0 +1,37 @@ +diff --git a/tests/unit/modules/grains_test.py b/tests/unit/modules/grains_test.py +index 3473c03..ea37d66 100644 +--- a/tests/unit/modules/grains_test.py ++++ b/tests/unit/modules/grains_test.py +@@ -1,6 +1,8 @@ + # -*- coding: utf-8 -*- + + import copy ++import os.path ++import tempfile + + # Import Salt Testing libs + from salttesting import TestCase, skipIf +@@ -20,8 +22,8 @@ from salt.modules import grains as grainsmod + from salt.utils import dictupdate + + grainsmod.__opts__ = { +- 'conf_file': '/tmp/__salt_test_grains', +- 'cachedir': '/tmp/__salt_test_grains_cache_dir' ++ 'conf_file': os.path.join(tempfile.gettempdir(), '__salt_test_grains'), ++ 'cachedir': os.path.join(tempfile.gettempdir(), '__salt_test_grains_cache_dir') + } + + grainsmod.__salt__ = {} +diff --git a/tests/unit/states/archive_test.py b/tests/unit/states/archive_test.py +index 3cfb2f0..b3f3bee 100644 +--- a/tests/unit/states/archive_test.py ++++ b/tests/unit/states/archive_test.py +@@ -69,7 +69,7 @@ class ArchiveTest(TestCase): + 'cmd.run_all': mock_run}): + filename = os.path.join( + tmp_dir, +- 'files/test/_tmp_test_archive_.tar' ++ 'files/test/' + tempfile.gettempdir().replace('/', '_') + '_test_archive_.tar' + ) + for test_opts, ret_opts in zip(test_tar_opts, ret_tar_opts): + ret = archive.extracted(tmp_dir, diff --git a/app-admin/salt/files/salt-2015.8.0-remove-buggy-tests.patch b/app-admin/salt/files/salt-2015.8.0-remove-buggy-tests.patch new file mode 100644 index 000000000000..92ab0624e595 --- /dev/null +++ b/app-admin/salt/files/salt-2015.8.0-remove-buggy-tests.patch @@ -0,0 +1,56 @@ +diff --git a/tests/unit/modules/mount_test.py b/tests/unit/modules/mount_test.py +index 282539d..c88a7a8 100644 +--- a/tests/unit/modules/mount_test.py ++++ b/tests/unit/modules/mount_test.py +@@ -103,12 +103,6 @@ class MountTestCase(TestCase): + self.assertTrue(mount.rm_fstab('name', 'device')) + + mock = MagicMock(return_value={'name': 'name'}) +- with patch.object(mount, 'fstab', mock): +- with patch('salt.utils.fopen', mock_open()) as m_open: +- helper_open = m_open() +- helper_open.write.assertRaises(CommandExecutionError, +- mount.rm_fstab, +- config=None) + + def test_set_fstab(self): + ''' +@@ -143,12 +137,6 @@ class MountTestCase(TestCase): + self.assertTrue(mount.rm_automaster('name', 'device')) + + mock = MagicMock(return_value={'name': 'name'}) +- with patch.object(mount, 'fstab', mock): +- with patch('salt.utils.fopen', mock_open()) as m_open: +- helper_open = m_open() +- helper_open.write.assertRaises(CommandExecutionError, +- mount.rm_automaster, +- 'name', 'device') + + def test_set_automaster(self): + ''' +diff --git a/tests/unit/modules/puppet_test.py b/tests/unit/modules/puppet_test.py +index 6a43fd4..3be039c 100644 +--- a/tests/unit/modules/puppet_test.py ++++ b/tests/unit/modules/puppet_test.py +@@ -91,10 +91,6 @@ class PuppetTestCase(TestCase): + with patch('salt.utils.fopen', mock_open()): + self.assertTrue(puppet.disable()) + +- with patch('salt.utils.fopen', mock_open()) as m_open: +- helper_open = m_open() +- helper_open.write.assertRaises(CommandExecutionError, +- puppet.disable) + + def test_status(self): + ''' +@@ -154,10 +150,6 @@ class PuppetTestCase(TestCase): + mock_open(read_data="resources: 1")): + self.assertDictEqual(puppet.summary(), {'resources': 1}) + +- with patch('salt.utils.fopen', mock_open()) as m_open: +- helper_open = m_open() +- helper_open.write.assertRaises(CommandExecutionError, +- puppet.summary) + + def test_plugin_sync(self): + ''' diff --git a/app-admin/salt/files/salt-2015.8.10-remove-failing-boto-test.patch b/app-admin/salt/files/salt-2015.8.10-remove-failing-boto-test.patch new file mode 100644 index 000000000000..5a4d273d7848 --- /dev/null +++ b/app-admin/salt/files/salt-2015.8.10-remove-failing-boto-test.patch @@ -0,0 +1,35 @@ +diff --git a/tests/unit/modules/boto_secgroup_test.py b/tests/unit/modules/boto_secgroup_test.py +index f1c6bb1..07fd8ec 100644 +--- a/tests/unit/modules/boto_secgroup_test.py ++++ b/tests/unit/modules/boto_secgroup_test.py +@@ -192,30 +192,6 @@ class BotoSecgroupTestCase(TestCase): + **conn_parameters) + self.assertEqual(group_vpc.id, retrieved_group_id) + +- @mock_ec2 +- def test_get_config_single_rule_group_name(self): +- ''' +- tests return of 'config' when given group name. get_config returns an OrderedDict. +- ''' +- group_name = _random_group_name() +- ip_protocol = u'tcp' +- from_port = 22 +- to_port = 22 +- cidr_ip = u'0.0.0.0/0' +- rules_egress = [{'to_port': -1, 'from_port': -1, 'ip_protocol': u'-1', 'cidr_ip': u'0.0.0.0/0'}] +- +- conn = boto.ec2.connect_to_region(region, **boto_conn_parameters) +- group = conn.create_security_group(name=group_name, description=group_name) +- group.authorize(ip_protocol=ip_protocol, from_port=from_port, to_port=to_port, cidr_ip=cidr_ip) +- # setup the expected get_config result +- expected_get_config_result = OrderedDict([('name', group.name), ('group_id', group.id), ('owner_id', u'111122223333'), +- ('description', group.description), +- ('rules', [{'to_port': to_port, 'from_port': from_port, +- 'ip_protocol': ip_protocol, 'cidr_ip': cidr_ip}]), +- ('rules_egress', rules_egress)]) +- secgroup_get_config_result = boto_secgroup.get_config(group_id=group.id, **conn_parameters) +- self.assertEqual(expected_get_config_result, secgroup_get_config_result) +- + @skipIf(True, 'test skipped due to error in moto return - fixed in ' + 'https://github.com/spulec/moto/commit/cc0166964371f7b5247a49d45637a8f936ccbe6f') + @mock_ec2 diff --git a/app-admin/salt/files/salt-2015.8.13-failing-gateway-tests.patch b/app-admin/salt/files/salt-2015.8.13-failing-gateway-tests.patch new file mode 100644 index 000000000000..7d8512b14ef4 --- /dev/null +++ b/app-admin/salt/files/salt-2015.8.13-failing-gateway-tests.patch @@ -0,0 +1,69 @@ +diff --git a/tests/unit/states/boto_vpc_test.py b/tests/unit/states/boto_vpc_test.py +index 53b6a24e4d..96b5630627 100644 +--- a/tests/unit/states/boto_vpc_test.py ++++ b/tests/unit/states/boto_vpc_test.py +@@ -179,16 +179,6 @@ class BotoVpcResourceTestCaseMixin(BotoVpcTestCaseMixin): + self.assertTrue(exists) + + @mock_ec2 +- def test_present_when_resource_exists(self): +- vpc = self._create_vpc(name='test') +- resource = self._create_resource(vpc_id=vpc.id, name='test') +- with patch.dict('salt.utils.boto.__salt__', funcs): +- resource_present_result = salt_states['boto_vpc.{0}_present'.format(self.resource_type)]( +- name='test', vpc_name='test', **self.extra_kwargs) +- self.assertTrue(resource_present_result['result']) +- self.assertEqual(resource_present_result['changes'], {}) +- +- @mock_ec2 + @skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493') + def test_present_with_failure(self): + vpc = self._create_vpc(name='test') +@@ -210,18 +200,6 @@ class BotoVpcResourceTestCaseMixin(BotoVpcTestCaseMixin): + self.assertEqual(resource_absent_result['changes'], {}) + + @mock_ec2 +- def test_absent_when_resource_exists(self): +- vpc = self._create_vpc(name='test') +- self._create_resource(vpc_id=vpc.id, name='test') +- +- with patch.dict('salt.utils.boto.__salt__', funcs): +- resource_absent_result = salt_states['boto_vpc.{0}_absent'.format(self.resource_type)]('test') +- self.assertTrue(resource_absent_result['result']) +- self.assertEqual(resource_absent_result['changes']['new'][self.resource_type], None) +- exists = funcs['boto_vpc.resource_exists'](self.resource_type, 'test').get('exists') +- self.assertFalse(exists) +- +- @mock_ec2 + @skipIf(True, 'Disabled pending https://github.com/spulec/moto/issues/493') + def test_absent_with_failure(self): + vpc = self._create_vpc(name='test') +@@ -293,28 +271,3 @@ class BotoVpcRouteTableTestCase(BotoVpcStateTestCaseBase, BotoVpcResourceTestCas + + new_subnets = changes['new']['subnets_associations'] + self.assertEqual(new_subnets[0]['subnet_id'], subnet2.id) +- +- @mock_ec2 +- def test_present_with_routes(self): +- vpc = self._create_vpc(name='test') +- igw = self._create_internet_gateway(name='test', vpc_id=vpc.id) +- +- route_table_present_result = salt_states['boto_vpc.route_table_present']( +- name='test', vpc_name='test', routes=[{'destination_cidr_block': '0.0.0.0/0', +- 'gateway_id': igw.id}, +- {'destination_cidr_block': '10.0.0.0/24', +- 'gateway_id': 'local'}]) +- routes = [x['gateway_id'] for x in route_table_present_result['changes']['new']['routes']] +- +- self.assertEqual(set(routes), set(['local', igw.id])) +- +- route_table_present_result = salt_states['boto_vpc.route_table_present']( +- name='test', vpc_name='test', routes=[{'destination_cidr_block': '10.0.0.0/24', +- 'gateway_id': 'local'}]) +- +- changes = route_table_present_result['changes'] +- +- old_routes = [x['gateway_id'] for x in changes['old']['routes']] +- self.assertEqual(set(routes), set(old_routes)) +- +- self.assertEqual(changes['new']['routes'][0]['gateway_id'], 'local') diff --git a/app-admin/salt/files/salt-2015.8.13-sanitize-minion-name.patch b/app-admin/salt/files/salt-2015.8.13-sanitize-minion-name.patch new file mode 100644 index 000000000000..df9e0f66d005 --- /dev/null +++ b/app-admin/salt/files/salt-2015.8.13-sanitize-minion-name.patch @@ -0,0 +1,36 @@ +From aa87d67258a5b6742fc53d06c7bdac0f643bc9f1 Mon Sep 17 00:00:00 2001 +From: Ch3LL <megan.wilhite@gmail.com> +Date: Tue, 1 Aug 2017 13:44:32 -0400 +Subject: [PATCH] Add clean_id function to salt.utils.verify.py + +--- + salt/utils/verify.py | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/salt/utils/verify.py b/salt/utils/verify.py +index 5cac0fa651b..a3dc67db336 100644 +--- a/salt/utils/verify.py ++++ b/salt/utils/verify.py +@@ -484,12 +484,21 @@ def clean_path(root, path, subdir=False): + return '' + + ++def clean_id(id_): ++ ''' ++ Returns if the passed id is clean. ++ ''' ++ if re.search(r'\.\.{sep}'.format(sep=os.sep), id_): ++ return False ++ return True ++ ++ + def valid_id(opts, id_): + ''' + Returns if the passed id is valid + ''' + try: +- return bool(clean_path(opts['pki_dir'], id_)) ++ return bool(clean_path(opts['pki_dir'], id_)) and clean_id(id_) + except (AttributeError, KeyError) as e: + return False + diff --git a/app-admin/salt/files/salt-2015.8.2-tmpdir.patch b/app-admin/salt/files/salt-2015.8.2-tmpdir.patch new file mode 100644 index 000000000000..871551e0e508 --- /dev/null +++ b/app-admin/salt/files/salt-2015.8.2-tmpdir.patch @@ -0,0 +1,56 @@ +diff --git a/tests/unit/modules/qemu_nbd_test.py b/tests/unit/modules/qemu_nbd_test.py +index 615e6b5..fbd24aa 100644 +--- a/tests/unit/modules/qemu_nbd_test.py ++++ b/tests/unit/modules/qemu_nbd_test.py +@@ -77,6 +77,7 @@ class QemuNbdTestCase(TestCase): + Test if it mount the named image via qemu-nbd + and return the mounted roots + ''' ++ tmpdir = os.environ.get('TMPDIR', '/tmp') + mock = MagicMock(return_value=True) + with patch.dict(qemu_nbd.__salt__, {'cmd.run': mock}): + self.assertEqual(qemu_nbd.init('/srv/image.qcow2'), '') +@@ -89,7 +90,7 @@ class QemuNbdTestCase(TestCase): + 'mount.mount': mock, + 'cmd.retcode': MagicMock(side_effect=[1, 0])}): + self.assertDictEqual(qemu_nbd.init('/srv/image.qcow2'), +- {'/tmp/nbd/nbd0/nbd0': '/dev/nbd0'}) ++ {os.path.join(tmpdir, 'nbd/nbd0/nbd0'): '/dev/nbd0'}) + + # 'clear' function tests: 1 + +diff --git a/tests/unit/states/archive_test.py b/tests/unit/states/archive_test.py +index 63e4a53..20b196f 100644 +--- a/tests/unit/states/archive_test.py ++++ b/tests/unit/states/archive_test.py +@@ -26,7 +26,7 @@ from salt.ext.six.moves import zip # pylint: disable=import-error,redefined-bui + + # Globals + archive.__salt__ = {} +-archive.__opts__ = {"cachedir": "/tmp", "test": False} ++archive.__opts__ = {"cachedir": os.environ.get('TMPDIR', "/tmp"), "test": False} + archive.__env__ = 'test' + + +@@ -75,7 +75,7 @@ class ArchiveTestCase(TestCase): + 'cmd.run_all': mock_run}): + filename = os.path.join( + tmp_dir, +- 'files/test/_tmp_test_archive_.tar' ++ 'files/test/' + tempfile.gettempdir().replace('/', '_') + '_test_archive_.tar' + ) + for test_opts, ret_opts in zip(test_tar_opts, ret_tar_opts): + ret = archive.extracted(tmp_dir, +diff --git a/tests/unit/utils/context_test.py b/tests/unit/utils/context_test.py +index 71e4330..d6f3f30 100644 +--- a/tests/unit/utils/context_test.py ++++ b/tests/unit/utils/context_test.py +@@ -18,7 +18,7 @@ import salt.payload + import salt.utils + + __context__ = {'a': 'b'} +-__opts__ = {'cachedir': '/tmp'} ++__opts__ = {'cachedir': os.environ.get('TMPDIR', '/tmp')} + + + @skipIf(NO_MOCK, NO_MOCK_REASON) diff --git a/app-admin/salt/files/salt-2016.11.0-broken-tests.patch b/app-admin/salt/files/salt-2016.11.0-broken-tests.patch new file mode 100644 index 000000000000..5bb7a8e4c46b --- /dev/null +++ b/app-admin/salt/files/salt-2016.11.0-broken-tests.patch @@ -0,0 +1,23 @@ +diff --git a/tests/unit/utils/extend_test.py b/tests/unit/utils/extend_test.py +index f63a4896f7..54bf443d9a 100644 +--- a/tests/unit/utils/extend_test.py ++++ b/tests/unit/utils/extend_test.py +@@ -38,18 +38,6 @@ class ExtendTestCase(TestCase): + shutil.rmtree(self.out, True) + os.chdir(self.starting_dir) + +- @patch('sys.exit', MagicMock) +- def test_run(self): +- out = salt.utils.extend.run('test', 'test', 'this description', integration.CODE_DIR, False) +- self.out = out +- year = date.today().strftime('%Y') +- self.assertTrue(os.path.exists(out)) +- self.assertFalse(os.path.exists(os.path.join(out, 'template.yml'))) +- self.assertTrue(os.path.exists(os.path.join(out, 'directory'))) +- self.assertTrue(os.path.exists(os.path.join(out, 'directory', 'test.py'))) +- with salt.utils.fopen(os.path.join(out, 'directory', 'test.py'), 'r') as test_f: +- self.assertEqual(test_f.read(), year) +- + if __name__ == '__main__': + from unit import run_tests + run_tests(ExtendTestCase, needs_daemon=False) diff --git a/app-admin/salt/files/salt-2016.11.0-remove-file-tree-test.patch b/app-admin/salt/files/salt-2016.11.0-remove-file-tree-test.patch new file mode 100644 index 000000000000..47d3257df671 --- /dev/null +++ b/app-admin/salt/files/salt-2016.11.0-remove-file-tree-test.patch @@ -0,0 +1,34 @@ +diff --git a/tests/unit/modules/inspect_collector_test.py b/tests/unit/modules/inspect_collector_test.py +index 9105670526..e077bc3f44 100644 +--- a/tests/unit/modules/inspect_collector_test.py ++++ b/tests/unit/modules/inspect_collector_test.py +@@ -52,29 +52,6 @@ class InspectorCollectorTestCase(TestCase): + self.assertEqual(inspector.pidfile, '/foo/pid/bar.pid') + + @patch("os.mkdir", MagicMock()) +- def test_file_tree(self): +- ''' +- Test file tree. +- +- :return: +- ''' +- +- inspector = Inspector(cachedir='/test', piddir='/test', pidfilename='bar.pid') +- tree_root = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'inspectlib', 'tree_test') +- expected_tree = (['/a/a/dummy.a', '/a/b/dummy.b', '/b/b.1', '/b/b.2', '/b/b.3'], +- ['/a', '/a/a', '/a/b', '/a/c', '/b', '/c'], +- ['/a/a/dummy.ln.a', '/a/b/dummy.ln.b', '/a/c/b.1', '/b/b.4', +- '/b/b.5', '/c/b.1', '/c/b.2', '/c/b.3']) +- tree_result = [] +- for chunk in inspector._get_all_files(tree_root): +- buff = [] +- for pth in chunk: +- buff.append(pth.replace(tree_root, '')) +- tree_result.append(buff) +- tree_result = tuple(tree_result) +- self.assertEqual(expected_tree, tree_result) +- +- @patch("os.mkdir", MagicMock()) + def test_get_unmanaged_files(self): + ''' + Test get_unmanaged_files. diff --git a/app-admin/salt/files/salt-2016.11.0-tmpdir.patch b/app-admin/salt/files/salt-2016.11.0-tmpdir.patch new file mode 100644 index 000000000000..1cccb158aff0 --- /dev/null +++ b/app-admin/salt/files/salt-2016.11.0-tmpdir.patch @@ -0,0 +1,34 @@ +diff --git a/tests/unit/modules/qemu_nbd_test.py b/tests/unit/modules/qemu_nbd_test.py +index 615e6b5670..fbd24aab86 100644 +--- a/tests/unit/modules/qemu_nbd_test.py ++++ b/tests/unit/modules/qemu_nbd_test.py +@@ -77,6 +77,7 @@ class QemuNbdTestCase(TestCase): + Test if it mount the named image via qemu-nbd + and return the mounted roots + ''' ++ tmpdir = os.environ.get('TMPDIR', '/tmp') + mock = MagicMock(return_value=True) + with patch.dict(qemu_nbd.__salt__, {'cmd.run': mock}): + self.assertEqual(qemu_nbd.init('/srv/image.qcow2'), '') +@@ -89,7 +90,7 @@ class QemuNbdTestCase(TestCase): + 'mount.mount': mock, + 'cmd.retcode': MagicMock(side_effect=[1, 0])}): + self.assertDictEqual(qemu_nbd.init('/srv/image.qcow2'), +- {'/tmp/nbd/nbd0/nbd0': '/dev/nbd0'}) ++ {os.path.join(tmpdir, 'nbd/nbd0/nbd0'): '/dev/nbd0'}) + + # 'clear' function tests: 1 + +diff --git a/tests/unit/utils/context_test.py b/tests/unit/utils/context_test.py +index 5249d56747..a27ee9ab61 100644 +--- a/tests/unit/utils/context_test.py ++++ b/tests/unit/utils/context_test.py +@@ -18,7 +18,7 @@ import salt.payload + import salt.utils + + __context__ = {'a': 'b'} +-__opts__ = {'cachedir': '/tmp'} ++__opts__ = {'cachedir': os.environ.get('TMPDIR', '/tmp')} + + + @skipIf(NO_MOCK, NO_MOCK_REASON) diff --git a/app-admin/salt/files/salt-2016.3.1-dont-realpath-tmpdir.patch b/app-admin/salt/files/salt-2016.3.1-dont-realpath-tmpdir.patch new file mode 100644 index 000000000000..3e4fa31c9042 --- /dev/null +++ b/app-admin/salt/files/salt-2016.3.1-dont-realpath-tmpdir.patch @@ -0,0 +1,18 @@ +diff --git a/tests/integration/__init__.py b/tests/integration/__init__.py +index fc13bb6..6316fb5 100644 +--- a/tests/integration/__init__.py ++++ b/tests/integration/__init__.py +@@ -77,12 +77,7 @@ if salt.utils.is_windows(): + import win32api + + +-SYS_TMP_DIR = os.path.realpath( +- # Avoid ${TMPDIR} and gettempdir() on MacOS as they yield a base path too long +- # for unix sockets: ``error: AF_UNIX path too long`` +- # Gentoo Portage prefers ebuild tests are rooted in ${TMPDIR} +- os.environ.get('TMPDIR', tempfile.gettempdir()) if not salt.utils.is_darwin() else '/tmp' +-) ++SYS_TMP_DIR = os.environ.get('TMPDIR', tempfile.gettempdir()) if not salt.utils.is_darwin() else '/tmp' + TMP = os.path.join(SYS_TMP_DIR, 'salt-tests-tmpdir') + FILES = os.path.join(INTEGRATION_TEST_DIR, 'files') + PYEXEC = 'python{0}.{1}'.format(*sys.version_info) diff --git a/app-admin/salt/files/salt-2016.3.4-dont-test-ordering.patch b/app-admin/salt/files/salt-2016.3.4-dont-test-ordering.patch new file mode 100644 index 000000000000..c27227571ad2 --- /dev/null +++ b/app-admin/salt/files/salt-2016.3.4-dont-test-ordering.patch @@ -0,0 +1,33 @@ +diff --git a/tests/unit/modules/inspect_collector_test.py b/tests/unit/modules/inspect_collector_test.py +index 9d2fa3ada7..710bbd75a5 100644 +--- a/tests/unit/modules/inspect_collector_test.py ++++ b/tests/unit/modules/inspect_collector_test.py +@@ -36,28 +36,6 @@ class InspectorCollectorTestCase(TestCase): + self.assertEqual(inspector.dbfile, '/foo/cache/_minion_collector.db') + self.assertEqual(inspector.pidfile, '/foo/pid/bar.pid') + +- def test_file_tree(self): +- ''' +- Test file tree. +- +- :return: +- ''' +- +- inspector = Inspector(cachedir='/test', piddir='/test', pidfilename='bar.pid') +- tree_root = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'inspectlib', 'tree_test') +- expected_tree = (['/a/a/dummy.a', '/a/b/dummy.b', '/b/b.1', '/b/b.2', '/b/b.3'], +- ['/a', '/a/a', '/a/b', '/a/c', '/b', '/c'], +- ['/a/a/dummy.ln.a', '/a/b/dummy.ln.b', '/a/c/b.1', '/b/b.4', +- '/b/b.5', '/c/b.1', '/c/b.2', '/c/b.3']) +- tree_result = [] +- for chunk in inspector._get_all_files(tree_root): +- buff = [] +- for pth in chunk: +- buff.append(pth.replace(tree_root, '')) +- tree_result.append(buff) +- tree_result = tuple(tree_result) +- self.assertEqual(expected_tree, tree_result) +- + def test_get_unmanaged_files(self): + ''' + Test get_unmanaged_files. diff --git a/app-admin/salt/files/salt-2016.3.4-test-nonexist-dirs.patch b/app-admin/salt/files/salt-2016.3.4-test-nonexist-dirs.patch new file mode 100644 index 000000000000..dd542d630adf --- /dev/null +++ b/app-admin/salt/files/salt-2016.3.4-test-nonexist-dirs.patch @@ -0,0 +1,32 @@ +diff --git a/tests/unit/conf_test.py b/tests/unit/conf_test.py +index cce0023423..c1324f4a61 100644 +--- a/tests/unit/conf_test.py ++++ b/tests/unit/conf_test.py +@@ -140,6 +140,8 @@ class ConfTest(TestCase): + commented out. This test loops through all of the files in that directory to check + for any lines that are not commented or blank. + ''' ++ if not os.path.exists(SAMPLE_CONF_DIR + 'cloud.profiles.d/'): ++ return + cloud_sample_files = os.listdir(SAMPLE_CONF_DIR + 'cloud.profiles.d/') + for conf_file in cloud_sample_files: + profile_conf = SAMPLE_CONF_DIR + 'cloud.profiles.d/' + conf_file +@@ -158,6 +160,8 @@ class ConfTest(TestCase): + commented out. This test loops through all of the files in that directory to check + for any lines that are not commented or blank. + ''' ++ if not os.path.exists(SAMPLE_CONF_DIR + 'cloud.providers.d/'): ++ return + cloud_sample_files = os.listdir(SAMPLE_CONF_DIR + 'cloud.providers.d/') + for conf_file in cloud_sample_files: + provider_conf = SAMPLE_CONF_DIR + 'cloud.providers.d/' + conf_file +@@ -176,6 +180,9 @@ class ConfTest(TestCase): + commented out. This test loops through all of the files in that directory to check + for any lines that are not commented or blank. + ''' ++ if not os.path.exists(SAMPLE_CONF_DIR + 'cloud.maps.d/'): ++ return ++ + cloud_sample_files = os.listdir(SAMPLE_CONF_DIR + 'cloud.maps.d/') + for conf_file in cloud_sample_files: + map_conf = SAMPLE_CONF_DIR + 'cloud.maps.d/' + conf_file diff --git a/app-admin/salt/files/salt-2016.3.5-tmpdir.patch b/app-admin/salt/files/salt-2016.3.5-tmpdir.patch new file mode 100644 index 000000000000..dce4f09f2a0f --- /dev/null +++ b/app-admin/salt/files/salt-2016.3.5-tmpdir.patch @@ -0,0 +1,47 @@ +diff --git a/tests/unit/modules/qemu_nbd_test.py b/tests/unit/modules/qemu_nbd_test.py +index 615e6b5670..fbd24aab86 100644 +--- a/tests/unit/modules/qemu_nbd_test.py ++++ b/tests/unit/modules/qemu_nbd_test.py +@@ -77,6 +77,7 @@ class QemuNbdTestCase(TestCase): + Test if it mount the named image via qemu-nbd + and return the mounted roots + ''' ++ tmpdir = os.environ.get('TMPDIR', '/tmp') + mock = MagicMock(return_value=True) + with patch.dict(qemu_nbd.__salt__, {'cmd.run': mock}): + self.assertEqual(qemu_nbd.init('/srv/image.qcow2'), '') +@@ -89,7 +90,7 @@ class QemuNbdTestCase(TestCase): + 'mount.mount': mock, + 'cmd.retcode': MagicMock(side_effect=[1, 0])}): + self.assertDictEqual(qemu_nbd.init('/srv/image.qcow2'), +- {'/tmp/nbd/nbd0/nbd0': '/dev/nbd0'}) ++ {os.path.join(tmpdir, 'nbd/nbd0/nbd0'): '/dev/nbd0'}) + + # 'clear' function tests: 1 + +diff --git a/tests/unit/states/archive_test.py b/tests/unit/states/archive_test.py +index e699362d8a..c7c7e8a965 100644 +--- a/tests/unit/states/archive_test.py ++++ b/tests/unit/states/archive_test.py +@@ -25,7 +25,7 @@ from salt.ext.six.moves import zip # pylint: disable=import-error,redefined-bui + + # Globals + archive.__salt__ = {} +-archive.__opts__ = {"cachedir": "/tmp", "test": False} ++archive.__opts__ = {"cachedir": os.environ.get('TMPDIR', "/tmp"), "test": False} + archive.__env__ = 'test' + + +diff --git a/tests/unit/utils/context_test.py b/tests/unit/utils/context_test.py +index 5249d56747..a27ee9ab61 100644 +--- a/tests/unit/utils/context_test.py ++++ b/tests/unit/utils/context_test.py +@@ -18,7 +18,7 @@ import salt.payload + import salt.utils + + __context__ = {'a': 'b'} +-__opts__ = {'cachedir': '/tmp'} ++__opts__ = {'cachedir': os.environ.get('TMPDIR', '/tmp')} + + + @skipIf(NO_MOCK, NO_MOCK_REASON) diff --git a/app-admin/salt/files/salt-2017.7.0-dont-realpath-tmpdir.patch b/app-admin/salt/files/salt-2017.7.0-dont-realpath-tmpdir.patch new file mode 100644 index 000000000000..90a48a662998 --- /dev/null +++ b/app-admin/salt/files/salt-2017.7.0-dont-realpath-tmpdir.patch @@ -0,0 +1,19 @@ +diff --git a/tests/support/paths.py b/tests/support/paths.py +index da93c8e1e3..895c636fef 100644 +--- a/tests/support/paths.py ++++ b/tests/support/paths.py +@@ -40,12 +40,12 @@ if CODE_DIR not in sys.path: + if TESTS_DIR not in sys.path: + sys.path.insert(1, TESTS_DIR) + +-SYS_TMP_DIR = os.path.abspath(os.path.realpath( ++SYS_TMP_DIR = os.path.abspath( + # Avoid ${TMPDIR} and gettempdir() on MacOS as they yield a base path too long + # for unix sockets: ``error: AF_UNIX path too long`` + # Gentoo Portage prefers ebuild tests are rooted in ${TMPDIR} + os.environ.get('TMPDIR', tempfile.gettempdir()) if not sys.platform.startswith('darwin') else '/tmp' +-)) ++) + TMP = os.path.join(SYS_TMP_DIR, 'salt-tests-tmpdir') + FILES = os.path.join(INTEGRATION_TEST_DIR, 'files') + PYEXEC = 'python{0}.{1}'.format(*sys.version_info) diff --git a/app-admin/salt/files/salt-api.service b/app-admin/salt/files/salt-api.service new file mode 100644 index 000000000000..fd9f665fff09 --- /dev/null +++ b/app-admin/salt/files/salt-api.service @@ -0,0 +1,10 @@ +[Unit] +Description=The Salt Master Server +After=syslog.target network.target + +[Service] +Type=simple +ExecStart=/usr/bin/salt-api + +[Install] +WantedBy=multi-user.target diff --git a/app-admin/salt/files/salt-master.service b/app-admin/salt/files/salt-master.service new file mode 100644 index 000000000000..4f3827ede6df --- /dev/null +++ b/app-admin/salt/files/salt-master.service @@ -0,0 +1,10 @@ +[Unit] +Description=The Salt Master Server +After=syslog.target network.target + +[Service] +Type=simple +ExecStart=/usr/bin/salt-master + +[Install] +WantedBy=multi-user.target diff --git a/app-admin/salt/files/salt-minion.service b/app-admin/salt/files/salt-minion.service new file mode 100644 index 000000000000..2f199f998eca --- /dev/null +++ b/app-admin/salt/files/salt-minion.service @@ -0,0 +1,10 @@ +[Unit] +Description=The Salt Minion +After=syslog.target network.target + +[Service] +Type=simple +ExecStart=/usr/bin/salt-minion + +[Install] +WantedBy=multi-user.target diff --git a/app-admin/salt/files/salt-syndic.service b/app-admin/salt/files/salt-syndic.service new file mode 100644 index 000000000000..922eef35af8b --- /dev/null +++ b/app-admin/salt/files/salt-syndic.service @@ -0,0 +1,10 @@ +[Unit] +Description=The Salt Master Server +After=syslog.target network.target + +[Service] +Type=simple +ExecStart=/usr/bin/salt-syndic + +[Install] +WantedBy=multi-user.target diff --git a/app-admin/salt/files/syndic-confd-1 b/app-admin/salt/files/syndic-confd-1 new file mode 100644 index 000000000000..d69d83fcd60d --- /dev/null +++ b/app-admin/salt/files/syndic-confd-1 @@ -0,0 +1,5 @@ +# /etc/conf.d/salt-minion: config file for /etc/init.d/salt-minion + +# see man pages for salt-minion or run `salt-minion --help` +# for valid cmdline options +SALT_OPTS="--log-level=warning" diff --git a/app-admin/salt/files/syndic-initd-4 b/app-admin/salt/files/syndic-initd-4 new file mode 100644 index 000000000000..8908f2cfa850 --- /dev/null +++ b/app-admin/salt/files/syndic-initd-4 @@ -0,0 +1,14 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +command="/usr/bin/salt-syndic" +command_args="${SALT_OPTS}" +command_background="1" +pidfile="/var/run/salt-syndic.pid" +name="SALT syndic daemon" +retry="20" + +depend() { + use net logger +} |