Whitelist on Windows

Have just upgraded to 2.5.2 and can’t seems to get my two scripts set up in the whitelist correctly.

I am still seeing the following error in my logs:

2020-02-23 11:56:57.501 [WARN ] [ng.exec.internal.handler.ExecHandler] - Tried to execute 'C:/PROGRA~1/Python37/python.exe C:/PROGRA~1/Python37/Lib/site-packages/WazeRouteCalculator/HomeRoute.py', but it is not contained in whitelist.
2020-02-23 11:56:57.511 [WARN ] [ng.exec.internal.handler.ExecHandler] - Tried to execute 'C:/PROGRA~1/Python37/python.exe C:/PROGRA~1/Python37/Lib/site-packages/WazeRouteCalculator/BYPRoute.py', but it is not contained in whitelist.

My whitelist file has been created and placed in what I believe to be the proper place:

image

The file contains two entries on seperate lines:

C:/PROGRA~1/Python37/python.exe C:/PROGRA~1/Python37/Lib/site-packages/WazeRouteCalculator/BYPRoute.py
C:/PROGRA~1/Python37/python.exe C:/PROGRA~1/Python37/Lib/site-packages/WazeRouteCalculator/HomeRoute.py

And my command THINGS look like this…

Thing exec:command:BYPRoute [command="C:/PROGRA~1/Python37/python.exe C:/PROGRA~1/Python37/Lib/site-packages/WazeRouteCalculator/BYPRoute.py", interval=300, timeout=5, transform="REGEX(.*Time (.*) minutes.*)"]
Thing exec:command:HomeRoute [command="C:/PROGRA~1/Python37/python.exe C:/PROGRA~1/Python37/Lib/site-packages/WazeRouteCalculator/HomeRoute.py", interval=300, timeout=5, transform="REGEX(.*Time (.*) minutes.*)"]

What am I missing? I’ve reread the instructions a couple of times and everything looks good??

Squid

Try editing the file (open and save) when OH is already running. The file is not read on startup, which is already fixed in the current master.

I have tried that with no luck.

Please log:set DEBUG org.openhab.binding.exec on the karaf console, edit the whitelist and show the log-entry. Thanks.

2020-02-23 12:21:57.508 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Passing to shell for parsing command.
2020-02-23 12:21:57.509 [DEBUG] [ng.exec.internal.handler.ExecHandler] - OS: WINDOWS (Windows Server 2012)
2020-02-23 12:21:57.517 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Passing to shell for parsing command.
2020-02-23 12:21:57.519 [DEBUG] [ng.exec.internal.handler.ExecHandler] - OS: WINDOWS (Windows Server 2012)
2020-02-23 12:21:59.797 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: 'From: xxxxxxxxx Sugar Land, Texas xxxx- to: xxxx xxxxxxHouston, Texas 77056'
2020-02-23 12:21:59.797 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: 'Traceback (most recent call last):'
2020-02-23 12:21:59.798 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '  File "C:/PROGRA~1/Python37/Lib/site-packages/WazeRouteCalculator/HomeRoute.py", line 7, in <module>'
2020-02-23 12:21:59.798 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '    route.calc_route_info()'
2020-02-23 12:21:59.798 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '  File "C:\PROGRA~1\Python37\Lib\site-packages\WazeRouteCalculator\WazeRouteCalculator.py", line 136, in calc_route_info'
2020-02-23 12:21:59.798 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '    route = self.get_route(1, time_delta)'
2020-02-23 12:21:59.799 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '  File "C:\PROGRA~1\Python37\Lib\site-packages\WazeRouteCalculator\WazeRouteCalculator.py", line 95, in get_route'
2020-02-23 12:21:59.799 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '    response_json = response.json()'
2020-02-23 12:21:59.799 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '  File "C:\PROGRA~1\Python37\lib\site-packages\requests\models.py", line 896, in json'
2020-02-23 12:21:59.799 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '    return complexjson.loads(self.text, **kwargs)'
2020-02-23 12:21:59.800 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '  File "C:\PROGRA~1\Python37\lib\json\__init__.py", line 348, in loads'
2020-02-23 12:21:59.800 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '    return _default_decoder.decode(s)'
2020-02-23 12:21:59.800 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '  File "C:\PROGRA~1\Python37\lib\json\decoder.py", line 337, in decode'
2020-02-23 12:21:59.800 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '    obj, end = self.raw_decode(s, idx=_w(s, 0).end())'
2020-02-23 12:21:59.801 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '  File "C:\PROGRA~1\Python37\lib\json\decoder.py", line 355, in raw_decode'
2020-02-23 12:21:59.801 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: '    raise JSONDecodeError("Expecting value", s, err.value) from None'
2020-02-23 12:21:59.801 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: 'json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)'
2020-02-23 12:21:59.802 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Transformed response is 'null'
2020-02-23 12:21:59.933 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: 'From: xxxxx xxxxxxx Houston, Texas xxxxxxx- to: xxx xxxxxx  Sugar Land, Texas xxxxxx'
2020-02-23 12:21:59.934 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Exec [ERROR]: 'Time 15.50 minutes, distance 18.92 km.'
2020-02-23 12:21:59.937 [DEBUG] [ng.exec.internal.handler.ExecHandler] - Transformed response is '15.50'

Did you edit the whitelist? It seems it is not read

Yes, I added an extra line to the two that was in the file

Ok. The log is a bug.

log:set DEBUG org.eclipse.smarthome.core.service.AbstractWatchService

But otherwiese it works for me. I installed a new OH 2.5.2 on Win10, added exec binding and regex transformation, your things in a thing file, your whitelist as above and get:

19:56:20.750 [DEBUG] [ome.core.service.AbstractWatchService] - Updated command whitelist: [C:/PROGRA~1/Python37/python.exe C:/PROGRA~1/Python37/Lib/site-packages/WazeRouteCalculator/BYPRoute.py, C:/PROGRA~1/Python37/python.exe C:/PROGRA~1/Python37/Lib/site-packages/WazeRouteCalculator/HomeRoute.py]

when editing the file and then during execution:

19:57:54.238 [INFO ] [smarthome.event.ItemStateChangedEvent] - Befehl_AusfHrung changed from ON to OFF
19:59:13.713 [INFO ] [smarthome.event.ExtensionEvent       ] - Extension 'transformation-regex' has been installed.
19:59:18.393 [INFO ] [smarthome.event.ItemCommandEvent     ] - Item 'Befehl_AusfHrung' received command ON
19:59:18.397 [INFO ] [arthome.event.ItemStatePredictedEvent] - Befehl_AusfHrung predicted to become ON
19:59:18.401 [INFO ] [smarthome.event.ItemStateChangedEvent] - Befehl_AusfHrung changed from OFF to ON
19:59:18.406 [DEBUG] [ing.exec.internal.handler.ExecHandler] - Passing to shell for parsing command.
19:59:18.406 [DEBUG] [ing.exec.internal.handler.ExecHandler] - OS: WINDOWS (Windows 10)
19:59:18.444 [DEBUG] [ing.exec.internal.handler.ExecHandler] - Exec [ERROR]: 'Das System kann den angegebenen Pfad nicht finden.'
19:59:18.446 [DEBUG] [ing.exec.internal.handler.ExecHandler] - Transformed response is 'null'
19:59:18.446 [INFO ] [smarthome.event.ItemStateChangedEvent] - Befehl_AusfHrung changed from ON to OFF

Well I thought clearing the cache did the trick, but I am still seeing error messages in the log.

Which are? Geez, it’s like pulling teeth.

Maybe if you read the entire post, before making sarcastic comments you’d see them in the initial post.

The script files are not seen by the whitelist.

But in the second log you posted the commands are executed. They fail, but if you look at the log: this is a python error.

Yes, it does seem to run, but the log is continuously being spammed with the error of the script not being on the white list.

Not in anything you’ve posted.

same errors…different time…

2020-02-24 18:06:46.100 [WARN ] [ng.exec.internal.handler.ExecHandler] - Tried to execute 'C:/PROGRA~1/Python37/python.exe C:/PROGRA~1/Python37/Lib/site-packages/WazeRouteCalculator/BYPRoute.py', but it is not contained in whitelist.
2020-02-24 18:06:46.100 [WARN ] [ng.exec.internal.handler.ExecHandler] - Tried to execute 'C:/PROGRA~1/Python37/python.exe C:/PROGRA~1/Python37/Lib/site-packages/WazeRouteCalculator/HomeRoute.py', but it is not contained in whitelist.

If you are still running the original 2.5.2 release, you should upgrade the binding to the latest snapshot (which contains the fix for whitelist not loaded at startup) and see if this goes away.

Hi, am I looking in the right place for the snapshot? I’ve not tried this before. https://openhab.jfrog.io/openhab/webapp/#/builds/openHAB2.5.x-Addons/56/1582256130375/published%20/org.openhab.addons.bundles:org.openhab.binding.exec:2.5.3-SNAPSHOT

The timestamp on the .jar https://openhab.jfrog.io/openhab/libs-snapshot-local/org/openhab/addons/bundles/org.openhab.binding.exec/2.5.3-SNAPSHOT/org.openhab.binding.exec-2.5.3-20200221.033409-2.jar precedes the commit date of the fix. Using this .jar doesn’t resolve the issue for me anyway.

It seems like builds are failing? https://ci.openhab.org/view/Integration%20Builds%20(2.5.x)/job/openHAB2.5.x-Addons/

They certainly are. I’m sure the @maintainers are aware.

After 21 feb the builds are failing?

Maybe the number of CPU cores was increased and because of that, the default test setup gives problems? @Kai do you know whether anything changed on Jenkins?

See also: https://github.com/eclipse/smarthome/issues/6574

Hm, that might indeed be the case, the Jenkins agents might have more CPU cores than before.
@thorsen, did you upgrade the machine just after Feb 21? Is it possible to configure docker to make less cores available to the agents? If not, we will have to see how we can add a custom config to the unit test execution.