Skip to content

Commit

Permalink
Merge pull request #32 from OpenVoiceOS/release-1.0.0a1
Browse files Browse the repository at this point in the history
Release 1.0.0a1
  • Loading branch information
JarbasAl authored Sep 17, 2024
2 parents 720462e + f5af152 commit 4d7cabf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 82 deletions.
52 changes: 6 additions & 46 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,16 @@
# Changelog

## [0.0.6a1](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/tree/0.0.6a1) (2024-09-11)
## [1.0.0a1](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/tree/1.0.0a1) (2024-09-17)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/compare/0.0.5a5...0.0.6a1)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/compare/V0.1.0...1.0.0a1)

**Fixed bugs:**
**Breaking changes:**

- Not able to restart services handles by regular a user [\#27](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/issues/27)
- refactor!:deprecate ntp code path [\#31](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/pull/31) ([JarbasAl](https://github.com/JarbasAl))

**Merged pull requests:**
## [V0.1.0](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/tree/V0.1.0) (2024-09-11)

- feat:semver [\#29](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/pull/29) ([JarbasAl](https://github.com/JarbasAl))

## [0.0.5a5](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/tree/0.0.5a5) (2024-02-24)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/compare/0.0.5a4...0.0.5a5)

**Fixed bugs:**

- fix/plugin\_name [\#26](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/pull/26) ([builderjer](https://github.com/builderjer))

## [0.0.5a4](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/tree/0.0.5a4) (2024-02-19)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/compare/0.0.5a3...0.0.5a4)

**Fixed bugs:**

- fix/setup\_entrypoint [\#25](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/pull/25) ([builderjer](https://github.com/builderjer))

## [0.0.5a3](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/tree/0.0.5a3) (2024-02-18)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/compare/0.0.5a2...0.0.5a3)

**Fixed bugs:**

- fix: minimum ovos-utils version [\#23](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/pull/23) ([JarbasAl](https://github.com/JarbasAl))

## [0.0.5a2](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/tree/0.0.5a2) (2024-02-17)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/compare/0.0.5a1...0.0.5a2)

**Implemented enhancements:**

- feat: added option for systemd-timesyncd [\#21](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/pull/21) ([builderjer](https://github.com/builderjer))

## [0.0.5a1](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/tree/0.0.5a1) (2024-01-11)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/compare/0.0.4...0.0.5a1)

**Merged pull requests:**

- Update dependencies and imports to resolve deprecation warnings [\#22](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/pull/22) ([NeonDaniel](https://github.com/NeonDaniel))
[Full Changelog](https://github.com/OpenVoiceOS/ovos-PHAL-plugin-system/compare/0.1.0...V0.1.0)



Expand Down
40 changes: 7 additions & 33 deletions ovos_PHAL_plugin_system/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@
from threading import Event

from json_database import JsonStorageXDG, JsonDatabaseXDG
from ovos_bus_client.message import Message
from ovos_backend_client.identity import IdentityManager
from ovos_bus_client.apis.gui import GUIInterface
from ovos_bus_client.message import Message
from ovos_config.config import Configuration, update_mycroft_config
from ovos_config.locale import set_default_lang
from ovos_config.locations import OLD_USER_CONFIG, USER_CONFIG, WEB_CONFIG_CACHE
from ovos_config.meta import get_xdg_base

from ovos_plugin_manager.phal import AdminPlugin, PHALPlugin
from ovos_plugin_manager.templates.phal import PHALValidator, AdminValidator
from ovos_utils import classproperty
from ovos_bus_client.apis.gui import GUIInterface
from ovos_utils.log import LOG
from ovos_utils.process_utils import RuntimeRequirements
from ovos_utils.system import is_process_running, check_service_active, \
check_service_installed, restart_service
restart_service
from ovos_utils.xdg_utils import xdg_state_home, xdg_cache_home, xdg_data_home
from ovos_utils.log import LOG


class SystemEventsValidator(PHALValidator):
Expand All @@ -46,8 +45,6 @@ def __init__(self, bus=None, config=None):
super().__init__(bus=bus, name="ovos-PHAL-plugin-system", config=config)
self.gui = GUIInterface(bus=self.bus, skill_id=self.name,
config=self.config_core.get('gui'))

self.bus.on("system.ntp.sync", self.handle_ntp_sync_request)
self.bus.on("system.ssh.status", self.handle_ssh_status)
self.bus.on("system.ssh.enable", self.handle_ssh_enable_request)
self.bus.on("system.ssh.disable", self.handle_ssh_disable_request)
Expand Down Expand Up @@ -219,31 +216,6 @@ def handle_ssh_disable_request(self, message):
self.gui["label"] = "SSH Disabled"
self.gui.show_page(page)

def handle_ntp_sync_request(self, message):
"""
Force the system clock to synchronize with internet time servers
"""
# Check to see what service is installed
if check_service_installed('ntp'):
subprocess.call('service ntp stop', shell=True)
subprocess.call('ntpd -gq', shell=True)
subprocess.call('service ntp start', shell=True)
elif check_service_installed('systemd-timesyncd'):
subprocess.call("systemctl stop systemd-timesyncd", shell=True)
subprocess.call("systemctl start systemd-timesyncd", shell=True)
if check_service_active('ntp') or check_service_active('systemd-timesyncd'):
# NOTE: this one defaults to False
# it is usually part of other groups of actions that may
# provide their own UI
if message.data.get("display", False):
page = join(dirname(__file__), "ui", "Status.qml")
self.gui["status"] = "Enabled"
self.gui["label"] = "Clock updated"
self.gui.show_page(page)
self.bus.emit(message.reply('system.ntp.sync.complete'))
else:
LOG.debug("No time sync service installed")

def handle_reboot_request(self, message):
"""
Shut down and restart the system
Expand Down Expand Up @@ -303,6 +275,7 @@ def handle_mycroft_restart_request(self, message):
self.gui.show_page(page, override_animations=True,
override_idle=True)
service = self.core_service_name
# TODO - clean up this mess
try:
restart_service(service, sudo=False, user=True)
except:
Expand All @@ -320,7 +293,6 @@ def handle_ssh_status(self, message):
self.bus.emit(message.response(data={'enabled': enabled}))

def shutdown(self):
self.bus.remove("system.ntp.sync", self.handle_ntp_sync_request)
self.bus.remove("system.ssh.enable", self.handle_ssh_enable_request)
self.bus.remove("system.ssh.disable", self.handle_ssh_disable_request)
self.bus.remove("system.reboot", self.handle_reboot_request)
Expand All @@ -335,11 +307,13 @@ def shutdown(self):
self.handle_mycroft_restart_request)
super().shutdown()


class SystemEventsAdminValidator(AdminValidator, SystemEventsValidator):
@staticmethod
def validate(config=None):
LOG.info("ovos-PHAL-plugin-system running as root")
return True


class SystemEventsAdminPlugin(AdminPlugin, SystemEventsPlugin):
validator = SystemEventsAdminValidator
6 changes: 3 additions & 3 deletions ovos_PHAL_plugin_system/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 0
VERSION_MINOR = 1
VERSION_MAJOR = 1
VERSION_MINOR = 0
VERSION_BUILD = 0
VERSION_ALPHA = 0
VERSION_ALPHA = 1
# END_VERSION_BLOCK

0 comments on commit 4d7cabf

Please sign in to comment.