How to Use Command Validation

We’ve been digging more into using Command Validation but haven’t had much success, especially with the regex side of things. Looking at the Xibo documentation: Command Functionality | Xibo Digital Signage, we could not find any working examples of how Validation works, only that it’s “used as a comparison to the Command output and if it matches then the Command is considered a success. This string can be a regular expression.”.

So with that being the only info that we have, we are looking for clarification and transparency on these callbacks. Even with debugging turned on in test mode, we don’t see any Command history, no output history. Why wouldn’t there be DEBUG info stating what the result of the Validation? (Valid? False. Expected: X, Received: Y)

We think we were able to figure out how to use basic String validation with Command output via echo or console, but regex is still a mystery. An example in the documentation would have been very helpful here…

Since there is no documentation regarding it, let’s try and work through an example together. Who knows, maybe this will end up added to the guide.

So, if we set up a command in the CMS like such:

OS: Android
Command: getprop ro.product.model
Validation: DSCS9

When we run this command against a DSCS9 (legacy) player, we know the command is a huge success because under Displays [Last command] we see a big ✓.

So what happens when we run this against a newer DSCS9X player? Do we get the ✓ as before after we run it? No, no we do not. This is because it’s looking for an exact string. Duh. Let’s go ahead and modify this Validation string. Why not use regex like it says? Let’s see the results:

Validation: DSCS9.*
Result: No match
Comment: Huh, was not expecting that…

Validation: DS.*
Result: No match
Comment: Doesn’t match DSCS9 either now…

Validation: .*
Result: No match
Comment: Okay, what? This should match everything

Validation: DS*
Result: No match
Comment: Well this isn’t exactly regex, but this is what works as a wildcard in the CMS otherwise, like dynamic groups. Worth a shot anyway…

Validation: ^(.*)$
Result: No match
Comment: Okay, we give up, we don’t know what it’s looking for.

Conclusion:

Command Validation is currently in a somewhat broken state. We can see that it’s technically working with regards to a static string validation, but that is about it. There is a lack of adequate documentation in the guides to explain otherwise how to use it. There is mention of regular expressions, but we could not get it to work. Perhaps we are missing something simple and this is where documentation would help provide the clarity needed to fix our errors.

Lastly, we were very disappointed that we could not find any logs in the CMS for when a command was issued to a player. It would be very helpful to know some basic info about commands:

DateTime, User, CommandId, Return Value, Validation Result

@dan @natasha
If we’ve overlooked something, please correct our mistakes and teach us!

Thank you :]

The key here is this line - neither Windows or Android support this. @DanBW do you know if webOS/Tizen do?

I think it would be useful if they did and have created the relevant issues to get that solved in the next release.

Very happy to make a note to improve logging. On Android you will get limited audit logging when a command is run, but only on a hard failure.

Xibo for Tizen and webOS do not supported regular expressions for command validation. I will forward this post as feedback to the SoC developers so they can investigate if this is something they can/will support in future player releases.

1 Like

Thanks for the input, gentlemen. I appreciate you taking the time to look into this request.

That would be great if your team would be able to consider these log additions. My team and I find XMR to be a crucial tool in managing Android devices, but it loses efficiency when we are unsure of run status. Any transparency that you are able to add will be helpful in monitoring the current health of displays, as well as assist in debugging.

May we also suggest the idea of ‘Command Buckets’? This would essentially be a Campaign, but for Commands. It would allow for a sequence of XMR commands to be run in order on a display in the background, without affecting the currently scheduled layout. Pair that with a way to persist and resume the sequence after reboot, and we’d have ourselves a great new tool :slight_smile:

Okay, so am I reading this correctly? Windows, Android, webOS and Tizen all do not support regex for command validation? What does that even leave, Linux? I really don’t think this is clear in the documentation…

I think in reality the documentation is wrong, but the PM for each of the players you mentioned has raised issues to add that functionality in future release. @natasha can we update the docs in the meantime to say that command validation is an exact match.

I’d love to understand your use case in a little more detail - would you be happy to PM me so we can arrange a time to discuss?

Would you also be able to clarify what data/string is returned to be used for comparison? I believe it is anything in stdout, such as echo and printf commands, but do exit codes work too?

I assure you there’s not much else to it than that, but sure-- I can send you a PM with some specifics.

Thanks!

Just stdout, assuming your command isn’t rs232 or http, etc.

In all honestly I think we need to do some work to have some sort of “CommandResponse” object which gets appropriate values for stdout, code, etc, that we can set to the appropriate values for each different command type.

For example I think you’d expect a HTTP command to return the status code in code, whereas a shell command would return the exit code.

I’ll make a note to look at improving this experience.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.