Handle arguments to actions properly

- Don't allow strings to be sent as arguments.  The mixup with
  lists/tuples could be dangerous.

- Don't escape arguments.  subprocess.Popen takes care that arguments
  are passed on nicely to the actions.

- Update tests.
This commit is contained in:
Sunil Mohan Adapa committed 2015-05-01 18:52:17 +05:30
1 parent 4e42486822
commit b62f6746f4
6 files changed
+100 -82

No files matched your search

+2 -2
View File
@@ -195,7 +195,7 @@ def set_hostname(hostname):
new_hostname=hostname)
LOGGER.info('Changing hostname to - %s', hostname)
actions.superuser_run('hostname-change', hostname)
actions.superuser_run('hostname-change', [hostname])
post_hostname_change.send_robust(sender='config',
old_hostname=old_hostname,
@@ -210,7 +210,7 @@ def set_domainname(domainname):
domainname = str(domainname)
LOGGER.info('Changing domain name to - %s', domainname)
actions.superuser_run('domainname-change', domainname)
actions.superuser_run('domainname-change', [domainname])
domainname_change.send_robust(sender='config',
old_domainname=old_domainname,
+1 -1
View File
@@ -257,7 +257,7 @@ def get_status():
"""Return the current status"""
"""ToDo: use key/value instead of hard coded value list"""
status = {}
output = actions.run('dynamicdns', 'status')
output = actions.run('dynamicdns', ['status'])
details = output.split()
status['enabled'] = (output.split()[0] == 'enabled')
+1 -1
View File
@@ -72,7 +72,7 @@ def index(request):
def get_status():
"""Return the current status"""
output = actions.run('owncloud-setup', 'status')
output = actions.run('owncloud-setup', ['status'])
return {'enabled': 'enable' in output.split()}
+1 -1
View File
@@ -103,7 +103,7 @@ def configure(request):
def get_status():
"""Return the current status"""
output = actions.run('xmpp-setup', 'status')
output = actions.run('xmpp-setup', ['status'])
return {'inband_enabled': 'inband_enable' in output.split()}