summaryrefslogtreecommitdiff
path: root/cloudinit/config/cc_growpart.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/config/cc_growpart.py')
-rw-r--r--cloudinit/config/cc_growpart.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py
index 1d3a4412..b81951ad 100644
--- a/cloudinit/config/cc_growpart.py
+++ b/cloudinit/config/cc_growpart.py
@@ -113,9 +113,10 @@ class ResizeGrowPart(object):
return (before, get_size(partdev))
+
class ResizeGpart(object):
def available(self):
- if not os.path.exists('/usr/local/sbin/gpart'):
+ if not util.which('gpart'):
return False
return True
@@ -138,7 +139,7 @@ class ResizeGpart(object):
try:
util.subp(["gpart", "resize", "-i", partnum, diskdev])
except util.ProcessExecutionError as e:
- util.logexc(LOG, "Failed: gpart resize -i %s %s", partnum, diskdev)
+ util.logexc(LOG, "Failed: gpart resize -i %s %s", partnum, diskdev)
raise ResizeFailedException(e)
# Since growing the FS requires a reboot, make sure we reboot
@@ -147,6 +148,7 @@ class ResizeGpart(object):
return (before, get_size(partdev))
+
def get_size(filename):
fd = os.open(filename, os.O_RDONLY)
try: