diff options
author | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-10-10 10:56:52 +0000 |
---|---|---|
committer | Pedro Alvarez <pedro.alvarez@codethink.co.uk> | 2014-11-10 10:57:00 +0000 |
commit | 1e0ce31061f0e366822e82f1818280020c8bc46d (patch) | |
tree | 31d10e4ed30c9cb4bbb430b9b5cd7839711c9429 | |
parent | 6779e46e880eec757a6923441accef2442007677 (diff) | |
download | morph-1e0ce31061f0e366822e82f1818280020c8bc46d.tar.gz |
Add 'is_device' function to check if we are deploying to a device
-rw-r--r-- | morphlib/writeexts.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py index 0fd0ad7b..c78fe09e 100644 --- a/morphlib/writeexts.py +++ b/morphlib/writeexts.py @@ -223,7 +223,7 @@ class WriteExtension(cliapp.Application): def mkfs_btrfs(self, location): '''Create a btrfs filesystem on the disk.''' - self.status(msg='Creating btrfs filesystem') + self.status(msg='Creating btrfs filesystem in %s' % location) cliapp.runcmd(['mkfs.btrfs', '-L', 'baserock', location]) def get_uuid(self, location): @@ -572,3 +572,8 @@ class WriteExtension(cliapp.Application): logging.error("Error checking SSH connectivity: %s", str(e)) raise cliapp.AppException( 'Unable to SSH to %s: %s' % (ssh_host, e)) + def is_device(self, location): + dev_regex = re.compile("^/dev/((sd|vd|mmcblk|hd)[a-z0-9]+)$") + if dev_regex.match(location): + return True + return False |