← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1687712] [NEW] cc_disk_setup: fs_setup with cmd doesn't work

 

Public bug reported:

This reproduces on Azure, but it should fail similarly elsewhere.
Consider repro.yml:

#cloud-config
fs_setup:
    - special:
      cmd: mkfs -t %(filesystem)s -L %(label)s %(device)s
      filesystem: ext4
      device: /dev/sdb1
      label: repro

Create a VM with this cloud config: 
$ az vm create -g $rg -l westus2 --custom-data @repro.yml --image UbuntuLTS -n repro2

Then cloud-init will fail with:
Failed to exec of 'mkfs -t ext4 -L repro /dev/sdb1':
Unexpected error while running command.
Command: mkfs -t ext4 -L repro /dev/sdb1
Exit code: -
Reason: [Errno 2] No such file or directory: 'mkfs -t ext4 -L repro /dev/sdb1'

$ dpkg-query -W -f='${Version}' cloud-init
0.7.9-48-g1c795b9-0ubuntu1~16.04.1

Bug is in mkfs() in cc_disk_setup.py, which creates a shell-like string
in the case that cmd was specified and a exec-like array in the other
case (around line 913).

** Affects: cloud-init
     Importance: Undecided
         Status: New

** Attachment added: "cloud-init.tar"
   https://bugs.launchpad.net/bugs/1687712/+attachment/4870947/+files/cloud-init.tar

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1687712

Title:
  cc_disk_setup: fs_setup with cmd doesn't work

Status in cloud-init:
  New

Bug description:
  This reproduces on Azure, but it should fail similarly elsewhere.
  Consider repro.yml:

  #cloud-config
  fs_setup:
      - special:
        cmd: mkfs -t %(filesystem)s -L %(label)s %(device)s
        filesystem: ext4
        device: /dev/sdb1
        label: repro

  Create a VM with this cloud config: 
  $ az vm create -g $rg -l westus2 --custom-data @repro.yml --image UbuntuLTS -n repro2

  Then cloud-init will fail with:
  Failed to exec of 'mkfs -t ext4 -L repro /dev/sdb1':
  Unexpected error while running command.
  Command: mkfs -t ext4 -L repro /dev/sdb1
  Exit code: -
  Reason: [Errno 2] No such file or directory: 'mkfs -t ext4 -L repro /dev/sdb1'

  $ dpkg-query -W -f='${Version}' cloud-init
  0.7.9-48-g1c795b9-0ubuntu1~16.04.1

  Bug is in mkfs() in cc_disk_setup.py, which creates a shell-like
  string in the case that cmd was specified and a exec-like array in the
  other case (around line 913).

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1687712/+subscriptions


Follow ups