summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/config/cc_resizefs.py27
-rw-r--r--cloudinit/distros/debian.py7
2 files changed, 30 insertions, 4 deletions
diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py
index 51dead2f..b4ee16b2 100644
--- a/cloudinit/config/cc_resizefs.py
+++ b/cloudinit/config/cc_resizefs.py
@@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import errno
import os
import stat
import time
@@ -75,9 +76,29 @@ def handle(name, cfg, _cloud, log, args):
(devpth, fs_type, mount_point) = result
# Ensure the path is a block device.
- if not stat.S_ISBLK(os.stat(devpth).st_mode):
- log.debug("The %s device which was found for mount point %s for %s "
- "is not a block device" % (devpth, mount_point, resize_what))
+ info = "dev=%s mnt_point=%s path=%s" % (devpth, mount_point, resize_what)
+ log.debug("resize_info: %s" % info)
+
+ try:
+ statret = os.stat(devpth)
+ except OSError as exc:
+ if util.is_container() and exc.errno == errno.ENOENT:
+ log.debug("Device '%s' did not exist in container. "
+ "cannot resize: %s" % (devpth, info))
+ elif exc.errno == errno.ENOENT:
+ log.warn("Device '%s' did not exist. cannot resize: %s" %
+ (devpth, info))
+ else:
+ raise exc
+ return
+
+ if not stat.S_ISBLK(statret.st_mode):
+ if util.is_container():
+ log.debug("device '%s' not a block device in container."
+ " cannot resize: %s" % (devpth, info))
+ else:
+ log.warn("device '%s' not a block device. cannot resize: %s" %
+ (devpth, info))
return
resizer = None
diff --git a/cloudinit/distros/debian.py b/cloudinit/distros/debian.py
index 4b779d57..0811eefd 100644
--- a/cloudinit/distros/debian.py
+++ b/cloudinit/distros/debian.py
@@ -161,7 +161,12 @@ class Distro(distros.Distro):
elif args and isinstance(args, list):
cmd.extend(args)
- cmd.append(command)
+ subcmd = command
+ if command == "upgrade":
+ subcmd = self.get_option("apt_get_upgrade_subcommand",
+ "dist-upgrade")
+
+ cmd.append(subcmd)
pkglist = util.expand_package_list('%s=%s', pkgs)
cmd.extend(pkglist)