This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a commit to branch DATALAB-2091
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit 20fb1d0a6562941c20b3752da41e21a6389b319d
Author: leonidfrolov <[email protected]>
AuthorDate: Fri Apr 30 17:23:59 2021 +0300

    [DATALAB-2091]: added handling of "/dev/sdc1 is apparently in use by the 
system; will not make a filesystem here!"
---
 infrastructure-provisioning/src/general/lib/azure/actions_lib.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/infrastructure-provisioning/src/general/lib/azure/actions_lib.py 
b/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
index 0143029..6103f80 100644
--- a/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/azure/actions_lib.py
@@ -1266,7 +1266,14 @@ def prepare_disk(os_user):
                         counter += 1
                         time.sleep(5)
             datalab.fab.conn.sudo('umount -l /dev/{}1'.format(disk_name), 
warn=True)
-            datalab.fab.conn.sudo('mkfs.ext4 -F /dev/{}1'.format(disk_name))
+            try:
+                datalab.fab.conn.sudo('mkfs.ext4 -F 
/dev/{}1'.format(disk_name))
+            except:
+                out = datalab.fab.conn.sudo('mount -l | grep 
/dev/{}1'.format(disk_name)).stdout
+                if 'type ext4' in out:
+                    pass
+                else:
+                    sys.exit(1)
             datalab.fab.conn.sudo('mount /dev/{}1 /opt/'.format(disk_name))
             datalab.fab.conn.sudo(''' bash -c "echo '/dev/{}1 /opt/ ext4 
errors=remount-ro 0 1' >> /etc/fstab" '''.format(
                 disk_name))

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to