Skip to content
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

[BUG] LGPO_REG: Can't update entry if existing entry name contains new name #64401

Closed
twangboy opened this issue Jun 1, 2023 · 0 comments · Fixed by #64402
Closed

[BUG] LGPO_REG: Can't update entry if existing entry name contains new name #64401

twangboy opened this issue Jun 1, 2023 · 0 comments · Fixed by #64402
Assignees
Labels
Bug broken, incorrect, or confusing behavior Execution-Module State-Module Windows

Comments

@twangboy
Copy link
Contributor

twangboy commented Jun 1, 2023

Description
If a policy setting exists in Registry.pol in the same key that contains the name of the new setting it will overwrite the existing setting.

Setup
state.sls

set_update_notification_level:
  lgpo_reg.value_present:
    - key: SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
    - name: SetUpdateNotificationLevel
    - v_type: REG_DWORD
    - v_data: 1
    - policy_class: Machine

update_notification_level:
  lgpo_reg.value_present:
    - key: SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
    - name: UpdateNotificationLevel
    - v_type: REG_DWORD
    - v_data: 0
    - policy_class: Machine

no_update_notifications_during_active_hours:
  lgpo_reg.value_disabled:
    - key: SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate
    - name: NoUpdateNotificationsDuringActiveHours
    - policy_class: Machine

Steps to Reproduce the behavior
Apply the above state

salt-call --local state.apply state

Expected behavior
I would expect the following in the Registry.pol file:

(venv) PS C:\src\salt> salt-call --local lgpo_reg.read_reg_pol Machine
local:
    ----------
    SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate:
        ----------
        **del.NoUpdateNotificationsDuringActiveHours:
            ----------
            data:

            type:
                REG_SZ
        SetUpdateNotificationLevel:
            ----------
            data:
                1
            type:
                REG_DWORD
        UpdateNotificationLevel:
            ----------
            data:
                0
            type:
                REG_DWORD

Screenshots
Instead I get this:

(venv) PS C:\src\salt> salt-call --local lgpo_reg.read_reg_pol Machine
local:
    ----------
    SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate:
        ----------
        **del.NoUpdateNotificationsDuringActiveHours:
            ----------
            data:

            type:
                REG_SZ
        SetUpdateNotificationLevel:
            ----------
            data:
                0
            type:
                REG_DWORD

Because the SetUpdateNotificationLevel contains the word UpdateNotificationLevel

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
local:
    Salt Version:
              Salt: 3006.0+232.g692447efeb

    Python Version:
            Python: 3.10.9 (tags/v3.10.9:1dd9be6, Dec  6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]

    Dependency Versions:
              cffi: 1.14.6
          cherrypy: 18.6.1
          dateutil: 2.8.1
         docker-py: Not Installed
             gitdb: 4.0.7
         gitpython: 3.1.30
            Jinja2: 3.1.2
           libgit2: Not Installed
      looseversion: 1.0.2
          M2Crypto: Not Installed
              Mako: Not Installed
           msgpack: 1.0.2
      msgpack-pure: Not Installed
      mysql-python: Not Installed
         packaging: 22.0
         pycparser: 2.21
          pycrypto: Not Installed
      pycryptodome: 3.10.1
            pygit2: Not Installed
      python-gnupg: 0.4.8
            PyYAML: 5.4.1
             PyZMQ: 25.0.2
            relenv: Not Installed
             smmap: 4.0.0
           timelib: 0.2.4
           Tornado: 4.5.3
               ZMQ: 4.3.4

    System Versions:
              dist:
            locale: cp1252
           machine: AMD64
           release: 10
            system: Windows
           version: 10 10.0.22621 SP0 Multiprocessor Free```
</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module State-Module Windows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant