New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ISO mounting support on Windows to core #7824

gsreynolds opened this Issue Oct 31, 2018 · 1 comment


3 participants

gsreynolds commented Oct 31, 2018

Mounting ISOs on Windows is a semi-regularly requested feature for certain specific use cases. IMHO options are:

  1. extend the mount resource by adding a file property and adding support to the windows provider using the Mount-DiskImage cmdlet
  2. extend the mount resource by using the existing device property and in the windows provider matching on the file extension (e.g. ^.*\.iso$) to switch behaviour to use Mount-DiskImage cmdlet
  3. have a specific windows_mount_iso resource separately and not extend mount

I'd tend towards option 2 as it's already possible to mount ISOs in *nix-land using the mount resource and the device property:

  mount '/mnt' do
    device 'test.iso'
    options 'loop'
    action :mount

I've created a quick custom resource modelled after the mount resource to do this:

  windows_mount_iso 'Z:' do
    device 'test.iso'
    action :mount

One thing to note is that the Mount-DiskImage cmdlet can't specify a drive letter to mount as, so needs to be mounted and then the drive letter can be changed in two steps.

If we go for option 3, there's an argument for making the ISO source the name property and the drive letter a property instead for semantics as the following isn't that descriptive:

         * remote_file[test.iso] action create (up to date)
         * windows_mount_iso[Z:] action mount

This comment has been minimized.


stuartpreston commented Nov 2, 2018

@gsreynolds As per discussion, it would be good to make this generic and support VHD images (as the underlying PowerShell cmdlet does). Despite the semantics of the mount resource I think we should call this windows_mount_image, the name_property should be the image and we should take a drive_letter property too. We'd end up with something like:

windows_mount_image '\\mysmbshare\images\myiso.iso' do
  drive_letter 'Z:'
  access_mode :read_only
  action :mount

There may also be some user-mode restrictions to look at here (e.g. assigning a drive letter when you don't have an interactive session might cause some troubles). Let's have a go with your custom resource and then we can look at bringing that in to core with Chef 15. Thanks!

@tas50 tas50 added this to To do in New Resources in Core via automation Nov 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment