Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-6330

puppet uninstall exe resource fails on windows due to missing quotes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Incomplete
    • Affects Version/s: PUP 3.8.7
    • Fix Version/s: None
    • Component/s: Windows
    • Environment:

      Windows 8.1 client, server running on CentOS

    • Template:
    • Team:
      Platform OS

      Description

      Uninstalling exe-packages on windows fails under the following circumstances:

      a) Path for uninstall .exe-file contains spaces
      AND
      b) uninstall.exe needs an argument passed to it

      Reason seems to be the following section of puppet\lib\puppet\provider\package\windows\exe_package.rb

            # Only quote bare uninstall strings, e.g.
            #   C:\Program Files (x86)\Notepad++\uninstall.exe
            # Don't quote uninstall strings that are already quoted, e.g.
            #   "c:\ruby187\unins000.exe"
            # Don't quote uninstall strings that contain arguments:
            #   "C:\Program Files (x86)\Git\unins000.exe" /SILENT
            if uninstall_string =~ /\A[^"]*.exe\Z/i
              command << "\"#{uninstall_string}\""
            else
              command << uninstall_string
            end
      

      It is actually working properly, unfortunately the described case is simply not handled. The third option says not to add quotes, when an argument is passed. It should be: quote the exe-file and the argument seperately (in case the argument itself contains a space, see attached log.
      My ruby skills aren't good enough (=non existing) to solve it myself and create a pull request. Might be sufficient to add another if-clause checking for spaces in both argument and path to exe file.

      Here is an example error log from a puppet run:

      Info: Applying configuration version '1463728371'
      Debug: Prefetching windows resources for package
      Debug: Executing 'cmd.exe /c start "puppet-uninstall" /w C:\Program Files\MATLAB
      \R2015a\uninstall\bin\win64\uninstall.exe C:\Program Files\MATLAB\R2015a'
      Error: Failed to uninstall:  Unzulässige Funktion.
      Error: /Stage[main]/Main/Package[MATLAB R2015a]/ensure: change from 8.5 to absent failed: Failed to uninstall:  Unzulässige Funktion.
      Debug: Finishing transaction 43754680
      Debug: Storing state
      Debug: Stored state in 0.05 seconds
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            greifenstein Max Greifenstein
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support