Salt: Can't set default registry value in Windows (2018.3.0rc1)

Created on 5 Mar 2018  路  3Comments  路  Source: saltstack/salt

Description of Issue/Question

You can't set the default value of a registry key with salt.

Setup

Given the following state:

reg_default_value:
  reg.present:
    - name: 'HKLM\SOFTWARE\Salt'
    - vdata: Some data

Steps to Reproduce Issue

Apply the state with the following result:

          ID: reg_default_value
    Function: reg.present
        Name: HKLM\SOFTWARE\Salt
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "c:\salt\bin\lib\site-packages\salt\state.py", line 1876, in call
                  **cdata['kwargs'])
                File "c:\salt\bin\lib\site-packages\salt\loader.py", line 1823, in wrapper
                  return f(*args, **kwargs)
                File "c:\salt\bin\lib\site-packages\salt\states\reg.py", line 187, in present
                  use_32bit_registry=use_32bit_registry)
                File "c:\salt\bin\lib\site-packages\salt\modules\reg.py", line 367, in read_value
                  local_vname = _to_unicode(vname)
                File "c:\salt\bin\lib\site-packages\salt\modules\reg.py", line 86, in _to_unicode
                  return salt.utils.stringutils.to_unicode(vdata, 'utf-8')
                File "c:\salt\bin\lib\site-packages\salt\utils\stringutils.py", line 115, in to_unicode
                  raise TypeError('expected str or bytearray')
              TypeError: expected str or bytearray
     Started: 21:35:54.939000
    Duration: 0.0 ms
     Changes:

Versions Report

# salt -t 30 's*d' test.versions
slee_winsrv2016_build:
    Salt Version:
               Salt: 2018.3.0rc1

    Dependency Versions:
               cffi: 1.10.0
           cherrypy: Not Installed
           dateutil: 2.6.1
          docker-py: Not Installed
              gitdb: 2.0.3
          gitpython: 2.1.7
              ioflo: Not Installed
             Jinja2: 2.10
            libgit2: Not Installed
            libnacl: 1.6.1
           M2Crypto: Not Installed
               Mako: 1.0.7
       msgpack-pure: Not Installed
     msgpack-python: 0.4.8
       mysql-python: Not Installed
          pycparser: 2.18
           pycrypto: 2.6.1
       pycryptodome: Not Installed
             pygit2: Not Installed
             Python: 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:25:58) [MSC v.1500 64 bit (AMD64)]
       python-gnupg: 0.4.1
             PyYAML: 3.12
              PyZMQ: 16.0.3
               RAET: Not Installed
              smmap: 2.0.3
            timelib: 0.2.4
            Tornado: 4.5.2
                ZMQ: 4.1.6

    System Versions:
               dist:
             locale: cp1252
            machine: AMD64
            release: 2016Server
             system: Windows
            version: 2016Server 10.0.14393  Multiprocessor Free
Bug P1 State Module ZRELEASED - 2018.3.0 severity-critical severity-medium team-windows

Most helpful comment

@rallytime oui

All 3 comments

reg.absent fails with a similar stacktrace...

@twangboy This is fixed now, yes?

@rallytime oui

Was this page helpful?
0 / 5 - 0 ratings