summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYour Name <you@example.com>2014-10-10 10:56:52 +0000
committerYour Name <you@example.com>2014-11-07 12:07:17 +0000
commit53d6debe875d6011e49cd9cbd1d4e46dd81c5d42 (patch)
treeb53f429794a7ea78b2c3dee8a0428e40549c10f2
parent6779e46e880eec757a6923441accef2442007677 (diff)
downloadmorph-53d6debe875d6011e49cd9cbd1d4e46dd81c5d42.tar.gz
Add location detection to check if it's a drive
-rw-r--r--morphlib/writeexts.py7
1 files changed, 6 insertions, 1 deletions
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