[X2Go-Commits] [x2gobroker] 05/06: sbin/x2gobroker-pubkeyauthorizer: Some string/bytecode fixes for Python3. Plus urllib -> urllib.request.
git-admin at x2go.org
git-admin at x2go.org
Mon Apr 16 13:43:00 CEST 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2gobroker.
commit bce017435fb2e97c8b6697a1d2388515a7595b5e
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Mon Apr 16 13:07:15 2018 +0200
sbin/x2gobroker-pubkeyauthorizer: Some string/bytecode fixes for Python3. Plus urllib -> urllib.request.
---
sbin/x2gobroker-pubkeyauthorizer | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/sbin/x2gobroker-pubkeyauthorizer b/sbin/x2gobroker-pubkeyauthorizer
index 757880a..0948f1e 100755
--- a/sbin/x2gobroker-pubkeyauthorizer
+++ b/sbin/x2gobroker-pubkeyauthorizer
@@ -25,7 +25,7 @@ import setproctitle
import argparse
import logging
import binascii
-import urllib
+import urllib.request
import getpass
import logging
import logging.config
@@ -136,9 +136,9 @@ if __name__ == '__main__':
os.chmod('{home}/.ssh'.format(home=broker_home), 0o0750)
logger_broker.info(' Created {home}/.ssh'.format(home=broker_home))
- tmpfile_name, httpmsg = urllib.urlretrieve(cmdline_args.broker_url)
+ tmpfile_name, httpmsg = urllib.request.urlretrieve(cmdline_args.broker_url)
tmpfile = open(tmpfile_name, 'rb')
- new_pubkeys = [ k for k in tmpfile.read().split('\n') if k ]
+ new_pubkeys = [ k for k in tmpfile.read().decode().split('\n') if k ]
if len(new_pubkeys) == 1:
logger_broker.info(' Found {i} public key at URL {url}'.format(i=len(new_pubkeys), url=cmdline_args.broker_url))
else:
@@ -149,9 +149,9 @@ if __name__ == '__main__':
try:
read_authorized_keys = open('{home}/.ssh/authorized_keys'.format(home=broker_home), 'rb')
_content = read_authorized_keys.read()
- if _content and ord(_content[-1]) != 10:
+ if _content and _content[-1] != 10:
append_newline = '\n'
- already_authorized_keys = _content.split('\n')
+ already_authorized_keys = _content.decode().split('\n')
read_authorized_keys.close()
except IOError:
already_authorized_keys = []
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git
More information about the x2go-commits
mailing list