diff options
| -rw-r--r-- | ChangeLog | 1 | ||||
| -rw-r--r-- | cloudinit/config/cc_resizefs.py | 16 | ||||
| -rw-r--r-- | cloudinit/distros/freebsd.py | 5 | ||||
| -rwxr-xr-x | tools/build-on-freebsd | 1 | 
4 files changed, 15 insertions, 8 deletions
| @@ -31,6 +31,7 @@   - Datasource: fix broken logic to provide hostname if datasource does not     provide one   - Improved and less verbose logging. + - resizefs: first check that device is writable.  0.7.5:   - open 0.7.5   - Add a debug log message around import failures diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py index b9655749..7e796228 100644 --- a/cloudinit/config/cc_resizefs.py +++ b/cloudinit/config/cc_resizefs.py @@ -98,12 +98,12 @@ def handle(name, cfg, _cloud, log, args):      (devpth, fs_type, mount_point) = result -    # Ensure the path is a block device.      info = "dev=%s mnt_point=%s path=%s" % (devpth, mount_point, resize_what)      log.debug("resize_info: %s" % info)      container = util.is_container() +    # Ensure the path is a block device.      if (devpth == "/dev/root" and not os.path.exists(devpth) and              not container):          devpth = rootdev_from_cmdline(util.get_cmdline()) @@ -117,14 +117,22 @@ def handle(name, cfg, _cloud, log, args):      except OSError as exc:          if container and exc.errno == errno.ENOENT:              log.debug("Device '%s' did not exist in container. " -                      "cannot resize: %s" % (devpth, info)) +                      "cannot resize: %s", devpth, info)          elif exc.errno == errno.ENOENT: -            log.warn("Device '%s' did not exist. cannot resize: %s" % -                     (devpth, info)) +            log.warn("Device '%s' did not exist. cannot resize: %s", +                     devpth, info)          else:              raise exc          return +    if not os.access(devpth, os.W_OK): +        if container: +            log.debug("'%s' not writable in container. cannot resize: %s", +                      devpth, info) +        else: +            log.warn("'%s' not writable. cannot resize: %s", devpth, info) +        return +      if not stat.S_ISBLK(statret.st_mode) and not stat.S_ISCHR(statret.st_mode):          if container:              log.debug("device '%s' not a block device in container." diff --git a/cloudinit/distros/freebsd.py b/cloudinit/distros/freebsd.py index 42ef2290..849834eb 100644 --- a/cloudinit/distros/freebsd.py +++ b/cloudinit/distros/freebsd.py @@ -37,6 +37,7 @@ class Distro(distros.Distro):      login_conf_fn = '/etc/login.conf'      login_conf_fn_bak = '/etc/login.conf.orig'      resolv_conf_fn = '/etc/resolv.conf' +    ci_sudoers_fn = '/usr/local/etc/sudoers.d/90-cloud-init-users'      def __init__(self, name, cfg, paths):          distros.Distro.__init__(self, name, cfg, paths) @@ -219,10 +220,6 @@ class Distro(distros.Distro):              util.logexc(LOG, "Failed to lock user %s", name)              raise e -    # TODO: -    def write_sudo_rules(self, name, rules, sudo_file=None): -        LOG.debug("[write_sudo_rules] Name: %s", name) -      def create_user(self, name, **kwargs):          self.add_user(name, **kwargs) diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index 23bdf487..65d783f7 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -17,6 +17,7 @@ pkgs="     py27-prettytable     py27-requests py27-six     python py27-cheetah +   py27-jsonpointer py27-jsonpatch  "  [ -f "$depschecked" ] || pkg install ${pkgs} || fail "install packages"  touch $depschecked | 
