00000014 $ˆl–Ðz¾”Ji?u4 ^¸ËwÒ˜´o „u×YkÁÀ¿?÷using Microsoft.Win32.SafeHandles; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Management.Automation; using System.Management.Automation.Runspaces; using System.Reflection; using System.Runtime.InteropServices; using System.Security.AccessControl; using System.Security.Principal; #if CORECLR using Newtonsoft.Json; #else using System.Web.Script.Serialization; #endif // Newtonsoft.Json may reference a different System.Runtime version (6.x) than loaded by PowerShell 7.3 (7.x). // Ignore CS1701 so the code can be compiled when warnings are reported as errors. //NoWarn -Name CS1701 -CLR Core // System.Diagnostics.EventLog.dll reference different versioned dlls that are // loaded in PSCore, ignore CS1702 so the code will ignore this warning //NoWarn -Name CS1702 -CLR Core //AssemblyReference -Type Newtonsoft.Json.JsonConvert -CLR Core //AssemblyReference -Type System.Diagnostics.EventLog -CLR Core //AssemblyReference -Type System.Security.AccessControl.NativeObjectSecurity -CLR Core //AssemblyReference -Type System.Security.AccessControl.DirectorySecurity -CLR Core //AssemblyReference -Type System.Security.Principal.IdentityReference -CLR Core //AssemblyReference -Name System.Web.Extensions.dll -CLR Framework namespace Ansible.Basic { public class AnsibleModule { public delegate void ExitHandler(int rc); public static ExitHandler Exit = new ExitHandler(ExitModule); public delegate void WriteLineHandler(string line); public static WriteLineHandler WriteLine = new WriteLineHandler(WriteLineModule); public static bool _DebugArgSpec = false; private static List BOOLEANS_TRUE = new List() { "y", "yes", "on", "1", "true", "t", "1.0" }; private static List BOOLEANS_FALSE = new List() { "n", "no", "off", "0", "false", "f", "0.0" }; private string remoteTmp = Path.GetTempPath(); private string tmpdir = null; private HashSet noLogValues = new HashSet(); private List optionsContext = new List(); private List warnings = new List(); private List> deprecations = new List>(); private List cleanupFiles = new List(); private Dictionary passVars = new Dictionary() { // null values means no mapping, not used in Ansible.Basic.AnsibleModule { "check_mode", "CheckMode" }, { "debug", "DebugMode" }, { "diff", "DiffMode" }, { "keep_remote_files", "KeepRemoteFiles" }, { "module_name", "ModuleName" }, { "no_log", "NoLog" }, { "remote_tmp", "remoteTmp" }, { "selinux_special_fs", null }, { "shell_executable", null }, { "socket", null }, { "string_conversion_action", null }, { "syslog_facility", null }, { "tmpdir", "tmpdir" }, { "verbosity", "Verbosity" }, { "version", "AnsibleVersion" }, }; private List passBools = new List() { "check_mode", "debug", "diff", "keep_remote_files", "no_log" }; private List passInts = new List() { "verbosity" }; private Dictionary> specDefaults = new Dictionary>() { // key - (default, type) - null is freeform { "apply_defaults", new List() { false, typeof(bool) } }, { "aliases", new List() { typeof(List), typeof(List) } }, { "choices", new List() { typeof(List), typeof(List) } }, { "default", new List() { null, null } }, { "deprecated_aliases", new List() { typeof(List<