Windows registry entry (REG_SZ) with a comma

11 views
Skip to first unread message

Bob

unread,
Dec 1, 2022, 3:15:17 PM12/1/22
to help-cfengine
I am trying to set the timezone with a snippet as follows:

    "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation"
      comment => "Set timezone to MST",
      database_operation => "create",
      database_rows => {
        ",REG_SZ,",
        "ActiveTimeBias,REG_DWORD,0x1a4",
        "Bias,REG_DWORD,0x1a4",
        "DaylightBias,REG_DWORD,0",
        "DaylightName,REG_SZ,'@tzres.dll,-201'",
        "DaylightStart,REG_BINARY,0",
        "DynamicDaylightTimeDisabled,REG_DWORD,0",
        "StandardBias,REG_DWORD,0",
        "StandardName,REG_SZ,'@tzres.dll,-202'",
        "StandardStart,REG_BINARY,0",
        "TimeZoneKeyName,REG_SZ,US Mountain Standard Time",
      },
      database_type => "ms_registry";


The issue is the following error:

   error: Registry row format should be NAME,REG_SZ,VALUE, not 'DaylightName,REG_SZ,'@tzres.dll,-201''

The issue is the value contains a comma character. I've tried a single quote to group it and I've tried escape() without luck. Any suggestions?

Nick Anderson

unread,
Dec 1, 2022, 3:47:19 PM12/1/22
to Bob, help-c...@googlegroups.com

Bob <buha...@gmail.com> writes:

The issue is the following error:

error: Registry row format should be NAME,REG_SZ,VALUE, not 'DaylightName,REG_SZ,'@tzres.dll,-201''

The issue is the value contains a comma character. I've tried a single quote to group it and I've tried escape() without luck. Any suggestions?

Hi Bob,

The documentation for database_rows has a note that says "If a column value has a comma you can escape the comma with a backslash \.". Did you try that?

https://docs.cfengine.com/docs/master/reference-promise-types-databases.html#database_rows

– Nick Anderson | Doer of Things | (+1) 785-550-1767 | https://northern.tech

Bob

unread,
Dec 1, 2022, 4:24:11 PM12/1/22
to help-cfengine
Thank you and my apologies. I really am trying to review the documentation before I ask.

Nick Anderson

unread,
Dec 1, 2022, 4:37:16 PM12/1/22
to Bob, help-c...@googlegroups.com

Bob <buha...@gmail.com> writes:

> Thank you and my apologies. I really am trying to review the documentation before I ask.

It's fine, there is a /lot/ of documentation. And plausibly we need to
add cross references in various places.

--
Reply all
Reply to author
Forward
0 new messages