Repository navigation
Description
Description of Issue/Question
I am using svn.latest to checkout our repository using https with self-signed certificate. It does work for initial checkout, and for later updates, BUT it shows error when running sate.highstate test=True. This error is bogus.
Setup
salt 2015.8.10
Debian Wheezy amd64
Steps to Reproduce Issue
Temporarily move /etc/ssl/certs into /etc/ssl/certs.backup to make any target host untrusted for testing purposes.
Test case:
svn:
pkg.installed:
- name: subversion
svn_my_repo:
svn.latest:
- name: https://svn.apache.org/repos/asf/subversion/trunk/
- target: /tmp/svncheckout
- trust: True
- require:
- pkg: svn
Then, run: salt minon state.highstate test=True:
minion:
----------
ID: svn
Function: pkg.installed
Name: subversion
Result: True
Comment: Package subversion is already installed
Started: 11:39:14.144222
Duration: 591.097 ms
Changes:
----------
ID: svn_my_repo
Function: svn.latest
Name: https://svn.apache.org/repos/asf/subversion/trunk/
Result: None
Comment: /tmp/svncheckout doesn't exist and is set to be checked out.
Started: 11:39:14.736621
Duration: 0.448 ms
Changes:
Summary for minion
------------
Succeeded: 2 (unchanged=1)
Failed: 0
------------
Total states run: 2
Everything is OK.
Now, execute salt minon state.highstate, and it should run successfully too.
But after that, try again with test=True:
salt minon state.highstate test=True
minion:
----------
ID: svn
Function: pkg.installed
Name: subversion
Result: True
Comment: Package subversion is already installed
Started: 11:41:46.060243
Duration: 617.816 ms
Changes:
----------
ID: svn_my_repo
Function: svn.latest
Name: https://svn.apache.org/repos/asf/subversion/trunk/
Result: False
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1624, in call
**cdata['kwargs'])
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1492, in wrapper
return f(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/salt/states/svn.py", line 105, in latest
out = __salt__[svn_cmd](cwd, target, user, username, password, *opts)
File "/usr/lib/python2.7/dist-packages/salt/modules/svn.py", line 284, in diff
return _run_svn('diff', cwd, user, username, password, opts)
File "/usr/lib/python2.7/dist-packages/salt/modules/svn.py", line 76, in _run_svn
raise exceptions.CommandExecutionError(result['stderr'] + '\n\n' + ' '.join(cmd))
CommandExecutionError: svn: E230001: Unable to connect to a repository at URL 'https://svn.apache.org/repos/asf/subversion/trunk'
svn: E230001: Server SSL certificate verification failed: issuer is not trusted
svn --non-interactive diff -r HEAD /tmp/svncheckout
Started: 11:41:46.679371
Duration: 412.506 ms
Changes:
Summary for minion
------------
Succeeded: 1
Failed: 1
------------
Total states run: 2
Though, again, running without test=True, it works OK.
Moving /etc/ssl/certs.backup back into /etc/ssl/certs makes test=True work, as host is trusted again.
Versions Report
Salt Version:
Salt: 2015.8.10
Dependency Versions:
Jinja2: 2.6
M2Crypto: Not Installed
Mako: 0.7.0
PyYAML: 3.10
PyZMQ: 13.1.0
Python: 2.7.3 (default, Mar 13 2014, 11:03:55)
RAET: Not Installed
Tornado: 4.2.1
ZMQ: 3.2.3
cffi: Not Installed
cherrypy: 3.2.2
dateutil: 1.5
gitdb: 0.5.4
gitpython: 0.3.2 RC1
ioflo: Not Installed
libgit2: Not Installed
libnacl: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.3.0
mysql-python: 1.2.3
pycparser: Not Installed
pycrypto: 2.6.1
pygit2: Not Installed
python-gnupg: Not Installed
smmap: 0.8.2
timelib: Not Installed
System Versions:
dist: debian 7.10
machine: x86_64
release: 3.2.0-4-amd64
system: debian 7.10
Activity
[-]svn.latest ignores trust=True after initial checkout with state.highstate test=True[/-][+]svn.latest ignores trust=True after initial checkout when running state.highstate test=True[/+]Ch3LL commentedon Jun 3, 2016
@Talkless I am able to confirm this behavior on debian7.. Also am seeing this behavior on 2016.3.0.
Some useful log output:
The reason this occurs is because when passing test=True this code is run:
If you were to run that command like so:
svn --non-interactive diff -r HEAD /tmp/svncheckoutyou would also receive a certificate error like so:I would argue that this is by design because this command requires the certificate to be verified, you also would not be able to run a
git clonein this instance if the directory was renamed. And I think this command is useful because when run it should show you the diff of the repository. Do you have a proposal on a different approach? Maybe different behavior when the running test=True?Talkless commentedon Jun 6, 2016
Well, I guess all is needed is that svn.diff should also get trust=True then. Running
svn --trust-server-cert --non-interactive diff -r HEADruns without certificate error. Note the--trust-server-cert.Talkless commentedon Jun 13, 2016
@Ch3LL could you please consider my last comment? Thanks.