mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 13:21:25 -07:00
Ansible.Basic - fix when deserialising a json string of an array (#55691)
* Ansible.Basic - fix when deserialising a json string of an array * Added changelog fragment
This commit is contained in:
parent
b9af6847c2
commit
5228133d74
4 changed files with 36 additions and 3 deletions
|
@ -334,7 +334,7 @@ namespace Ansible.Basic
|
|||
LogEvent(String.Format("[WARNING] {0}", message), EventLogEntryType.Warning);
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> FromJson(string json) { return FromJson<Dictionary<string, object>>(json); }
|
||||
public static object FromJson(string json) { return FromJson<object>(json); }
|
||||
public static T FromJson<T>(string json)
|
||||
{
|
||||
#if CORECLR
|
||||
|
@ -375,7 +375,7 @@ namespace Ansible.Basic
|
|||
if (args.Length > 0)
|
||||
{
|
||||
string inputJson = File.ReadAllText(args[0]);
|
||||
Dictionary<string, object> rawParams = FromJson(inputJson);
|
||||
Dictionary<string, object> rawParams = FromJson<Dictionary<string, object>>(inputJson);
|
||||
if (!rawParams.ContainsKey("ANSIBLE_MODULE_ARGS"))
|
||||
throw new ArgumentException("Module was unable to get ANSIBLE_MODULE_ARGS value from the argument path json");
|
||||
return (IDictionary)rawParams["ANSIBLE_MODULE_ARGS"];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue