Uploaded image for project: 'Modules'
  1. Modules
  2. MODULES-8439

puppetlabs-sqlserver : sqlserver_instances fact fails when registry contains uninstalled instances

    XMLWordPrintable

Details

    • Hide

      If a node has had a sql instance installed in the past that has since been uninstalled, the module should be confused. It should properly detect the current installed/uninstalled state of any instances on the machine, and should throw errors if the registry is in the described state.

      Show
      If a node has had a sql instance installed in the past that has since been uninstalled, the module should be confused. It should properly detect the current installed/uninstalled state of any instances on the machine, and should throw errors if the registry is in the described state.
    • Windows
    • Customer Feedback
    • 33215
    • 1
    • Needs Assessment

    Description

      Basic Info
      Module Version: puppetlabs-sqlserver 2.2.0
      Puppet Version: 6.0.1
      OS Name/Version: Windows 2012R2 server

      When the sqlserver_instances fact resolves, one of the first things it does is check for values in HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\Instance Names.  It then iterates through these names to find other registry keys containing the version of each instance.

      See code here: https://github.com/puppetlabs/puppetlabs-sqlserver/blob/master/lib/puppet_x/sqlserver/features.rb#L75-L89

      Today I encountered an issue with a customer where an Instance name was present but the version key was missing:

      2019-01-06 14:55:09 -0500 Facter (err): error while resolving custom fact "sqlserver_instances": Failed to open registry key 'HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\MSRS11.@Sharepoint\MSSQLServer\CurrentVersion': The system cannot find the file specified.

      Still confirming, but I think uninstalling (or removing) an MSSQL instance leaves the registry in this state.

      Attaching a registry export that reproduces this problem

      Desired Behavior:

      If the key HKEY_LOCAL_MACHINE\Software\Microsoft\Microsoft SQL Server\<instance_name>\MSSQLServer\CurrentVersion doesn't exist we should assume that it isn't a valid instance and leave it out of the sqlserver_instances fact.

      Actual Behavior:

      The actual behavior is that you get the error above.

      Attachments

        Issue Links

          Activity

            People

              daniel.carabas Daniel Carabas
              erik.hansen Erik Hansen
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support