Skip to content

Commit bbe3f97

Browse files
authored
Merge branch 'saltstack:develop' into tgt_type
2 parents f4390b7 + 8096e08 commit bbe3f97

10 files changed

Lines changed: 116 additions & 56 deletions

File tree

.travis.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
1+
dist: xenial
12
sudo: false
23
services:
34
- docker
45
language: python
5-
cache: pip
66
services:
77
- docker
88

9-
before_install:
10-
- pyenv versions
11-
- pyenv version-name
12-
- env
13-
149
install:
1510
- pip install tox
1611

@@ -19,21 +14,28 @@ python:
1914
- '3.4'
2015
- '3.5'
2116
- '3.6'
22-
- '3.7-dev'
17+
- '3.7'
18+
- '3.8-dev'
2319

2420
env:
25-
- SALT=-v2018.3 BACKEND=-cherrypy CODECOV=py
26-
- SALT=-v2018.3 BACKEND=-tornado CODECOV=py
27-
- SALT=-v2019.2 BACKEND=-cherrypy CODECOV=py
28-
- SALT=-v2019.2 BACKEND=-tornado CODECOV=py
21+
- SALT=v2018.3 BACKEND=cherrypy
22+
- SALT=v2018.3 BACKEND=tornado
23+
- SALT=v2019.2 BACKEND=cherrypy
24+
- SALT=v2019.2 BACKEND=tornado
25+
- SALT=develop BACKEND=cherrypy
26+
- SALT=develop BACKEND=tornado
2927

3028
matrix:
31-
env:
29+
allow_failures:
30+
- python: '3.8-dev'
31+
- env: SALT=develop BACKEND=tornado
32+
- env: SALT=develop BACKEND=cherrypy
3233

3334
script:
34-
- PYTHON="${TRAVIS_PYTHON_VERSION%-dev}"
35-
- docker run -v $PWD:/pepper -ti --rm gtmanfred/pepper:latest tox -c /pepper/tox.ini -e "${TRAVIS_PYTHON_VERSION%%.*}flake8,${CODECOV}${PYTHON//./}${BACKEND}${SALT}"
35+
- PYTHON="${TRAVIS_PYTHON_VERSION/-dev/-rc}"
36+
- TOX_VERSION="py${PYTHON//./}"
37+
- docker run -v $PWD:/pepper -ti --rm "python:$PYTHON" make -C /pepper test PYVERSION="${TOX_VERSION%-rc}" SALT="${SALT}" BACKEND="${BACKEND}"
3638

3739
after_success:
3840
- sudo chown $USER .tox/
39-
- if [[ $CODECOV == "py" ]]; then tox -e codecov; fi
41+
- tox -e codecov

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
PYVERSION?=py37
2+
SALT?=v2019.2
3+
BACKEND?=cherrypy
4+
DEBIAN_FRONTEND=noninteractive
5+
6+
install:
7+
apt update && apt install -y libc6-dev libffi-dev gcc git openssh-server libzmq3-dev
8+
pip install tox
9+
10+
test: install
11+
tox -e flake8,$(PYVERSION)-$(BACKEND)-$(SALT)

azure-pipelines.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
trigger:
2+
- develop
3+
4+
variables:
5+
python: '["py2.7", "py3.4", "py3.5", "py3.6", "py3.7", "py3.8"]'
6+
salt: '["v2018.3", "v2019.2", "develop"]'
7+
backends: '["cherrypy", "tornado"]'
8+
9+
jobs:
10+
- job: build_matrix
11+
pool:
12+
vmImage: 'Ubuntu-16.04'
13+
steps:
14+
- task: UsePythonVersion@0
15+
inputs:
16+
versionSpec: '3.7'
17+
architecture: x64
18+
19+
- task: PythonScript@0
20+
name: matrix
21+
inputs:
22+
scriptSource: Inline
23+
script: |
24+
import json
25+
matrix = {}
26+
for pyver in $(python):
27+
for saltver in $(salt):
28+
for backend in $(backends):
29+
matrix['{0}-{1}-{2}'.format(pyver, backend, saltver)] = {
30+
'python.version': pyver[2:],
31+
'version': pyver.replace('.', ''),
32+
'salt': saltver,
33+
'backend': backend,
34+
}
35+
print('##vso[task.setvariable variable=matrix;isOutput=true]{0}'.format(json.dumps(matrix)))
36+
37+
- job: test_pepper
38+
dependsOn: build_matrix
39+
pool:
40+
vmImage: 'Ubuntu-16.04'
41+
strategy:
42+
matrix: $[ dependencies.build_matrix.outputs['matrix.matrix'] ]
43+
steps:
44+
- task: UsePythonVersion@0
45+
inputs:
46+
versionSpec: '$(python.version)'
47+
architecture: x64
48+
49+
- script: |
50+
pip install tox
51+
displayName: Install dependencies
52+
- script: |
53+
docker run -v $PWD:/pepper --rm "python:$(python.version)" make -C /pepper test PYTHON_VERSION=$(version) SALT=$(salt) BACKEND=$(backend)
54+
displayName: pytest
55+
- script: |
56+
sudo chown $USER .tox/
57+
tox -e codecov
58+
displayName: codecov
59+
env:
60+
CODECOV_TOKEN: '16c2a232-4329-438c-b163-ccbfeeab47aa'

pepper/cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,9 @@ def get_login_details(self):
411411
else:
412412
if self.options.username is not None:
413413
results['SALTAPI_USER'] = self.options.username
414-
if self.options.password is None and results['SALTAPI_PASS'] is None:
414+
if self.options.password is None and \
415+
results['SALTAPI_PASS'] is None and \
416+
results['SALTAPI_EAUTH'] != 'kerberos':
415417
if self.options.interactive:
416418
results['SALTAPI_PASS'] = getpass.getpass(prompt='Password: ')
417419
else:

pepper/libpepper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,8 +267,8 @@ def req_requests(self, path, data=None):
267267
268268
'''
269269
import requests
270-
from requests_kerberos import HTTPKerberosAuth, OPTIONAL
271-
auth = HTTPKerberosAuth(mutual_authentication=OPTIONAL)
270+
from requests_gssapi import HTTPSPNEGOAuth, OPTIONAL
271+
auth = HTTPSPNEGOAuth(mutual_authentication=OPTIONAL)
272272
headers = {
273273
'Accept': 'application/json',
274274
'Content-Type': 'application/json',

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
'packages': [
3939
'pepper',
4040
],
41+
'extras_require': {
42+
'kerberos': ["requests-gssapi>=1.1.0"],
43+
},
4144
'scripts': [
4245
'scripts/pepper',
4346
]

tests/Dockerfile

Lines changed: 0 additions & 19 deletions
This file was deleted.

tests/conftest.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from __future__ import absolute_import, unicode_literals, print_function
33

44
# Import python libraries
5+
import distutils.spawn
56
import logging
67
import os.path
78
import shutil
@@ -10,6 +11,8 @@
1011
import textwrap
1112

1213
# Import Salt Libraries
14+
import salt.client
15+
import salt.config
1316
import salt.utils.yaml as yaml
1417

1518
# Import pytest libraries
@@ -26,6 +29,16 @@
2629
log = logging.getLogger(__name__)
2730

2831

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+
2942
class SaltApi(SaltDaemonScriptBase):
3043
'''
3144
Class which runs the salt-api daemon
@@ -76,7 +89,6 @@ def pepperconfig(salt_api_port):
7689
SALTAPI_EAUTH=sharedsecret
7790
[noopts]
7891
SALTAPI_URL=http://localhost:{0}/
79-
SALTAPI_EAUTH=kerberos
8092
'''.format(salt_api_port))
8193
with open('tests/.pepperrc', 'w') as pepper_file:
8294
print(config, file=pepper_file)
@@ -109,7 +121,7 @@ def output_file():
109121

110122

111123
@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):
113125
'''
114126
Wrapper to invoke Pepper with common params and inside an empty env
115127
'''

tests/integration/test_clients.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ def test_runner_client(pepper_cli):
3535
)
3636
def test_wheel_client_arg(pepper_cli, session_minion_id):
3737
ret = pepper_cli('--client=wheel', 'minions.connected')
38-
# note - this seems not to work in returning session_minion_id with current runner, returning []
39-
# the test originally was asserting the success atr but that isn't returned anymore
40-
# further debugging needed with pytest-salt
41-
assert ret == []
38+
assert ret == ['pytest-session-salt-minion-0']
4239

4340

4441
@pytest.mark.xfail(

tox.ini

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{27,34,35,36}-{cherrypy,tornado}-{v2018.3,v2019.2},coverage,flake8
2+
envlist = py{27,34,35,36,37,38}-{cherrypy,tornado}-{v2018.3,v2019.2,develop},coverage,flake8
33
skip_missing_interpreters = true
44
skipsdist = false
55

@@ -13,18 +13,10 @@ deps = -r{toxinidir}/tests/requirements.txt
1313
changedir = {toxinidir}
1414
setenv = COVERAGE_FILE = {toxworkdir}/.coverage.{envname}
1515
commands =
16-
cherrypy: pytest --cov=pepper/ --cov-config=tox.ini --cov-report= {posargs} --salt-api-backend=rest_cherrypy
17-
tornado: pytest --cov=pepper/ --cov-config=tox.ini --cov-report= {posargs} --salt-api-backend=rest_tornado
16+
cherrypy: pytest -v --cov=pepper/ --cov-config=tox.ini --cov-report= {posargs} --salt-api-backend=rest_cherrypy
17+
tornado: pytest -v --cov=pepper/ --cov-config=tox.ini --cov-report= {posargs} --salt-api-backend=rest_tornado
1818

19-
[testenv:2flake8]
20-
basepython = python2
21-
deps =
22-
-r {toxinidir}/tests/requirements.txt
23-
flake8
24-
commands = flake8 tests/ pepper/ scripts/pepper setup.py
25-
26-
[testenv:3flake8]
27-
basepython = python3
19+
[testenv:flake8]
2820
deps =
2921
-r {toxinidir}/tests/requirements.txt
3022
flake8
@@ -57,7 +49,7 @@ changedir = {toxinidir}/htmlcov
5749
commands = python -m http.server
5850

5951
[pytest]
60-
addopts = --showlocals --log-file /tmp/pepper-runtests.log --no-print-logs -ra -sv
52+
addopts = --showlocals --log-file /tmp/pepper-runtests.log --no-print-logs -ra
6153
testpaths = tests
6254
norecursedirs = .git .tox
6355
usefixtures = pepperconfig

0 commit comments

Comments
 (0)