51 lines
2.1 KiB
Diff
51 lines
2.1 KiB
Diff
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
|
|
|