mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
Merge pull request #37432 from sebastian-philipp/cephadm-upgrade-state-none
mgr/cephadm: upgrade_state can be literally "null"
This commit is contained in:
commit
9f752b177e
@ -5,6 +5,7 @@ import pytest
|
||||
|
||||
from ceph.deployment.service_spec import ServiceSpec
|
||||
from cephadm import CephadmOrchestrator
|
||||
from cephadm.upgrade import CephadmUpgrade
|
||||
from .fixtures import _run_cephadm, wait, cephadm_module, with_host, with_service
|
||||
|
||||
|
||||
@ -85,3 +86,10 @@ def test_upgrade_run(use_repo_digest, cephadm_module: CephadmOrchestrator):
|
||||
assert image == 'to_image@repo_digest'
|
||||
else:
|
||||
assert image == 'to_image'
|
||||
|
||||
|
||||
def test_upgrade_state_null(cephadm_module: CephadmOrchestrator):
|
||||
# This test validates https://tracker.ceph.com/issues/47580
|
||||
cephadm_module.set_store('upgrade_state', 'null')
|
||||
CephadmUpgrade(cephadm_module)
|
||||
assert CephadmUpgrade(cephadm_module).upgrade_state is None
|
||||
|
@ -49,8 +49,11 @@ class UpgradeState:
|
||||
}
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, data) -> 'UpgradeState':
|
||||
return cls(**data)
|
||||
def from_json(cls, data) -> Optional['UpgradeState']:
|
||||
if data:
|
||||
return cls(**data)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
class CephadmUpgrade:
|
||||
|
Loading…
Reference in New Issue
Block a user