Allow service data to be passed to shell_command (#2362)

pull/2367/head
Dale Higgs 2016-06-23 10:47:56 -05:00 committed by Paulus Schoutsen
parent 3349bdc2bd
commit 600a3e3965
1 changed files with 3 additions and 5 deletions

View File

@ -6,6 +6,7 @@ https://home-assistant.io/components/shell_command/
"""
import logging
import subprocess
import shlex
import voluptuous as vol
@ -23,8 +24,6 @@ CONFIG_SCHEMA = vol.Schema({
}),
}, extra=vol.ALLOW_EXTRA)
SHELL_COMMAND_SCHEMA = vol.Schema({})
def setup(hass, config):
"""Setup the shell_command component."""
@ -44,8 +43,7 @@ def setup(hass, config):
_LOGGER.exception('Error running command: %s', cmd)
for name in conf.keys():
hass.services.register(DOMAIN, name, service_handler,
schema=SHELL_COMMAND_SCHEMA)
hass.services.register(DOMAIN, name, service_handler)
return True
@ -64,6 +62,6 @@ def _parse_command(hass, cmd, variables):
shell = True
else:
# template used. Must break into list and use shell=False for security
cmd = [prog] + rendered_args.split()
cmd = [prog] + shlex.split(rendered_args)
shell = False
return cmd, shell