diff options
author | Jordan Borean <jborean93@gmail.com> | 2017-10-03 07:32:30 +1100 |
---|---|---|
committer | jborean93 <jborean93@gmail.com> | 2017-10-03 06:34:28 +1000 |
commit | 310610de47de119cdc2a985dde8b020c34318b96 (patch) | |
tree | 8c86084e18cb8436dadb6e7134f791a65cb370fc /lib | |
parent | 5db1d1a881633b7fc14abea02d23d0f047c1f08e (diff) | |
download | ansible-310610de47de119cdc2a985dde8b020c34318b96.tar.gz |
win_msg: added doc about msg limit and included an explicit check for better error handling (#31078)
(cherry picked from commit 67fd98da090fa70be5c7b7e89a40d656c4d01733)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ansible/modules/windows/win_msg.ps1 | 4 | ||||
-rw-r--r-- | lib/ansible/modules/windows/win_msg.py | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/ansible/modules/windows/win_msg.ps1 b/lib/ansible/modules/windows/win_msg.ps1 index 04cf80b2ba..c3dd033afc 100644 --- a/lib/ansible/modules/windows/win_msg.ps1 +++ b/lib/ansible/modules/windows/win_msg.ps1 @@ -36,6 +36,10 @@ $result = @{ 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") if ($wait) { diff --git a/lib/ansible/modules/windows/win_msg.py b/lib/ansible/modules/windows/win_msg.py index 53d211131f..fa0250994b 100644 --- a/lib/ansible/modules/windows/win_msg.py +++ b/lib/ansible/modules/windows/win_msg.py @@ -51,6 +51,7 @@ options: msg: description: - The text of the message to be displayed. + - The message must be less than 256 characters. default: Hello world! author: - Jon Hawkesworth (@jhawkesworth) |