From c9326d224b25848a114bba21b3976e93180be07e Mon Sep 17 00:00:00 2001 From: Sylvain Pineau Date: Wed, 21 Feb 2018 18:33:13 +0100 Subject: removable_storage_test: Call udisks2.udisksctl on ubuntu core only --- bin/removable_storage_test | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bin/removable_storage_test b/bin/removable_storage_test index ddd4e1b..42e197a 100755 --- a/bin/removable_storage_test +++ b/bin/removable_storage_test @@ -99,6 +99,20 @@ def md5_hash_file(path): return md5.hexdigest() +def on_ubuntucore(): + """ + Check if running from on ubuntu core + """ + snap = os.getenv("SNAP") + if snap: + with open(os.path.join(snap, 'meta/snap.yaml')) as f: + for l in f.readlines(): + if l == "confinement: classic\n": + return False + return True + return False + + class DiskTest(): ''' Class to contain various methods for testing removable disks ''' @@ -177,7 +191,7 @@ class DiskTest(): Indirectly sets: self.rem_disks{,_nm,_memory_cards,_memory_cards_nm,_speed} """ - if "SNAP" in os.environ: + if on_ubuntucore(): self._probe_disks_udisks2_cli() else: bus, loop = connect_to_system_bus() -- cgit v1.2.3