forem/selfhost

fcos_extraction_location is not created before extracting into it

djuber opened this issue · 3 comments

Describe the bug

When installing for QEMU/libvirt on linux.

The fcos_extraction_location defaults to "$HOME/.local/share/libvirt/images".

If this directory does not exist, the "Stat FCOS extract file" step does not fail (shows ok: [forem]), the Extract FCOS image with xz setup fails (because nothing creates the location if it does not exist)

TASK [fcos : Extract FCOS file to $HOME/.local/share/libvirt/images with xz] ****************************
fatal: [forem]: FAILED! => changed=true 
  cmd: xz --decompress -k /home/djuber/src/selfhost/playbooks/providers/images/fedora-coreos-34.20210725.3.0-qemu.x86_64.qcow2.xz -c > $HOME/.local/share/libvirt/images/fedora-coreos-34.20210725.3.0-qemu.x86_64.qcow2
  delta: '0:00:00.001628'
  end: '2021-08-20 11:05:44.692859'
  msg: non-zero return code
  rc: 2
  start: '2021-08-20 11:05:44.691231'
  stderr: '/bin/sh: 1: cannot create /home/djuber/.local/share/libvirt/images/fedora-coreos-34.20210725.3.0-qemu.x86_64.qcow2: Directory nonexistent'
  stderr_lines: <omitted>
  stdout: ''
  stdout_lines: <omitted>

To Reproduce
Steps to reproduce the behavior:

  1. rm -rf $HOME/.local/share/libvirt/images - if there is anything you care about in there, maybe mv instead of rm :)
  2. run the qemu install playbook ansible-playbook -i inventory/forem/setup.yml playbooks/providers/qemu.yml
  3. observe the failure on the above step

Expected behavior

The fcos_extract_location directory is checked for existence, and either an earlier error with instructions to create the directory, or automatic directory creation occurs when it's not there.

Screenshots
If applicable, add screenshots to help explain your problem.

OS (please complete the following information):

  • Linux

Cloud Provider (please complete the following information):

  • Other: QEMU/libvirt

Yep I can confirm that this happened to me on Ubuntu 22.04 LTS