Merge ~bladernr/plainbox-provider-checkbox:1876966-removable_storage_test-run-as-root into plainbox-provider-checkbox:master

Proposed by Jeff Lane 
Status: Merged
Approved by: Sylvain Pineau
Approved revision: 3895995b320c206d11f1300dbb238ef45bb73d0a
Merged at revision: fa65d1e478dd432044e7e024fdfa0f5667cf207f
Proposed branch: ~bladernr/plainbox-provider-checkbox:1876966-removable_storage_test-run-as-root
Merge into: plainbox-provider-checkbox:master
Diff against target: 16 lines (+5/-0)
1 file modified
bin/removable_storage_test (+5/-0)
Reviewer Review Type Date Requested Status
Sylvain Pineau (community) Approve
Review via email: mp+383451@code.launchpad.net

Commit message

LP:1876966 - bin/removable_storage_test: added UID check to ensure it's only run as root.

Description of the change

LP:1876966 - bin/removable_storage_test: added UID check to ensure it's only run as root.

To post a comment you must log in.
Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

+1 (even if all jobs using this script are user: root already)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/removable_storage_test b/bin/removable_storage_test
2index bbace30..67c92fd 100755
3--- a/bin/removable_storage_test
4+++ b/bin/removable_storage_test
5@@ -617,6 +617,11 @@ def main():
6
7 test = DiskTest(args.device, args.memorycard, args.lsblkcommand)
8
9+ # LP:1876966
10+ if os.getuid() != 0:
11+ print("ERROR: This script must be run as root!")
12+ return 1
13+
14 errors = 0
15 # If we do have removable drives attached and mounted
16 if len(test.rem_disks) > 0 or len(test.rem_disks_nm) > 0:

Subscribers

People subscribed via source and target branches