Merge ~pieq/bugit/+git/qabro:no-sudo-needed into bugit:master

Proposed by Pierre Equoy
Status: Merged
Approved by: Pierre Equoy
Approved revision: f69f9d7d857e1a63639466de19074e20384a3c43
Merged at revision: ddcbfba9239ea35f5eafb6399f8974bd83f6cdf9
Proposed branch: ~pieq/bugit/+git/qabro:no-sudo-needed
Merge into: bugit:master
Diff against target: 44 lines (+18/-14)
1 file modified
qabro/__init__.py (+18/-14)
Reviewer Review Type Date Requested Status
Maciej Kisielewski (community) Needs Fixing
Pierre Equoy Approve
Review via email: mp+349029@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Pierre Equoy (pieq) wrote :

Self-approved

review: Approve
Revision history for this message
Maciej Kisielewski (kissiel) wrote :

This is a non-trivial patch that got self-approved the same day it got proposed. And it's hard for me to see the reason to rush it that hard, especially when I consider it being of sub-perfect quality. See diff comments for details.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/qabro/__init__.py b/qabro/__init__.py
index 83c6b75..b0bcdb3 100644
--- a/qabro/__init__.py
+++ b/qabro/__init__.py
@@ -7,21 +7,25 @@ from bug_assistant import BugAssistant
7from ui import ReportScreen7from ui import ReportScreen
88
9def main():9def main():
10 snap_name = os.getenv('SNAP_NAME')10 if os.getenv('SUDO_USER'):
11 code = subprocess.call('snap list {} | grep devmode'.format(snap_name),11 sys.exit(("This tool does not need to be run as super user. "
12 stdout=subprocess.PIPE,12 "Please run it again without `sudo`."))
13 stderr=subprocess.PIPE,
14 shell=True
15 )
16 if code == 0:
17 logfile = os.path.join(os.getenv('SNAP_USER_COMMON'), 'qabro.log')
18 logging.basicConfig(filename=logfile,
19 format='%(asctime)s - %(levelname)s - %(message)s',
20 level=logging.ERROR
21 )
22 start_ui()
23 else:13 else:
24 sys.exit("This tool requires --devmode option to run properly.")14 snap_name = os.getenv('SNAP_NAME', 'qabro')
15 code = subprocess.call('snap list {} | grep devmode'.format(snap_name),
16 stdout=subprocess.PIPE,
17 stderr=subprocess.PIPE,
18 shell=True
19 )
20 if code == 0:
21 logfile = os.path.join(os.getenv('SNAP_USER_COMMON', '/tmp'), 'qabro.log')
22 logging.basicConfig(filename=logfile,
23 format='%(asctime)s - %(levelname)s - %(message)s',
24 level=logging.ERROR
25 )
26 start_ui()
27 else:
28 sys.exit("This tool requires --devmode option to run properly.")
2529
26def start_ui():30def start_ui():
27 ui = ReportScreen()31 ui = ReportScreen()

Subscribers

People subscribed via source and target branches

to all changes: