transmission: Read configuration as super user

Due to permission restrictions on the configuration file (due to stored
password), it is not possible to read it as plinth user.  Read it using
sudo instead.
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2016-08-16 18:39:38 -04:00
1 parent 522db2ce4c
commit afdea208ec
4 files changed
+11 -8

No files matched your search

-2
View File
@@ -47,8 +47,6 @@ description = [
service = None
TRANSMISSION_CONFIG = '/etc/transmission-daemon/settings.json'
def init():
"""Intialize the Transmission module."""
+2 -1
View File
@@ -42,7 +42,8 @@ class TransmissionServiceView(views.ServiceView):
def get_initial(self):
"""Get the current settings from Transmission server."""
configuration = open(transmission.TRANSMISSION_CONFIG, 'r').read()
configuration = actions.superuser_run(
'transmission', ['get-configuration'])
status = json.loads(configuration)
status = {key.translate(str.maketrans({'-': '_'})): value
for key, value in status.items()}