Commit Graph

142 Commits (refactor/python-detect)

Author SHA1 Message Date
Kris Gesling e75a05557b docstring cleanup 2021-05-11 15:10:32 +09:30
Åke Forslund bd19d1673c Fix remote settings overwrite at startup
Mycroft always mangeled any local settings changes at startup.

This caches the last settings from home on disk and only updates skills
_if_ there is a change.

This means that as if a member is changed locally (manually edited or
changed by the skill itself) it will be kept until another change is made
to the skill on Home.
2020-12-29 23:03:21 +01:00
Kris Gesling b0884301a3
Merge pull request #2734 from MycroftAI/feat/skill_settings_sync
skill settings sync flag
2020-12-02 10:45:45 +09:30
jarbasal 4c84f66e15 skill settings sync flag 2020-12-01 23:56:15 +11:00
Åke Forslund 731de16d1f Properly fix readthedocs issue with yaml 2020-11-06 07:29:12 +01:00
Kris Gesling 5e8474cd72 Add optional message argument
When called over the messagebus the message is passed to the handler,
thereby throwing a TypeError as it wasn't expecting 2 positional args.
2020-09-25 15:55:42 +09:30
Åke a0c7ea7caf
Merge pull request #2560 from forslund/refactor/settings-cleanup
Refactor settings cleanup
2020-05-31 13:37:34 +02:00
Åke Forslund cdb04b1f3c Minor docstring update 2020-05-27 22:08:14 +02:00
Åke Forslund d494814ec0 Remove unused method 2020-05-27 22:08:14 +02:00
Åke Forslund 944cc416a5 Update SkillSettingsDownloader class
- Update docstrings
- Remove unused members
- Minor logic change to make download method more self-contained
2020-05-27 22:08:10 +02:00
Bart Ribbers 01900e5a29 Check the skill directory and XDG_CONFIG_DIR for settings 2020-05-15 11:45:13 +02:00
Chris Veilleux baf194c556 remove deprecated Settings class and any code in core that references it. 2020-02-27 08:07:07 +01:00
Åke Forslund 146a8c1434 Get skill_gid more reliably
If skill directory doesn't exist in current cache try to fetch a new
copy.
2019-12-18 12:05:40 +01:00
Åke Forslund f5685bde96 Simplify
Skip the queue thread, do upload in series with skill load/reload.
2019-12-18 12:05:40 +01:00
Åke Forslund c11c9756ce Add queue system to send settingsmeta
The queue will store all settingsmeta upload calls and execute them
after pairing can be verified.

Starts settings download after upload has started. When settings meta upload
has started for all skills the skill download process is triggered.

This guarantees that the settingsmeta skill_gid has been populated
properly before skills try to figure out which part of the skills data
belongs to them.

Add docstrings to upload queue
2019-12-18 12:04:57 +01:00
Åke f1327f0973
Merge pull request #2376 from forslund/bugfix/shutdown-on-skill-remove
Fix Shutdown of removed skills
2019-11-07 23:08:45 +01:00
Åke Forslund 3e905165e6 Fix Shutdown of removed skills
Verify that skill directory exists before writing to ensure that the
shutdown method doesn't throw exception if a skill is unloaded due to
being removed.
2019-10-31 11:40:41 +01:00
Åke Forslund d4a7193fe8 Remove circular reference during skill shutdown
This cleans up the extra skills references making the ref count trigger
correctly.
2019-10-31 09:38:46 +01:00
Åke Forslund 24d6cf9ea0 Add missing __delitem__ method
The delitem method is apparently used, for example by the alarm skill
2019-10-04 20:43:46 +02:00
Åke 6c228d00a9
Merge pull request #2320 from MycroftAI/bugfixes/skills-manifest
Bugfixes/skills manifest
2019-09-20 22:57:57 +02:00
Åke Forslund c6b1e3dc92 Make logging a little easier to decipher 2019-09-20 12:20:46 +02:00
Åke Forslund 3474d725b8 Stop settingmeta upload on skill shutdown
This makes sure to shutdown any Timer handling settingsmetadata upload
on skill shutdown to make sure no duplicates are running.

(Easily occurs when a skill gid doesn't match the one sent in skill
manifest)
2019-09-19 15:25:55 +02:00
Åke Forslund b9097e43f2 Restructure to get skill_gid after startup 2019-09-18 19:59:13 +02:00
Chris Veilleux a5af2adb6d fixed an issue where a potential race condition can cause the settingsMeta API call to be issued without a device ID in the URL. 2019-09-17 15:31:48 -05:00
Chris Veilleux 9c0c20e96d added deprecation warning for settingsmeta fields no longer used. 2019-09-17 11:24:10 +02:00
Chris Veilleux 0d897cf4e8 don't emit settings change event if there are no settings 2019-09-17 11:24:10 +02:00
Chris Veilleux 1e5c2986d3 fix bug where saving settings to disk crashed when the settings passed to the function are a instance of the Settings class. 2019-09-17 11:24:10 +02:00
Chris Veilleux 21dd5b2bed fixed a bug with skill settings where the last download value was not properly initialized. added some logging 2019-09-17 11:24:10 +02:00
Chris Veilleux 4cfd48104d deal with empty settings file 2019-09-17 11:24:10 +02:00
Åke Forslund 30104b58c1 Fix broken tests
- Correct settingsmeta upload endpoint
- Remove test for delete settingsmeta endpoint

- Fix usage of Pathlib for python 3.4 and 3.5
2019-09-17 11:24:10 +02:00
Chris Veilleux b1a63638c1 implemented a stop-gap change to keep the skill API from breaking 2019-09-17 11:24:10 +02:00
Chris Veilleux 5c742d2ed0 complete rethink of how settings and settingsmeta are handled in core. 2019-09-17 11:24:10 +02:00
Åke Forslund 4d0e848965 Use from folder instead of dict lookup 2019-08-23 16:52:32 +02:00
Chris Veilleux be79b193b4 changed to use newer version of msm_wrapper. 2019-08-23 16:07:46 +02:00
Kris Gesling 3cacdaaaab
Fix TypeError for number values in settings
In some instances, the backend returns number setting values as an integer rather than a string.

This has been seen in the wild but has been difficult to replicate. The circumstances under which it happens are still unclear. I was able to semi-consistently have a number returned as int from the [Severe Weather Skill](https://github.com/domcross/severe-weather-information-skill) when editing an unrelated setting. To test, remove the 3 character country code (`[A-Z]{3} - `) from the service options of this skill .

This seems to be the quickest fix for it, but worth investigating further from the backend.
2019-08-17 08:36:00 +09:30
Åke Forslund ddb9d5b0a2 Hack: Fix readthedocs build
The Mycroft API documentation were blank due to the import of the yaml
module for some reason. This moves the import into the method where it's
used
2019-07-14 08:17:05 +02:00
Åke Forslund d87ff3a535 Launch settings fetching in thread. 2019-07-09 16:52:27 +02:00
Åke Forslund 83b4a91b8b Remove incorrect settings meta upload disable flag
This allows core to retry sending settings meta after a failed attempt
2019-06-29 21:00:15 +02:00
Åke 626c69bc1d Skill settings cleanup (#2140)
* Handle DelayRequests when uploading blank settingsmeta

* Move Api methods to DeviceApi

This includes delete, put and get skill settings/meta

* Cache skill settings for 30 seconds

The skill settings are cached to reduce number of requests to the backend and increase skill loading speed.

* Remove _request_other_settings method

The endpoint is not used anymore

* Fix issue when the settingsmeta fails to load

Remove an old reference to "BLANK_META" left behind in the exception handler for failing to load settingsmeta.
2019-06-05 18:45:15 -05:00
Åke Forslund 21efb0fd69 Use yaml.safe_load() to load settingsmeta yaml
safe_load limits the amount of custom methods that can be supplied with
the yaml and supports the basic yaml features.
2019-05-27 12:25:42 +02:00
Åke Forslund c3ac9d8ca7 Remove the delete metadata calls when updating settings
The calls are not implemented and functionality will likely change.
2019-05-21 17:21:45 +02:00
Åke Forslund 2208ee178c Switch to getting skill_gid from msm skill entry 2019-05-21 09:23:02 +02:00
Åke Forslund 4518a11528 Add safety around skillMetadata
skillMetadata could be accessed in settings without it when checking if remote update was needed.
2019-05-18 08:29:26 +02:00
Åke Forslund 6eb2aefbaa Delete remote settings before pushing
- restore storing / loading uuid
- use uuid to delete before pushing settingsmeta
2019-05-18 08:29:26 +02:00
Åke Forslund 4a75526de7 Check both endpoints for settings 2019-05-18 08:29:26 +02:00
Åke Forslund 93a0b31b4e Switch endpoint for fetching settings
use the userSkill endpoint instead of skill endpoint to always be able
to get settings no matter who the owner is.
2019-05-18 08:29:26 +02:00
Åke Forslund f6347ae47c Replace hashed meta with skill_gid as identifier
This also removes the notion of an owner skill and all skills may update settings on the server.
2019-05-18 08:29:26 +02:00
Åke Forslund 693bf2c699 Remove BLANK boilerplate content 2019-05-18 08:29:26 +02:00
Åke Forslund 56ed5a657f Re-add support for skill_gid in settingsmeta upload 2019-05-18 08:29:26 +02:00
ChristopherRogers1991 6dd16915a9 Allow settingsmeta to be a yaml file (#2113)
Allow settingsmeta to be a yaml file in addition to the current .json file
2019-05-13 09:34:39 +02:00