mirror of
https://github.com/ProtoThis/python-synology.git
synced 2025-08-02 23:55:09 +00:00
Add Upgrade detail infos (#86)
* get update detail info * missing new line at the end * black compliant * flake8 compliant * fix pre-commit * Update tests/api_data/dsm_6/core/const_6_core_upgrade.py * Update tests/api_data/dsm_6/core/const_6_core_upgrade.py Co-authored-by: Quentame <polletquentin74@me.com>
This commit is contained in:
10
README.rst
10
README.rst
@ -252,6 +252,16 @@ Upgrade usage
|
||||
if upgrade.update_available:
|
||||
do something ...
|
||||
|
||||
# get available version string (return None if no update available)
|
||||
upgrade.available_version
|
||||
|
||||
# get need of reboot (return None if no update available)
|
||||
upgrade.reboot_needed
|
||||
|
||||
# get need of service restarts (return None if no update available)
|
||||
upgrade.service_restarts
|
||||
|
||||
|
||||
Credits / Special Thanks
|
||||
========================
|
||||
- https://github.com/florianeinfalt
|
||||
|
@ -20,5 +20,20 @@ class SynoCoreUpgrade:
|
||||
|
||||
@property
|
||||
def update_available(self):
|
||||
"""Gets all Upgrade info."""
|
||||
"""Gets available update info."""
|
||||
return self._data["update"].get("available")
|
||||
|
||||
@property
|
||||
def available_version(self):
|
||||
"""Gets available verion info."""
|
||||
return self._data["update"].get("version")
|
||||
|
||||
@property
|
||||
def reboot_needed(self):
|
||||
"""Gets info if reboot is needed."""
|
||||
return self._data["update"].get("reboot")
|
||||
|
||||
@property
|
||||
def service_restarts(self):
|
||||
"""Gets info if services are restarted."""
|
||||
return self._data["update"].get("restart")
|
||||
|
@ -23,7 +23,7 @@ from .api_data.dsm_6 import DSM_6_CORE_SECURITY
|
||||
from .api_data.dsm_6 import DSM_6_CORE_SECURITY_UPDATE_OUTOFDATE
|
||||
from .api_data.dsm_6 import DSM_6_CORE_SHARE
|
||||
from .api_data.dsm_6 import DSM_6_CORE_SYSTEM_DS918_PLUS
|
||||
from .api_data.dsm_6 import DSM_6_CORE_UPGRADE
|
||||
from .api_data.dsm_6 import DSM_6_CORE_UPGRADE_TRUE
|
||||
from .api_data.dsm_6 import DSM_6_CORE_UTILIZATION
|
||||
from .api_data.dsm_6 import DSM_6_CORE_UTILIZATION_ERROR_1055
|
||||
from .api_data.dsm_6 import DSM_6_DOWNLOAD_STATION_INFO_CONFIG
|
||||
@ -88,7 +88,7 @@ API_SWITCHER = {
|
||||
"CORE_SHARE": DSM_6_CORE_SHARE,
|
||||
"CORE_SYSTEM": DSM_6_CORE_SYSTEM_DS918_PLUS,
|
||||
"CORE_UTILIZATION": DSM_6_CORE_UTILIZATION,
|
||||
"CORE_UPGRADE": DSM_6_CORE_UPGRADE,
|
||||
"CORE_UPGRADE": DSM_6_CORE_UPGRADE_TRUE,
|
||||
"STORAGE_STORAGE": {
|
||||
"RAID": DSM_6_STORAGE_STORAGE_DS918_PLUS_RAID5_3DISKS_1VOL,
|
||||
"SHR1": DSM_6_STORAGE_STORAGE_DS213_PLUS_SHR1_2DISKS_2VOLS,
|
||||
|
@ -8,7 +8,8 @@ from .core.const_6_core_security import DSM_6_CORE_SECURITY_UPDATE_OUTOFDATE
|
||||
from .core.const_6_core_share import DSM_6_CORE_SHARE
|
||||
from .core.const_6_core_system import DSM_6_CORE_SYSTEM_DS218_PLAY
|
||||
from .core.const_6_core_system import DSM_6_CORE_SYSTEM_DS918_PLUS
|
||||
from .core.const_6_core_upgrade import DSM_6_CORE_UPGRADE
|
||||
from .core.const_6_core_upgrade import DSM_6_CORE_UPGRADE_FALSE
|
||||
from .core.const_6_core_upgrade import DSM_6_CORE_UPGRADE_TRUE
|
||||
from .core.const_6_core_utilization import DSM_6_CORE_UTILIZATION
|
||||
from .core.const_6_core_utilization import DSM_6_CORE_UTILIZATION_ERROR_1055
|
||||
from .download_station.const_6_download_station_info import (
|
||||
@ -69,7 +70,8 @@ __all__ = [
|
||||
"DSM_6_CORE_SHARE",
|
||||
"DSM_6_CORE_SYSTEM_DS218_PLAY",
|
||||
"DSM_6_CORE_SYSTEM_DS918_PLUS",
|
||||
"DSM_6_CORE_UPGRADE",
|
||||
"DSM_6_CORE_UPGRADE_FALSE",
|
||||
"DSM_6_CORE_UPGRADE_TRUE",
|
||||
"DSM_6_CORE_UTILIZATION",
|
||||
"DSM_6_CORE_UTILIZATION_ERROR_1055",
|
||||
"DSM_6_DOWNLOAD_STATION_INFO_CONFIG",
|
||||
|
@ -1,3 +1,23 @@
|
||||
"""DSM 6 SYNO.Core.Upgrade data."""
|
||||
|
||||
DSM_6_CORE_UPGRADE = {"data": {"update": {"available": False}}, "success": True}
|
||||
DSM_6_CORE_UPGRADE_FALSE = {"data": {"update": {"available": False}}, "success": True}
|
||||
DSM_6_CORE_UPGRADE_TRUE = {
|
||||
"data": {
|
||||
"update": {
|
||||
"available": True,
|
||||
"reboot": "now",
|
||||
"restart": "some",
|
||||
"type": "nano",
|
||||
"version": "DSM 6.2.3-25426 Update 2",
|
||||
"version_details": {
|
||||
"buildnumber": 25426,
|
||||
"major": 6,
|
||||
"micro": 3,
|
||||
"minor": 2,
|
||||
"nano": 2,
|
||||
"os_name": "DSM",
|
||||
},
|
||||
}
|
||||
},
|
||||
"success": True,
|
||||
}
|
||||
|
@ -574,7 +574,10 @@ class TestSynologyDSM(TestCase):
|
||||
"""Test upgrade."""
|
||||
assert self.api.upgrade
|
||||
self.api.upgrade.update()
|
||||
assert self.api.upgrade.update_available is False
|
||||
assert self.api.upgrade.update_available
|
||||
assert self.api.upgrade.available_version == "DSM 6.2.3-25426 Update 2"
|
||||
assert self.api.upgrade.reboot_needed == "now"
|
||||
assert self.api.upgrade.service_restarts == "some"
|
||||
|
||||
def test_utilisation(self):
|
||||
"""Test utilisation."""
|
||||
|
Reference in New Issue
Block a user