diff --git a/cvat/apps/git/migrations/0001_initial.py b/cvat/apps/git/migrations/0001_initial.py index ad8e3cf95640..e046a6d04299 100644 --- a/cvat/apps/git/migrations/0001_initial.py +++ b/cvat/apps/git/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.1.3 on 2018-12-04 10:09 +# Generated by Django 2.1.3 on 2018-12-05 11:10 from django.db import migrations, models import django.db.models.deletion @@ -20,8 +20,7 @@ class Migration(migrations.Migration): ('url', models.URLField(max_length=2000)), ('path', models.CharField(max_length=256)), ('sync_date', models.DateTimeField(auto_now_add=True)), - ('check_date', models.DateTimeField(auto_now_add=True)), - ('status', models.CharField(max_length=20)), + ('status', models.CharField(default='!sync', max_length=20)), ], ), ] diff --git a/cvat/apps/git/models.py b/cvat/apps/git/models.py index e991d82c832d..bfb07e0aa5e7 100644 --- a/cvat/apps/git/models.py +++ b/cvat/apps/git/models.py @@ -11,5 +11,4 @@ class GitData(models.Model): url = models.URLField(max_length = 2000) path = models.CharField(max_length=256) sync_date = models.DateTimeField(auto_now_add=True) - check_date = models.DateTimeField(auto_now_add=True) - status = models.CharField(max_length=20) + status = models.CharField(max_length=20, default="!sync") diff --git a/cvat/apps/git/views.py b/cvat/apps/git/views.py index e86b758ed664..7017eefdd874 100644 --- a/cvat/apps/git/views.py +++ b/cvat/apps/git/views.py @@ -82,13 +82,9 @@ def get_repository(request, tid): def get_meta_info(request): try: db_git_records = GitData.objects.all() - cur_date = timezone.now() response = {} for db_git in db_git_records: - if (cur_date - db_git.check_date).seconds > 600 or not len(db_git.status): - response[db_git.task_id] = CVATGit.get(db_git.task_id, request.user) - else: - response[db_git.task_id] = db_git.status + response[db_git.task_id] = db_git.status return JsonResponse(response, safe = False) except Exception as ex: diff --git a/cvat/settings/base.py b/cvat/settings/base.py index b0f4c7e802c0..0ff71f8ea4a3 100644 --- a/cvat/settings/base.py +++ b/cvat/settings/base.py @@ -46,10 +46,9 @@ def generate_ssh_keys(): try: with FileLock(pidfile): - subprocess.run(['ssh-add', '{}/*'.format(ssh_dir)]) + subprocess.run(['ssh-add', '{}/*'.format(ssh_dir)], shell = True, stderr = subprocess.PIPE) keys = subprocess.run(['ssh-add -l'], shell = True, stdout = subprocess.PIPE).stdout.decode('utf-8').split('\n') - if 'has no identities' in keys[0]: print('SSH keys were not found') keys = os.listdir(keys_dir) @@ -66,7 +65,7 @@ def generate_ssh_keys(): shutil.copymode('{}/id_rsa'.format(keys_dir), '{}/id_rsa'.format(ssh_dir)) shutil.copyfile('{}/id_rsa.pub'.format(keys_dir), '{}/id_rsa.pub'.format(ssh_dir)) shutil.copymode('{}/id_rsa.pub'.format(keys_dir), '{}/id_rsa.pub'.format(ssh_dir)) - subprocess.run(['ssh-add', '{}/id_rsa'.format(ssh_dir)]) + subprocess.run(['ssh-add', '{}/id_rsa'.format(ssh_dir)], shell = True) os.remove(pidfile) except: return