Fix git repo links on /healthz-cron/ page (#7412)

Fix #7411
This commit is contained in:
Paul McLanahan 2019-07-11 10:35:04 -04:00 коммит произвёл Jonathan Petto
Родитель 9662aa5e22
Коммит 5b2dec3dad
2 изменённых файлов: 26 добавлений и 1 удалений

Просмотреть файл

@ -9,6 +9,7 @@ from subprocess import check_output, CalledProcessError, STDOUT
from io import StringIO
from django.conf import settings
from django.utils.encoding import force_str
import timeago
from pathlib2 import Path
@ -38,7 +39,7 @@ class GitRepo:
finally:
os.chdir(curdir)
return output.strip()
return force_str(output.strip())
@property
def current_hash(self):

Просмотреть файл

@ -0,0 +1,24 @@
# Generated by Django 2.2.3 on 2019-07-10 18:59
from django.db import migrations
def fix_bytes_repr(apps, schema_editor):
"""Values were stored as strings with the "b''" in them. This should fix that."""
GitRepoState = apps.get_model('utils', 'GitRepoState')
for repo in GitRepoState.objects.all():
if repo.latest_ref.startswith("b'"):
# strip the b' off the start and the ' off the end
repo.latest_ref = repo.latest_ref[2:][:-1]
repo.save()
class Migration(migrations.Migration):
dependencies = [
('utils', '0002_auto_20180522_1249'),
]
operations = [
migrations.RunPython(fix_bytes_repr)
]