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

Misuse of the read method of Win32::Registry Class

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: reboot
    • Labels:
    • Environment:

      Puppet agent 3.8.2

    • Template:
    • Story Points:
      2
    • Sprint:
      Windows 2015-12-02

      Description

      The read method of Win32::Registry class actually returns a [type, data] array if the value exists, but it's used as if it returns just the data in methods like package_installer?, pending_computer_rename?.

      In most cases, there is no problem with it because the detecting result is determined by whether the registry value exists or not, not by the data. But it's probably cause trouble sometimes. Unit tests didn't catch this since the return value is mocked as data, not [type, data]...

        def reg_value(path, value)
          rval = nil
       
          with_key(path) do |reg|
            rval = reg.read(value)
          end
       
          rval
        end
      

      The same problem in pending_rename_operations?.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              digglife Eric Zhu
              QA Contact:
              Ryan Gard
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support