Merge pull request #14 from MycroftAI/hotfix/install-remove

Hotfix/install remove
pull/15/head
Chris Veilleux 2018-11-06 13:40:29 -06:00 committed by GitHub
commit f66ce0a851
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -71,7 +71,7 @@ class SkillInstallEndpoint(SeleneEndpoint):
)
if "skills" in installed_skills:
for skill in installed_skills['skills']:
if skill['skill']['name'] == 'Installer':
if skill['skill']['name'] == 'Installer' and self.validate_skill_installer(skill['skill']):
self.device_uuid = skill['deviceUuid']
installer_skill = skill['skill']
break
@ -86,6 +86,16 @@ class SkillInstallEndpoint(SeleneEndpoint):
return installer_skill
def validate_skill_installer(self, skill):
has_to_install = False
has_to_remove = False
for field in skill['skillMetadata']['sections'][0]['fields']:
if field['name'] == 'to_install':
has_to_install = True
elif field['name'] == 'to_remove':
has_to_remove = True
return has_to_install and has_to_remove
def _find_installer_settings(self, installer_skill):
for section in installer_skill['skillMetadata']['sections']:
for setting in section['fields']: