summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_growpart.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-03-04 23:18:37 -0500
committerScott Moser <smoser@ubuntu.com>2013-03-04 23:18:37 -0500
commitb25c943ac22d457891cd6cfa240ca83aa03e4542 (patch)
tree570e8834f578e85af6ee3f517c6965cca6180933 /cloudinit/config/cc_growpart.py
parentab73a5a7befb9583a9b2cee35fa99e363793c116 (diff)
downloadvyos-cloud-init-b25c943ac22d457891cd6cfa240ca83aa03e4542.tar.gz
vyos-cloud-init-b25c943ac22d457891cd6cfa240ca83aa03e4542.zip
test of resize, a couple small fixes
Diffstat (limited to 'cloudinit/config/cc_growpart.py')
-rw-r--r--cloudinit/config/cc_growpart.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py
index d49159ed..96e72350 100644
--- a/cloudinit/config/cc_growpart.py
+++ b/cloudinit/config/cc_growpart.py
@@ -17,6 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os.path
+import os
import re
import stat
@@ -152,9 +153,16 @@ def resize(resizer, devices, log):
log.debug("unable to turn %s into device: %s" % (devent, e))
continue
- if not stat.S_ISBLK(os.stat(blockdev).st_mode):
+ try:
+ statret = os.stat(blockdev)
+ except OSError as e:
+ log.debug("device '%s' for '%s' failed stat" %
+ (blockdev, devent))
+ continue
+
+ if not stat.S_ISBLK(statret.st_mode):
log.debug("device '%s' for '%s' is not a block device" %
- (devent, blockdev))
+ (blockdev, devent))
continue
try: