conversion error (on windows)

5 views
Skip to first unread message

Stefan Skoglund

unread,
Jul 4, 2024, 6:21:37 AM7/4/24
to help-c...@googlegroups.com
I have trouble running cf-agent for the first time, i get a 'conversion
error' (StringToLong) and a fairly large number.

How to debug this ?

I could disable most of the policy for windows only, clean out
cfengine-nova on the windows host, bootstrap and test eval again.

Another irritating error: this is windows and powershell, so i
installed the
cfengine-nova msi from a interactive 'administrator' session.

Should i instead use 'cmd' and run that as 'administrator' when
installing and running policy ? Yes, i know this is windows admin which
hasn't been my coup of tea for the last 30 years... definitely a UNIX
guy.

Stefan Skoglund

unread,
Jul 9, 2024, 11:40:11 AM7/9/24
to help-c...@googlegroups.com
I have traced the error/failure to parsejson.

I takes out a report on available interfaces using PowerShell's Get-
NedAdapter.

ie something Like this:
---
"container"
data => parsejson( execresult( "Get-NetAdapter | Convertto-json",
"powershell"));
---

It works if i for example do this:
---
"container"
data => parsejson( execresult( "Get-NetAdapter | select ifName, Description | Convertto-json", "powershell"));
---

The output from Get-NetAdapter includes 'cimclass', which i believe causes the crash.
I could test doing a small sample (especially the key 'cimclass') which crashes and another one which doesn't.

This 3.21.5 and Windwos 10 home

Nick Anderson

unread,
Jul 9, 2024, 2:27:34 PM7/9/24
to Stefan Skoglund, help-c...@googlegroups.com

ie something Like this: — "container" data => parsejson( execresult( "Get-NetAdapter | Convertto-json", "powershell")); —

It works if i for example do this: — "container" data => parsejson( execresult( "Get-NetAdapter | select ifName, Description | Convertto-json", "powershell")); —

The output from Get-NetAdapter includes 'cimclass', which i believe causes the crash. I could test doing a small sample (especially the key 'cimclass') which crashes and another one which doesn't.

This 3.21.5 and Windwos 10 home

Can you make a standalone example? Take the output of your execresult() and just stuff it in the variable directly.

Reply all
Reply to author
Forward
0 new messages