diff -Nru tt-bandwidth-manager-gui-0.3.4~ubuntu18.04.1/debian/changelog tt-bandwidth-manager-gui-0.3.5~ubuntu18.04.1/debian/changelog --- tt-bandwidth-manager-gui-0.3.4~ubuntu18.04.1/debian/changelog 2021-01-12 12:02:14.000000000 +0000 +++ tt-bandwidth-manager-gui-0.3.5~ubuntu18.04.1/debian/changelog 2021-01-13 14:17:21.000000000 +0000 @@ -1,8 +1,15 @@ -tt-bandwidth-manager-gui (0.3.4~ubuntu18.04.1) bionic; urgency=low +tt-bandwidth-manager-gui (0.3.5~ubuntu18.04.1) bionic; urgency=low * Auto build. - -- Nate Tue, 12 Jan 2021 12:02:14 +0000 + -- Nate Wed, 13 Jan 2021 14:17:21 +0000 + +tt-bandwidth-manager-gui (0.3.5) focal; urgency=medium + + * Fix missing timestamp when 'systemctl show' returns an error. + * Show return codes for subprocess commands. + + -- Nate Marti Wed, 13 Jan 2021 14:58:14 +0100 tt-bandwidth-manager-gui (0.3.4) focal; urgency=medium diff -Nru tt-bandwidth-manager-gui-0.3.4~ubuntu18.04.1/debian/git-build-recipe.manifest tt-bandwidth-manager-gui-0.3.5~ubuntu18.04.1/debian/git-build-recipe.manifest --- tt-bandwidth-manager-gui-0.3.4~ubuntu18.04.1/debian/git-build-recipe.manifest 2021-01-12 12:02:14.000000000 +0000 +++ tt-bandwidth-manager-gui-0.3.5~ubuntu18.04.1/debian/git-build-recipe.manifest 2021-01-13 14:17:21.000000000 +0000 @@ -1,2 +1,2 @@ # git-build-recipe format 0.4 deb-version {debversion} -lp:tt-bandwidth-manager-gui git-commit:4fb609b22e058fc82cbbc623ab6a648cf4281dee +lp:tt-bandwidth-manager-gui git-commit:5ad59c0377d940deedecab47753838034d47d61d diff -Nru tt-bandwidth-manager-gui-0.3.4~ubuntu18.04.1/trafficcop/app.py tt-bandwidth-manager-gui-0.3.5~ubuntu18.04.1/trafficcop/app.py --- tt-bandwidth-manager-gui-0.3.4~ubuntu18.04.1/trafficcop/app.py 2021-01-12 12:02:14.000000000 +0000 +++ tt-bandwidth-manager-gui-0.3.5~ubuntu18.04.1/trafficcop/app.py 2021-01-13 14:17:21.000000000 +0000 @@ -161,19 +161,17 @@ "--no-pager", ] status_output = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + utils.print_result(cmd, status_output) if status_output.returncode != 0: # Status output error. Probably due to kernel incompatibility after update. # Fall back to trying "systemctl status" command instead. self.unit_file_state = 'unknown' self.active_state = 'unknown' self.svc_start_time = 'unknown' - cmd = [ - "systemctl", - "status", - "tt-bandwidth-manager.service", - "--no-pager", - ] + cmd.pop(1) + cmd.insert(1, "status") status_output = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + utils.print_result(cmd, status_output) output_list = status_output.stdout.decode().splitlines() #print(output_list) upat = '\s+Loaded: loaded \(/etc/systemd/system/tt-bandwidth-manager.service; (.*);.*' @@ -296,19 +294,22 @@ def stop_service(self): cmd = ["systemctl", "stop", "tt-bandwidth-manager.service"] - subprocess.run(cmd) + result = subprocess.run(cmd) + utils.print_result(cmd, result) self.update_info_widgets() def start_service(self): cmd = ["systemctl", "start", "tt-bandwidth-manager.service"] - subprocess.run(cmd) + result = subprocess.run(cmd) + utils.print_result(cmd, result) self.tt_pid, self.tt_start, self.tt_dev = utils.wait_for_tt_start() self.update_info_widgets() self.treeview_config = self.update_treeview_config() def restart_service(self): cmd = ["systemctl", "restart", "tt-bandwidth-manager.service"] - subprocess.run(cmd) + result = subprocess.run(cmd) + utils.print_result(cmd, result) self.tt_pid, self.tt_start, self.tt_dev = utils.wait_for_tt_start() # Check service status and update widgets. self.update_info_widgets() diff -Nru tt-bandwidth-manager-gui-0.3.4~ubuntu18.04.1/trafficcop/utils.py tt-bandwidth-manager-gui-0.3.5~ubuntu18.04.1/trafficcop/utils.py --- tt-bandwidth-manager-gui-0.3.4~ubuntu18.04.1/trafficcop/utils.py 2021-01-12 12:02:14.000000000 +0000 +++ tt-bandwidth-manager-gui-0.3.5~ubuntu18.04.1/trafficcop/utils.py 2021-01-13 14:17:21.000000000 +0000 @@ -21,6 +21,9 @@ output = func(*args, **kwargs) return output +def print_result(cmd, result): + print(f"'{' '.join(cmd)}' -> {result.returncode}") + def get_net_device(): ''' Return the gateway internet device. diff -Nru tt-bandwidth-manager-gui-0.3.4~ubuntu18.04.1/trafficcop/worker.py tt-bandwidth-manager-gui-0.3.5~ubuntu18.04.1/trafficcop/worker.py --- tt-bandwidth-manager-gui-0.3.4~ubuntu18.04.1/trafficcop/worker.py 2021-01-12 12:02:14.000000000 +0000 +++ tt-bandwidth-manager-gui-0.3.5~ubuntu18.04.1/trafficcop/worker.py 2021-01-13 14:17:21.000000000 +0000 @@ -28,17 +28,19 @@ "--no-pager", "--since=\'" + app.app.svc_start_time + "\'", ] + if app.app.svc_start_time == 'unknown': + # Likely due to a kernel/systemd incompatibility. + cmd.pop() # to remove the "--since" option cmd_txt = " ".join(cmd) - subprocess.run(cmd_txt, shell=True) + result = subprocess.run(cmd_txt, shell=True) + print(f"{cmd} -> {result.returncode}") return def handle_button_config_clicked(): # Open config file in gedit. - subprocess.run( - ["gedit", "/etc/tt-config.yaml"], - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - ) + cmd = ["gedit", "/etc/tt-config.yaml"] + result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + utils.print_result(cmd, result) def handle_config_changed(): pass