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
1diff --git a/qabro/__init__.py b/qabro/__init__.py
2index 83c6b75..b0bcdb3 100644
3--- a/qabro/__init__.py
4+++ b/qabro/__init__.py
5@@ -7,21 +7,25 @@ from bug_assistant import BugAssistant
6 from ui import ReportScreen
7
8 def main():
9- snap_name = os.getenv('SNAP_NAME')
10- code = subprocess.call('snap list {} | grep devmode'.format(snap_name),
11- stdout=subprocess.PIPE,
12- stderr=subprocess.PIPE,
13- shell=True
14- )
15- if code == 0:
16- logfile = os.path.join(os.getenv('SNAP_USER_COMMON'), 'qabro.log')
17- logging.basicConfig(filename=logfile,
18- format='%(asctime)s - %(levelname)s - %(message)s',
19- level=logging.ERROR
20- )
21- start_ui()
22+ if os.getenv('SUDO_USER'):
23+ sys.exit(("This tool does not need to be run as super user. "
24+ "Please run it again without `sudo`."))
25 else:
26- sys.exit("This tool requires --devmode option to run properly.")
27+ snap_name = os.getenv('SNAP_NAME', 'qabro')
28+ code = subprocess.call('snap list {} | grep devmode'.format(snap_name),
29+ stdout=subprocess.PIPE,
30+ stderr=subprocess.PIPE,
31+ shell=True
32+ )
33+ if code == 0:
34+ logfile = os.path.join(os.getenv('SNAP_USER_COMMON', '/tmp'), 'qabro.log')
35+ logging.basicConfig(filename=logfile,
36+ format='%(asctime)s - %(levelname)s - %(message)s',
37+ level=logging.ERROR
38+ )
39+ start_ui()
40+ else:
41+ sys.exit("This tool requires --devmode option to run properly.")
42
43 def start_ui():
44 ui = ReportScreen()

Subscribers

People subscribed via source and target branches

to all changes: