Commit 19b6c4a9 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

fixup! Add Python 3 support

parent 15afc959
...@@ -39,6 +39,7 @@ import prettytable ...@@ -39,6 +39,7 @@ import prettytable
from slapos.grid import networkcache from slapos.grid import networkcache
from slapos.grid.distribution import distribution_tuple from slapos.grid.distribution import distribution_tuple
from slapos.cli.config import ConfigCommand from slapos.cli.config import ConfigCommand
from slapos.util import str2bytes
FAILURE_EXIT_CODE = 10 FAILURE_EXIT_CODE = 10
...@@ -77,7 +78,7 @@ def do_lookup(logger, cache_dir, software_url): ...@@ -77,7 +78,7 @@ def do_lookup(logger, cache_dir, software_url):
if looks_like_md5(software_url): if looks_like_md5(software_url):
md5 = software_url md5 = software_url
else: else:
md5 = hashlib.md5(software_url).hexdigest() md5 = hashlib.md5(str2bytes(software_url)).hexdigest()
try: try:
url = '%s/%s' % (cache_dir, md5) url = '%s/%s' % (cache_dir, md5)
logger.debug('Connecting to %s', url) logger.debug('Connecting to %s', url)
......
...@@ -39,6 +39,7 @@ import prettytable ...@@ -39,6 +39,7 @@ import prettytable
from slapos.grid import networkcache from slapos.grid import networkcache
from slapos.cli.config import ConfigCommand from slapos.cli.config import ConfigCommand
from slapos.cli.list import resetLogger from slapos.cli.list import resetLogger
from slapos.util import str2bytes
class CacheLookupCommand(ConfigCommand): class CacheLookupCommand(ConfigCommand):
""" """
...@@ -63,7 +64,7 @@ class CacheLookupCommand(ConfigCommand): ...@@ -63,7 +64,7 @@ class CacheLookupCommand(ConfigCommand):
sys.exit(do_lookup(self.app.log, cache_dir, args.url)) sys.exit(do_lookup(self.app.log, cache_dir, args.url))
def do_lookup(logger, cache_dir, url): def do_lookup(logger, cache_dir, url):
md5 = hashlib.md5(url).hexdigest() md5 = hashlib.md5(str2bytes(url)).hexdigest()
try: try:
cached_url = '%s/slapos-buildout-%s' % (cache_dir, md5) cached_url = '%s/slapos-buildout-%s' % (cache_dir, md5)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment