From 53d6debe875d6011e49cd9cbd1d4e46dd81c5d42 Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 10 Oct 2014 10:56:52 +0000 Subject: Add location detection to check if it's a drive --- morphlib/writeexts.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py index 0fd0ad7b..d8a6aeb4 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 deploying_to_device(self, location): + dev_regex = re.compile("^/dev/((sd|vd|mmcblk|hd)[a-z0-9]+)$") + if dev_regex.match(location): + return true + return false -- cgit v1.2.1