win_msg: added doc about msg limit and included an explicit check for better error handling (#31078)
This commit is contained in:
parent
44f5b2bd25
commit
67fd98da09
3 changed files with 11 additions and 0 deletions
|
@ -36,6 +36,10 @@ $result = @{
|
||||||
wait = $wait
|
wait = $wait
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($msg.Length -gt 255) {
|
||||||
|
Fail-Json -obj $result -message "msg length must be less than 256 characters, current length: $($msg.Length)"
|
||||||
|
}
|
||||||
|
|
||||||
$msg_args = @($to, "/TIME:$display_seconds")
|
$msg_args = @($to, "/TIME:$display_seconds")
|
||||||
|
|
||||||
if ($wait) {
|
if ($wait) {
|
||||||
|
|
|
@ -51,6 +51,7 @@ options:
|
||||||
msg:
|
msg:
|
||||||
description:
|
description:
|
||||||
- The text of the message to be displayed.
|
- The text of the message to be displayed.
|
||||||
|
- The message must be less than 256 characters.
|
||||||
default: Hello world!
|
default: Hello world!
|
||||||
author:
|
author:
|
||||||
- Jon Hawkesworth (@jhawkesworth)
|
- Jon Hawkesworth (@jhawkesworth)
|
||||||
|
|
|
@ -25,3 +25,9 @@
|
||||||
- not msg_wait_result|failed
|
- not msg_wait_result|failed
|
||||||
- msg_wait_result|changed
|
- msg_wait_result|changed
|
||||||
- msg_wait_result.runtime_seconds > 5
|
- msg_wait_result.runtime_seconds > 5
|
||||||
|
|
||||||
|
- name: fail to send a message > 255 characters
|
||||||
|
win_msg:
|
||||||
|
msg: "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456"
|
||||||
|
register: fail_too_long
|
||||||
|
failed_when: "fail_too_long.msg != 'msg length must be less than 256 characters, current length: 256'"
|
||||||
|
|
Loading…
Reference in a new issue