1 Star 0 Fork 97

王策/anaconda

forked from src-openEuler/anaconda 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
bugfix-Create-the-initial-storage-model-during-the-initiali.patch 2.13 KB
一键复制 编辑 原始数据 按行查看 历史
xuxiaolong 提交于 2021-04-02 10:25 . sync 49 fixbug from github
From 5cb9170cafc3f81193fd872a21933a0fa2bd5f2c Mon Sep 17 00:00:00 2001
From: Vendula Poncova <vponcova@redhat.com>
Date: Mon, 6 Jul 2020 14:04:28 +0200
Subject: [PATCH] Create the initial storage model during the initialization
After connecting all objects of the Storage service to signals, create
the initial storage model. It will be propagated to all these objects.
Otherwise, the objects might raise the UnavailableStorageError exception.
(cherry-picked from a commit fabc9a0)
---
pyanaconda/modules/storage/storage.py | 4 ++++
tests/nosetests/pyanaconda_tests/module_storage_test.py | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/pyanaconda/modules/storage/storage.py b/pyanaconda/modules/storage/storage.py
index 9c5aff943..08254b0ce 100644
--- a/pyanaconda/modules/storage/storage.py
+++ b/pyanaconda/modules/storage/storage.py
@@ -133,6 +133,10 @@ class StorageService(KickstartService):
self.on_protected_devices_changed
)
+ # After connecting modules to signals, create the initial
+ # storage model. It will be propagated to all modules.
+ self._set_storage(create_storage())
+
def _add_module(self, storage_module):
"""Add a base kickstart module."""
self._modules.append(storage_module)
diff --git a/tests/nosetests/pyanaconda_tests/module_storage_test.py b/tests/nosetests/pyanaconda_tests/module_storage_test.py
index 708981233..6bb1723d5 100644
--- a/tests/nosetests/pyanaconda_tests/module_storage_test.py
+++ b/tests/nosetests/pyanaconda_tests/module_storage_test.py
@@ -120,6 +120,11 @@ class StorageInterfaceTestCase(unittest.TestCase):
storage_reset_callback = Mock()
self.storage_module.partitioning_reset.connect(storage_reset_callback)
+ self.assertIsNotNone(self.storage_module.storage)
+ storage_changed_callback.assert_not_called()
+ storage_reset_callback.assert_not_called()
+
+ self.storage_module._current_storage = None
self.assertIsNotNone(self.storage_module.storage)
storage_changed_callback.assert_called_once()
storage_reset_callback.assert_not_called()
--
2.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wangce1988/anaconda.git
git@gitee.com:wangce1988/anaconda.git
wangce1988
anaconda
anaconda
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385