Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with svn when http proxy is used. #376

Open
achaios opened this issue Oct 16, 2020 · 1 comment
Open

Error with svn when http proxy is used. #376

achaios opened this issue Oct 16, 2020 · 1 comment

Comments

@achaios
Copy link

achaios commented Oct 16, 2020

I get the following error when trying to run services in local obs instance where XXX_proxy env variables are set.
I guess it's a python 3 issue when using "wb" flags, but I don't know how to fix it.
Using just a "w" flag, also fails in a different fashion.
(Version 0.10.16.1595245235.15a0df2)

Files could not be expanded: service error: TypeError: a bytes-like object is required, not 'str' less info

service obs_scm failed:
Traceback (most recent call last):
File "/usr/lib/obs/service//obs_scm", line 30, in
main()
File "/usr/lib/obs/service//obs_scm", line 26, in main
TarSCM.run()
File "/usr/lib/obs/service/TarSCM/__init__.py", line 39, in run
task_list.process_list()
File "/usr/lib/obs/service/TarSCM/tasks.py", line 118, in process_list
self.process_single_task(task)
File "/usr/lib/obs/service/TarSCM/tasks.py", line 184, in process_single_task
scm_object.fetch_upstream()
File "/usr/lib/obs/service/TarSCM/scm/base.py", line 147, in fetch_upstream
self.fetch_upstream_scm()
File "/usr/lib/obs/service/TarSCM/scm/svn.py", line 87, in fetch_upstream_scm
command = self._get_scm_cmd() + ['checkout', '--non-interactive',
File "/usr/lib/obs/service/TarSCM/scm/svn.py", line 38, in _get_scm_cmd
cfg.write('[global]\n')
TypeError: a bytes-like object is required, not 'str'
@reusch
Copy link

reusch commented Oct 10, 2022

I just stumbled upon this issue and solved it for me by doing the following:

--- svn.py.orig 2022-10-10 15:48:18.000000000 +0200
+++ /usr/lib/obs/service/TarSCM/scm/svn.py      2022-10-10 15:51:49.549308247 +0200
@@ -37,3 +37,3 @@
             cfg = open(self.svntmpdir + "/servers", "wb")
-            cfg.write('[global]\n')
+            cfg.write('[global]\n'.encode('utf-8'))

@@ -48,3 +48,3 @@
                 logging.debug('using proxy host: %s', proxy_host)
-                cfg.write('http-proxy-host=' + proxy_host + '\n')
+                cfg.write(('http-proxy-host=' + proxy_host + '\n').encode('utf-8'))

@@ -52,3 +52,3 @@
                 logging.debug('using proxy port: %s', proxy_port)
-                cfg.write('http-proxy-port=' + proxy_port + '\n')
+                cfg.write(('http-proxy-port=' + proxy_port + '\n').encode('utf-8'))

@@ -74,3 +74,3 @@
             logging.debug('no_proxy string = %s', no_proxy_string)
-            cfg.write('http-proxy-exceptions=' + no_proxy_string)
+            cfg.write(('http-proxy-exceptions=' + no_proxy_string).encode('utf-8'))
             cfg.close()

I don't know if this is the correct encoding for the SVN servers file, but it seems to works for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants