deluge: Support deluge 2 by starting it properly

deluge-web 1.x runs in the foreground by default and provides an option -f to
fork in the background where as deluge-web 2.x by default forks into the
background and provides option --do-no-daemonize for running in foreground.
Update systemd service to ensure that option is passed appropriately based on
the version of daemon running.

Update functional tests to accommodate UI changes in deluge-web 2.x.

Closes: #1652.

Tests:

- Install deluge 1.x by having testing in apt sources.list. Ensure that the
  daemon is working. Run functional tests.

- Upgrade deluge to 2.x by changing the sources.list and upgrading. Ensure that
  daemon is working after disable/enable. Run functional tests.

- Install deluge 2.x by having unstable in apt sources.list. Ensure that daemon
  is working. Run functional tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-10-02 23:28:19 -07:00 committed by James Valleroy
parent 5b45e3859a
commit b72021782e
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 25 additions and 20 deletions

View File

@ -37,7 +37,7 @@ Documentation=man:deluge-web(1)
After=network.target
[Service]
ExecStart=/usr/bin/deluge-web --base=deluge
ExecStart=bash -c "/usr/bin/deluge-web --base=deluge $(/usr/bin/deluge-web --version | grep deluge-web | cut -f2 -d' ' | grep -q '^1.' && echo '' || echo '--do-not-daemonize')"
Restart=on-failure
User=debian-deluged
Group=debian-deluged
@ -60,11 +60,10 @@ def parse_arguments():
def subcommand_setup(_):
"""Perform initial setup for deluge-web."""
if not os.path.isfile(SYSTEMD_SERVICE_PATH):
with open(SYSTEMD_SERVICE_PATH, 'w') as file_handle:
file_handle.write(SYSTEMD_SERVICE)
with open(SYSTEMD_SERVICE_PATH, 'w') as file_handle:
file_handle.write(SYSTEMD_SERVICE)
subprocess.check_call(['systemctl', 'daemon-reload'])
subprocess.check_call(['systemctl', 'daemon-reload'])
def main():

View File

@ -350,7 +350,8 @@ def _deluge_ensure_daemon_started(browser):
"""Start the deluge daemon if it is not started."""
_deluge_open_connection_manager(browser)
browser.find_by_xpath('//em[text()="127.0.0.1:58846"]').first.click()
browser.find_by_xpath(
'//em[contains(text(),"127.0.0.1:58846")]').first.click()
if browser.is_element_present_by_xpath('//button[text()="Stop Daemon"]'):
return
@ -433,22 +434,27 @@ def deluge_upload_sample_torrent(browser):
eventually(
lambda: _deluge_get_active_window_title(browser) == 'Add Torrents')
browser.find_by_css('button.x-deluge-add-file').first.click()
# Add from file window appears
eventually(
lambda: _deluge_get_active_window_title(browser) == 'Add from File')
# Attach file
file_path = os.path.join(
os.path.dirname(__file__), '..', 'data', 'sample.torrent')
browser.attach_file('file', file_path)
# Click Add
_deluge_click_active_window_button(browser, 'Add')
if browser.find_by_id('fileUploadForm'): # deluge-web 2.x
browser.attach_file('file', file_path)
else: # deluge-web 1.x
browser.find_by_css('button.x-deluge-add-file').first.click()
eventually(
lambda: _deluge_get_active_window_title(browser) == 'Add Torrents')
# Add from file window appears
eventually(
lambda: _deluge_get_active_window_title(browser) == 'Add from File'
)
# Attach file
browser.attach_file('file', file_path)
# Click Add
_deluge_click_active_window_button(browser, 'Add')
eventually(
lambda: _deluge_get_active_window_title(browser) == 'Add Torrents')
# Click Add
time.sleep(1)

View File

@ -28,9 +28,9 @@ from plinth.modules.apache.components import Webserver
from plinth.modules.firewall.components import Firewall
from plinth.modules.users import register_group
from .manifest import backup, clients # noqa, pylint: disable=unused-import
from .manifest import backup, clients # noqa, pylint: disable=unused-import
version = 2
version = 3
managed_services = ['deluge-web']