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

+8 -5
View File
@@ -37,13 +37,10 @@ def parse_arguments():
parser = argparse.ArgumentParser()
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
# Enable service
subparsers.add_parser('enable', help='Enable Transmission service')
# Disable service
subparsers.add_parser('disable', help='Disable Transmission service')
# Merge given JSON configration with existing
subparsers.add_parser(
'get-configuration', help='Return the current configuration')
subparsers.add_parser(
'merge-configuration',
help='Merge JSON configuration from stdin with existing')
@@ -63,6 +60,12 @@ def subcommand_disable(_):
action_utils.service_disable('transmission-daemon')
def subcommand_get_configuration(_):
"""Return the current configuration in JSON format."""
configuration = open(TRANSMISSION_CONFIG, 'r').read()
print(configuration)
def subcommand_merge_configuration(arguments):
"""Merge given JSON configuration with existing configuration."""
configuration = sys.stdin.read()