Kiwi Backup还原失败并显示python错误

时间:2019-02-22 08:56:18

标签: docker kiwi kiwi-tcms

我导出数据库json,并执行以下命令: http://kiwitcms.org/blog/atodorov/2018/07/30/how-to-backup-docker-volumes-for-kiwi-tcms/

我正在运行最新版本的Kiwi。

  1. docker exec -it kiwi_web / bin / bash -c'/Kiwi/manage.py sqlflush | /Kiwi/manage.py dbshel​​l'

2.cat database.json | docker exec -i kiwi_web /Kiwi/manage.py loaddata --format json-

我得到这个错误:

Traceback (most recent call last):
  File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 564, in get_field
    return self.fields_map[field_name]
KeyError: 'description'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/venv/lib/python3.6/site-packages/django/core/serializers/json.py", line 69, in Deserializer
    yield from PythonDeserializer(objects, **options)
  File "/venv/lib/python3.6/site-packages/django/core/serializers/python.py", line 116, in Deserializer
    field = Model._meta.get_field(field_name)
  File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 566, in get_field
sh-4.2$ cat database.json | ./manage.py loaddata --format json -
Traceback (most recent call last):
  File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 564, in get_field
    return self.fields_map[field_name]
KeyError: 'description'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/venv/lib/python3.6/site-packages/django/core/serializers/json.py", line 69, in Deserializer
    yield from PythonDeserializer(objects, **options)
  File "/venv/lib/python3.6/site-packages/django/core/serializers/python.py", line 116, in Deserializer
    field = Model._meta.get_field(field_name)
  File "/venv/lib/python3.6/site-packages/django/db/models/options.py", line 566, in get_field
    raise FieldDoesNotExist("%s has no field named '%s'" % (self.object_name, field_name))
django.core.exceptions.FieldDoesNotExist: Classification has no field named 'description'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "./manage.py", line 12, in <module>
    execute_from_command_line(sys.argv)
  File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/venv/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/venv/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 72, in handle
    self.loaddata(fixture_labels)
  File "/venv/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 113, in loaddata
    self.load_label(fixture_label)
  File "/venv/lib/python3.6/site-packages/django/core/management/commands/loaddata.py", line 168, in load_label
    for obj in objects:
  File "/venv/lib/python3.6/site-packages/django/core/serializers/json.py", line 73, in Deserializer
    raise DeserializationError() from exc
django.core.serializers.base.DeserializationError: Problem installing fixture '-':

1 个答案:

答案 0 :(得分:0)

您在哪个版本的Kiwi TCMS中进行备份?

似乎备份是从旧版本开始的,因为6.5附带了删除Build.description和分类.description字段的迁移!

我不确定从技术上讲是否可以优雅地处理此问题。请在GitHub上提交问题,以便我们可以调查更多详细信息并链接回该SO线程。

一种解决方法是,不是启动最新版本的Kiwi TCMS,而是启动进行备份的版本。然后还原数据,升级到最新版本,运行将更改数据库架构的迁移,然后再次备份。

如果您不保留旧的docker映像,则必须从源代码构建它。