summaryrefslogtreecommitdiff
diff options
authorSylvain Pineau <sylvain.pineau@canonical.com>2018-02-21 18:33:13 +0100
committerSylvain Pineau <sylvain.pineau@canonical.com>2018-02-22 15:00:30 +0100
commitc9326d224b25848a114bba21b3976e93180be07e (patch)
tree58904f29287dc68bfe07da9830a946238b9789e2
parent3433097891c4c34070682a33a80aed2e1d23afe5 (diff)
removable_storage_test: Call udisks2.udisksctl on ubuntu core only
-rwxr-xr-xbin/removable_storage_test16
1 files changed, 15 insertions, 1 deletions
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()