|
2 | 2 | from __future__ import absolute_import, unicode_literals, print_function |
3 | 3 |
|
4 | 4 | # Import python libraries |
| 5 | +import distutils.spawn |
5 | 6 | import logging |
6 | 7 | import os.path |
7 | 8 | import shutil |
|
10 | 11 | import textwrap |
11 | 12 |
|
12 | 13 | # Import Salt Libraries |
| 14 | +import salt.client |
| 15 | +import salt.config |
13 | 16 | import salt.utils.yaml as yaml |
14 | 17 |
|
15 | 18 | # Import pytest libraries |
|
26 | 29 | log = logging.getLogger(__name__) |
27 | 30 |
|
28 | 31 |
|
| 32 | +@pytest.fixture(scope='session') |
| 33 | +def install_sshd_server(): |
| 34 | + if distutils.spawn.find_executable('sshd'): |
| 35 | + return |
| 36 | + __opts__ = salt.config.minion_config('tests/minion.conf') |
| 37 | + __opts__['file_client'] = 'local' |
| 38 | + caller = salt.client.Caller(mopts=__opts__) |
| 39 | + caller.cmd('pkg.install', 'openssh-server') |
| 40 | + |
| 41 | + |
29 | 42 | class SaltApi(SaltDaemonScriptBase): |
30 | 43 | ''' |
31 | 44 | Class which runs the salt-api daemon |
@@ -76,7 +89,6 @@ def pepperconfig(salt_api_port): |
76 | 89 | SALTAPI_EAUTH=sharedsecret |
77 | 90 | [noopts] |
78 | 91 | SALTAPI_URL=http://localhost:{0}/ |
79 | | - SALTAPI_EAUTH=kerberos |
80 | 92 | '''.format(salt_api_port)) |
81 | 93 | with open('tests/.pepperrc', 'w') as pepper_file: |
82 | 94 | print(config, file=pepper_file) |
@@ -109,7 +121,7 @@ def output_file(): |
109 | 121 |
|
110 | 122 |
|
111 | 123 | @pytest.fixture(params=['/run', '/login']) |
112 | | -def pepper_cli(request, session_salt_api, salt_api_port, output_file, session_sshd_server): |
| 124 | +def pepper_cli(request, session_salt_api, salt_api_port, output_file, install_sshd_server, session_sshd_server): |
113 | 125 | ''' |
114 | 126 | Wrapper to invoke Pepper with common params and inside an empty env |
115 | 127 | ''' |
|
0 commit comments