chef-powershell 1.0.0 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -23
  3. data/bin/ruby_bin_folder/AMD64/Chef.PowerShell.dll +0 -0
  4. data/bin/ruby_bin_folder/AMD64/Chef.Powershell.Wrapper.dll +0 -0
  5. data/bin/ruby_bin_folder/AMD64/Ijwhost.dll +0 -0
  6. data/bin/ruby_bin_folder/AMD64/concrt140.dll +0 -0
  7. data/bin/ruby_bin_folder/AMD64/host/fxr/5.0.0/hostfxr.dll +0 -0
  8. data/bin/ruby_bin_folder/AMD64/msvcp140.dll +0 -0
  9. data/bin/ruby_bin_folder/AMD64/msvcp140_1.dll +0 -0
  10. data/bin/ruby_bin_folder/AMD64/msvcp140_2.dll +0 -0
  11. data/bin/ruby_bin_folder/AMD64/msvcp140_atomic_wait.dll +0 -0
  12. data/bin/ruby_bin_folder/AMD64/msvcp140_codecvt_ids.dll +0 -0
  13. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Chef.PowerShell.Wrapper.Core.dll +0 -0
  14. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.dll +0 -0
  15. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.pdb +0 -0
  16. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Ijwhost.dll +0 -0
  17. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.CSharp.dll +0 -0
  18. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.NETCore.App.deps.json +180 -180
  19. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.VisualBasic.Core.dll +0 -0
  20. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.VisualBasic.dll +0 -0
  21. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.Win32.Primitives.dll +0 -0
  22. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/Microsoft.Win32.Registry.dll +0 -0
  23. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.AppContext.dll +0 -0
  24. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Buffers.dll +0 -0
  25. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Collections.Concurrent.dll +0 -0
  26. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Collections.Immutable.dll +0 -0
  27. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Collections.NonGeneric.dll +0 -0
  28. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Collections.Specialized.dll +0 -0
  29. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Collections.dll +0 -0
  30. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.ComponentModel.Annotations.dll +0 -0
  31. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.ComponentModel.DataAnnotations.dll +0 -0
  32. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.ComponentModel.EventBasedAsync.dll +0 -0
  33. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.ComponentModel.Primitives.dll +0 -0
  34. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.ComponentModel.TypeConverter.dll +0 -0
  35. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.ComponentModel.dll +0 -0
  36. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Configuration.dll +0 -0
  37. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Console.dll +0 -0
  38. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Core.dll +0 -0
  39. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Data.Common.dll +0 -0
  40. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Data.DataSetExtensions.dll +0 -0
  41. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Data.dll +0 -0
  42. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.Contracts.dll +0 -0
  43. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.Debug.dll +0 -0
  44. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.DiagnosticSource.dll +0 -0
  45. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.FileVersionInfo.dll +0 -0
  46. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.Process.dll +0 -0
  47. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.StackTrace.dll +0 -0
  48. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.TextWriterTraceListener.dll +0 -0
  49. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.Tools.dll +0 -0
  50. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.TraceSource.dll +0 -0
  51. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Diagnostics.Tracing.dll +0 -0
  52. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Drawing.Primitives.dll +0 -0
  53. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Drawing.dll +0 -0
  54. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Dynamic.Runtime.dll +0 -0
  55. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Formats.Asn1.dll +0 -0
  56. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Globalization.Calendars.dll +0 -0
  57. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Globalization.Extensions.dll +0 -0
  58. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Globalization.dll +0 -0
  59. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.Compression.Brotli.dll +0 -0
  60. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.Compression.FileSystem.dll +0 -0
  61. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.Compression.ZipFile.dll +0 -0
  62. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.Compression.dll +0 -0
  63. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.FileSystem.AccessControl.dll +0 -0
  64. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.FileSystem.DriveInfo.dll +0 -0
  65. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.FileSystem.Primitives.dll +0 -0
  66. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.FileSystem.Watcher.dll +0 -0
  67. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.FileSystem.dll +0 -0
  68. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.IsolatedStorage.dll +0 -0
  69. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.MemoryMappedFiles.dll +0 -0
  70. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.Pipes.AccessControl.dll +0 -0
  71. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.Pipes.dll +0 -0
  72. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.UnmanagedMemoryStream.dll +0 -0
  73. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.IO.dll +0 -0
  74. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Linq.Expressions.dll +0 -0
  75. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Linq.Parallel.dll +0 -0
  76. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Linq.Queryable.dll +0 -0
  77. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Linq.dll +0 -0
  78. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Memory.dll +0 -0
  79. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.Http.Json.dll +0 -0
  80. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.Http.dll +0 -0
  81. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.HttpListener.dll +0 -0
  82. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.Mail.dll +0 -0
  83. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.NameResolution.dll +0 -0
  84. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.NetworkInformation.dll +0 -0
  85. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.Ping.dll +0 -0
  86. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.Primitives.dll +0 -0
  87. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.Requests.dll +0 -0
  88. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.Security.dll +0 -0
  89. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.ServicePoint.dll +0 -0
  90. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.Sockets.dll +0 -0
  91. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.WebClient.dll +0 -0
  92. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.WebHeaderCollection.dll +0 -0
  93. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.WebProxy.dll +0 -0
  94. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.WebSockets.Client.dll +0 -0
  95. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.WebSockets.dll +0 -0
  96. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Net.dll +0 -0
  97. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Numerics.Vectors.dll +0 -0
  98. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Numerics.dll +0 -0
  99. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.ObjectModel.dll +0 -0
  100. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Private.CoreLib.dll +0 -0
  101. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Private.DataContractSerialization.dll +0 -0
  102. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Private.Uri.dll +0 -0
  103. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Private.Xml.Linq.dll +0 -0
  104. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Private.Xml.dll +0 -0
  105. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Reflection.DispatchProxy.dll +0 -0
  106. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Reflection.Emit.ILGeneration.dll +0 -0
  107. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Reflection.Emit.Lightweight.dll +0 -0
  108. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Reflection.Emit.dll +0 -0
  109. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Reflection.Extensions.dll +0 -0
  110. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Reflection.Metadata.dll +0 -0
  111. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Reflection.Primitives.dll +0 -0
  112. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Reflection.TypeExtensions.dll +0 -0
  113. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Reflection.dll +0 -0
  114. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Resources.Reader.dll +0 -0
  115. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Resources.ResourceManager.dll +0 -0
  116. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Resources.Writer.dll +0 -0
  117. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  118. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.CompilerServices.VisualC.dll +0 -0
  119. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.Extensions.dll +0 -0
  120. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.Handles.dll +0 -0
  121. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.InteropServices.RuntimeInformation.dll +0 -0
  122. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.InteropServices.dll +0 -0
  123. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.Intrinsics.dll +0 -0
  124. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.Loader.dll +0 -0
  125. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.Numerics.dll +0 -0
  126. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.Serialization.Formatters.dll +0 -0
  127. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.Serialization.Json.dll +0 -0
  128. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.Serialization.Primitives.dll +0 -0
  129. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.Serialization.Xml.dll +0 -0
  130. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.Serialization.dll +0 -0
  131. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Runtime.dll +0 -0
  132. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.AccessControl.dll +0 -0
  133. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Claims.dll +0 -0
  134. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Cryptography.Algorithms.dll +0 -0
  135. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Cryptography.Cng.dll +0 -0
  136. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Cryptography.Csp.dll +0 -0
  137. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Cryptography.Encoding.dll +0 -0
  138. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Cryptography.OpenSsl.dll +0 -0
  139. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Cryptography.Primitives.dll +0 -0
  140. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Cryptography.X509Certificates.dll +0 -0
  141. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Principal.Windows.dll +0 -0
  142. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.Principal.dll +0 -0
  143. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.SecureString.dll +0 -0
  144. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Security.dll +0 -0
  145. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.ServiceModel.Web.dll +0 -0
  146. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.ServiceProcess.dll +0 -0
  147. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Text.Encoding.CodePages.dll +0 -0
  148. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Text.Encoding.Extensions.dll +0 -0
  149. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Text.Encoding.dll +0 -0
  150. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Text.Encodings.Web.dll +0 -0
  151. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Text.Json.dll +0 -0
  152. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Text.RegularExpressions.dll +0 -0
  153. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Threading.Channels.dll +0 -0
  154. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Threading.Overlapped.dll +0 -0
  155. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Threading.Tasks.Dataflow.dll +0 -0
  156. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Threading.Tasks.Extensions.dll +0 -0
  157. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Threading.Tasks.Parallel.dll +0 -0
  158. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Threading.Tasks.dll +0 -0
  159. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Threading.Thread.dll +0 -0
  160. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Threading.ThreadPool.dll +0 -0
  161. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Threading.Timer.dll +0 -0
  162. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Threading.dll +0 -0
  163. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Transactions.Local.dll +0 -0
  164. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Transactions.dll +0 -0
  165. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.ValueTuple.dll +0 -0
  166. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Web.HttpUtility.dll +0 -0
  167. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Web.dll +0 -0
  168. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Windows.dll +0 -0
  169. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Xml.Linq.dll +0 -0
  170. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Xml.ReaderWriter.dll +0 -0
  171. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Xml.Serialization.dll +0 -0
  172. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Xml.XDocument.dll +0 -0
  173. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Xml.XPath.XDocument.dll +0 -0
  174. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Xml.XPath.dll +0 -0
  175. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Xml.XmlDocument.dll +0 -0
  176. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Xml.XmlSerializer.dll +0 -0
  177. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.Xml.dll +0 -0
  178. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/System.dll +0 -0
  179. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/WindowsBase.dll +0 -0
  180. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/clrcompression.dll +0 -0
  181. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/clretwrc.dll +0 -0
  182. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/clrjit.dll +0 -0
  183. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/coreclr.dll +0 -0
  184. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/createdump.exe +0 -0
  185. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/dbgshim.dll +0 -0
  186. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/hostfxr.dll +0 -0
  187. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/hostpolicy.dll +0 -0
  188. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/mscordaccore.dll +0 -0
  189. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/mscordaccore_amd64_amd64_5.0.521.16609.dll +0 -0
  190. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/mscordbi.dll +0 -0
  191. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/mscorlib.dll +0 -0
  192. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/mscorrc.dll +0 -0
  193. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/netstandard.dll +0 -0
  194. data/bin/ruby_bin_folder/AMD64/vccorlib140.dll +0 -0
  195. data/bin/ruby_bin_folder/AMD64/vcruntime140.dll +0 -0
  196. data/bin/ruby_bin_folder/AMD64/vcruntime140_1.dll +0 -0
  197. data/bin/ruby_bin_folder/x86/Chef.PowerShell.dll +0 -0
  198. data/bin/ruby_bin_folder/x86/Chef.Powershell.Wrapper.dll +0 -0
  199. data/bin/ruby_bin_folder/x86/concrt140.dll +0 -0
  200. data/bin/ruby_bin_folder/x86/msvcp140.dll +0 -0
  201. data/bin/ruby_bin_folder/x86/msvcp140_1.dll +0 -0
  202. data/bin/ruby_bin_folder/x86/msvcp140_2.dll +0 -0
  203. data/bin/ruby_bin_folder/x86/msvcp140_atomic_wait.dll +0 -0
  204. data/bin/ruby_bin_folder/x86/msvcp140_codecvt_ids.dll +0 -0
  205. data/bin/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Chef.PowerShell.Wrapper.Core.dll +0 -0
  206. data/bin/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.dll +0 -0
  207. data/bin/ruby_bin_folder/x86/shared/Microsoft.NETCore.App/5.0.0/Chef.Powershell.Core.pdb +0 -0
  208. data/bin/ruby_bin_folder/x86/vccorlib140.dll +0 -0
  209. data/bin/ruby_bin_folder/x86/vcruntime140.dll +0 -0
  210. data/chef-powershell.gemspec +8 -8
  211. data/lib/chef-powershell/exceptions.rb +26 -26
  212. data/lib/chef-powershell/powershell.rb +44 -24
  213. data/lib/chef-powershell/powershell_exec.rb +12 -11
  214. data/lib/chef-powershell/pwsh.rb +11 -7
  215. data/lib/chef-powershell/version.rb +3 -3
  216. data/lib/chef-powershell.rb +2 -2
  217. data/spec/unit/powershell_exec_spec.rb +17 -12
  218. metadata +23 -25
  219. data/bin/powershell/chef/chef.psm1 +0 -459
  220. data/bin/ruby_bin_folder/AMD64/Chef.PowerShell.Wrapper.dll +0 -0
  221. data/bin/ruby_bin_folder/AMD64/canary.txt +0 -1
  222. data/bin/ruby_bin_folder/AMD64/shared/Microsoft.NETCore.App/5.0.0/mscordaccore_amd64_amd64_5.0.20.51904.dll +0 -0
  223. data/lib/chef-powershell/json_compat.rb +0 -63
@@ -1,459 +0,0 @@
1
- 
2
- function Load-Win32Bindings {
3
- Add-Type -TypeDefinition @"
4
- using System;
5
- using System.Diagnostics;
6
- using System.Runtime.InteropServices;
7
-
8
- namespace Chef
9
- {
10
-
11
- [StructLayout(LayoutKind.Sequential)]
12
- public struct PROCESS_INFORMATION
13
- {
14
- public IntPtr hProcess;
15
- public IntPtr hThread;
16
- public uint dwProcessId;
17
- public uint dwThreadId;
18
- }
19
-
20
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
21
- public struct STARTUPINFO
22
- {
23
- public uint cb;
24
- public string lpReserved;
25
- public string lpDesktop;
26
- public string lpTitle;
27
- public uint dwX;
28
- public uint dwY;
29
- public uint dwXSize;
30
- public uint dwYSize;
31
- public uint dwXCountChars;
32
- public uint dwYCountChars;
33
- public uint dwFillAttribute;
34
- public STARTF dwFlags;
35
- public ShowWindow wShowWindow;
36
- public short cbReserved2;
37
- public IntPtr lpReserved2;
38
- public IntPtr hStdInput;
39
- public IntPtr hStdOutput;
40
- public IntPtr hStdError;
41
- }
42
-
43
- [StructLayout(LayoutKind.Sequential)]
44
- public struct SECURITY_ATTRIBUTES
45
- {
46
- public int length;
47
- public IntPtr lpSecurityDescriptor;
48
- public bool bInheritHandle;
49
- }
50
-
51
- [Flags]
52
- public enum CreationFlags : int
53
- {
54
- NONE = 0,
55
- DEBUG_PROCESS = 0x00000001,
56
- DEBUG_ONLY_THIS_PROCESS = 0x00000002,
57
- CREATE_SUSPENDED = 0x00000004,
58
- DETACHED_PROCESS = 0x00000008,
59
- CREATE_NEW_CONSOLE = 0x00000010,
60
- CREATE_NEW_PROCESS_GROUP = 0x00000200,
61
- CREATE_UNICODE_ENVIRONMENT = 0x00000400,
62
- CREATE_SEPARATE_WOW_VDM = 0x00000800,
63
- CREATE_SHARED_WOW_VDM = 0x00001000,
64
- CREATE_PROTECTED_PROCESS = 0x00040000,
65
- EXTENDED_STARTUPINFO_PRESENT = 0x00080000,
66
- CREATE_BREAKAWAY_FROM_JOB = 0x01000000,
67
- CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000,
68
- CREATE_DEFAULT_ERROR_MODE = 0x04000000,
69
- CREATE_NO_WINDOW = 0x08000000,
70
- }
71
-
72
- [Flags]
73
- public enum STARTF : uint
74
- {
75
- STARTF_USESHOWWINDOW = 0x00000001,
76
- STARTF_USESIZE = 0x00000002,
77
- STARTF_USEPOSITION = 0x00000004,
78
- STARTF_USECOUNTCHARS = 0x00000008,
79
- STARTF_USEFILLATTRIBUTE = 0x00000010,
80
- STARTF_RUNFULLSCREEN = 0x00000020, // ignored for non-x86 platforms
81
- STARTF_FORCEONFEEDBACK = 0x00000040,
82
- STARTF_FORCEOFFFEEDBACK = 0x00000080,
83
- STARTF_USESTDHANDLES = 0x00000100,
84
- }
85
-
86
- public enum ShowWindow : short
87
- {
88
- SW_HIDE = 0,
89
- SW_SHOWNORMAL = 1,
90
- SW_NORMAL = 1,
91
- SW_SHOWMINIMIZED = 2,
92
- SW_SHOWMAXIMIZED = 3,
93
- SW_MAXIMIZE = 3,
94
- SW_SHOWNOACTIVATE = 4,
95
- SW_SHOW = 5,
96
- SW_MINIMIZE = 6,
97
- SW_SHOWMINNOACTIVE = 7,
98
- SW_SHOWNA = 8,
99
- SW_RESTORE = 9,
100
- SW_SHOWDEFAULT = 10,
101
- SW_FORCEMINIMIZE = 11,
102
- SW_MAX = 11
103
- }
104
-
105
- public enum StandardHandle : int
106
- {
107
- Input = -10,
108
- Output = -11,
109
- Error = -12
110
- }
111
-
112
- public enum HandleFlags : int
113
- {
114
- HANDLE_FLAG_INHERIT = 0x00000001,
115
- HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x00000002
116
- }
117
-
118
- public static class Kernel32
119
- {
120
- [DllImport("kernel32.dll", SetLastError=true)]
121
- [return: MarshalAs(UnmanagedType.Bool)]
122
- public static extern bool CreateProcess(
123
- string lpApplicationName,
124
- string lpCommandLine,
125
- ref SECURITY_ATTRIBUTES lpProcessAttributes,
126
- ref SECURITY_ATTRIBUTES lpThreadAttributes,
127
- [MarshalAs(UnmanagedType.Bool)] bool bInheritHandles,
128
- CreationFlags dwCreationFlags,
129
- IntPtr lpEnvironment,
130
- string lpCurrentDirectory,
131
- ref STARTUPINFO lpStartupInfo,
132
- out PROCESS_INFORMATION lpProcessInformation);
133
-
134
- [DllImport("kernel32.dll", SetLastError=true)]
135
- public static extern IntPtr GetStdHandle(
136
- StandardHandle nStdHandle);
137
-
138
- [DllImport("kernel32.dll")]
139
- public static extern bool SetHandleInformation(
140
- IntPtr hObject,
141
- int dwMask,
142
- uint dwFlags);
143
-
144
- [DllImport("kernel32", SetLastError=true)]
145
- [return: MarshalAs(UnmanagedType.Bool)]
146
- public static extern bool CloseHandle(
147
- IntPtr hObject);
148
-
149
- [DllImport("kernel32", SetLastError=true)]
150
- [return: MarshalAs(UnmanagedType.Bool)]
151
- public static extern bool GetExitCodeProcess(
152
- IntPtr hProcess,
153
- out int lpExitCode);
154
-
155
- [DllImport("kernel32.dll", SetLastError = true)]
156
- public static extern bool CreatePipe(
157
- out IntPtr phReadPipe,
158
- out IntPtr phWritePipe,
159
- IntPtr lpPipeAttributes,
160
- uint nSize);
161
-
162
- [DllImport("kernel32.dll", SetLastError = true)]
163
- public static extern bool ReadFile(
164
- IntPtr hFile,
165
- [Out] byte[] lpBuffer,
166
- uint nNumberOfBytesToRead,
167
- ref int lpNumberOfBytesRead,
168
- IntPtr lpOverlapped);
169
-
170
- [DllImport("kernel32.dll", SetLastError = true)]
171
- public static extern bool PeekNamedPipe(
172
- IntPtr handle,
173
- byte[] buffer,
174
- uint nBufferSize,
175
- ref uint bytesRead,
176
- ref uint bytesAvail,
177
- ref uint BytesLeftThisMessage);
178
-
179
- public const int STILL_ACTIVE = 259;
180
- }
181
- }
182
- "@
183
- }
184
-
185
- function Run-ExecutableAndWait($AppPath, $ArgumentString) {
186
- # Use the Win32 API to create a new process and wait for it to terminate.
187
- $null = Load-Win32Bindings
188
-
189
- $si = New-Object Chef.STARTUPINFO
190
- $pi = New-Object Chef.PROCESS_INFORMATION
191
-
192
- $pSec = New-Object Chef.SECURITY_ATTRIBUTES
193
- $pSec.Length = [System.Runtime.InteropServices.Marshal]::SizeOf($pSec)
194
- $pSec.bInheritHandle = $true
195
- $tSec = New-Object Chef.SECURITY_ATTRIBUTES
196
- $tSec.Length = [System.Runtime.InteropServices.Marshal]::SizeOf($tSec)
197
- $tSec.bInheritHandle = $true
198
-
199
- # Create pipe for process stdout
200
- $ptr = [System.Runtime.InteropServices.Marshal]::AllocHGlobal([System.Runtime.InteropServices.Marshal]::SizeOf($si))
201
- [System.Runtime.InteropServices.Marshal]::StructureToPtr($pSec, $ptr, $true)
202
- $hReadOut = [IntPtr]::Zero
203
- $hWriteOut = [IntPtr]::Zero
204
- $success = [Chef.Kernel32]::CreatePipe([ref] $hReadOut, [ref] $hWriteOut, $ptr, 0)
205
- if (-Not $success) {
206
- $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
207
- throw "Unable to create output pipe. Error code $reason."
208
- }
209
- $success = [Chef.Kernel32]::SetHandleInformation($hReadOut, [Chef.HandleFlags]::HANDLE_FLAG_INHERIT, 0)
210
- if (-Not $success) {
211
- $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
212
- throw "Unable to set output pipe handle information. Error code $reason."
213
- }
214
-
215
- $si.cb = [System.Runtime.InteropServices.Marshal]::SizeOf($si)
216
- $si.wShowWindow = [Chef.ShowWindow]::SW_SHOW
217
- $si.dwFlags = [Chef.STARTF]::STARTF_USESTDHANDLES
218
- $si.hStdOutput = $hWriteOut
219
- $si.hStdError = $hWriteOut
220
- $si.hStdInput = [Chef.Kernel32]::GetStdHandle([Chef.StandardHandle]::Input)
221
-
222
- $success = [Chef.Kernel32]::CreateProcess(
223
- $AppPath,
224
- $ArgumentString,
225
- [ref] $pSec,
226
- [ref] $tSec,
227
- $true,
228
- [Chef.CreationFlags]::NONE,
229
- [IntPtr]::Zero,
230
- $pwd,
231
- [ref] $si,
232
- [ref] $pi
233
- )
234
- if (-Not $success) {
235
- $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
236
- throw "Unable to create process [$ArgumentString]. Error code $reason."
237
- }
238
-
239
- $buffer = New-Object byte[] 1024
240
-
241
- # Initialize reference variables
242
- $bytesRead = 0
243
- $bytesAvailable = 0
244
- $bytesLeftThisMsg = 0
245
- $global:LASTEXITCODE = [Chef.Kernel32]::STILL_ACTIVE
246
-
247
- $isActive = $true
248
- while ($isActive) {
249
- $success = [Chef.Kernel32]::GetExitCodeProcess($pi.hProcess, [ref] $global:LASTEXITCODE)
250
- if (-Not $success) {
251
- $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
252
- throw "Process exit code unavailable. Error code $reason."
253
- }
254
-
255
- $success = [Chef.Kernel32]::PeekNamedPipe(
256
- $hReadOut,
257
- $null,
258
- $buffer.Length,
259
- [ref] $bytesRead,
260
- [ref] $bytesAvailable,
261
- [ref] $bytesLeftThisMsg
262
- )
263
- if (-Not $success) {
264
- $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
265
- throw "Output pipe unavailable for peeking. Error code $reason."
266
- }
267
-
268
- if ($bytesRead -gt 0) {
269
- while ([Chef.Kernel32]::ReadFile($hReadOut, $buffer, $buffer.Length, [ref] $bytesRead, 0)) {
270
- $output = [Text.Encoding]::UTF8.GetString($buffer, 0, $bytesRead)
271
- if ($output) {
272
- $output
273
- }
274
- if ($bytesRead -lt $buffer.Length) {
275
- # Partial buffer indicating the end of stream, break out of ReadFile loop
276
- # ReadFile will block until:
277
- # The number of bytes requested is read.
278
- # A write operation completes on the write end of the pipe.
279
- # An asynchronous handle is being used and the read is occurring asynchronously.
280
- # An error occurs.
281
- break
282
- }
283
- }
284
- } else {
285
- # For some reason, you can't read from the read-end of the read-pipe before the write end has started
286
- # to write. Otherwise the process just blocks forever and never returns from the read. So we peek
287
- # at the pipe until there is something. But don't peek too eagerly. This is stupid stupid stupid.
288
- # There must be a way to do this without having to peek at a pipe first but I have not found it.
289
- #
290
- # Note to the future intrepid soul who wants to fix this:
291
- # 0) This is related to unreasonable CPU usage by the wrapper PS script on a 1 VCPU VM (either Hyper-V
292
- # or VirtualBox) running a consumer Windows SKU (Windows 10 for example...). Test it there.
293
- # 1) Maybe this entire script is unnecessary and the bugs mentioned below have been fixed or don't need
294
- # to be supported.
295
- # 2) The server and consumer windows schedulers have different defaults. I had a hard time reproducing
296
- # any issue on a win 2008 on win 2012 server default setup. See the "foreground application scheduler
297
- # priority" setting to see if it's relevant.
298
- # 3) This entire endeavor is silly anyway - why are we reimplementing process forking all over? Maybe try
299
- # to get the folks above to accept patches instead of extending this crazy script.
300
- Start-Sleep -s 1
301
- # Start-Sleep -m 100
302
- }
303
-
304
- if ($global:LASTEXITCODE -ne [Chef.Kernel32]::STILL_ACTIVE) {
305
- $isActive = $false
306
- }
307
- }
308
-
309
- # Cleanup handles
310
- $success = [Chef.Kernel32]::CloseHandle($pi.hProcess)
311
- if (-Not $success) {
312
- $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
313
- throw "Unable to release process handle. Error code $reason."
314
- }
315
- $success = [Chef.Kernel32]::CloseHandle($pi.hThread)
316
- if (-Not $success) {
317
- $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
318
- throw "Unable to release thread handle. Error code $reason."
319
- }
320
- $success = [Chef.Kernel32]::CloseHandle($hWriteOut)
321
- if (-Not $success) {
322
- $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
323
- throw "Unable to release output write handle. Error code $reason."
324
- }
325
- $success = [Chef.Kernel32]::CloseHandle($hReadOut)
326
- if (-Not $success) {
327
- $reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
328
- throw "Unable to release output read handle. Error code $reason."
329
- }
330
- [System.Runtime.InteropServices.Marshal]::FreeHGlobal($ptr)
331
- }
332
-
333
- function Get-ScriptDirectory {
334
- if (!$PSScriptRoot) {
335
- $Invocation = (Get-Variable MyInvocation -Scope 1).Value
336
- $PSScriptRoot = Split-Path $Invocation.MyCommand.Path
337
- }
338
- $PSScriptRoot
339
- }
340
-
341
- function Run-RubyCommand($command, $argList) {
342
- # This method exists to take the given list of arguments and get it past ruby's command-line
343
- # interpreter unscathed and untampered. See https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L1582
344
- # for a list of transformations that ruby attempts to perform with your command-line arguments
345
- # before passing it onto a script. The most important task is to defeat the globbing
346
- # and wild-card expansion that ruby performs. Note that ruby does not use MSVCRT's argc/argv
347
- # and deliberately reparses the raw command-line instead.
348
- #
349
- # To stop ruby from interpreting command-line arguments as globs, they need to be enclosed in '
350
- # Ruby doesn't allow any escape characters inside '. This unfortunately prevents us from sending
351
- # any strings which themselves contain '. Ruby does allow multi-fragment arguments though.
352
- # "foo bar"'baz qux'123"foo" is interpreted as 1 argument because there are no un-escaped
353
- # whitespace there. The argument would be interpreted as the string "foo barbaz qux123foo".
354
- # This lets us escape ' characters by exiting the ' quoted string, injecting a "'" fragment and
355
- # then resuming the ' quoted string again.
356
- #
357
- # In the process of defeating ruby, one must also defeat the helpfulness of powershell.
358
- # When arguments come into this method, the standard PS rules for interpreting cmdlet arguments
359
- # apply. When using & (call operator) and providing an array of arguments, powershell (verified
360
- # on PS 4.0 on Windows Server 2012R2) will not evaluate them but (contrary to documentation),
361
- # it will still marginally interpret them. The behavior of PS 5.0 seems to be different but
362
- # ignore that for now. If any of the provided arguments has a space in it, powershell checks
363
- # the first and last character to ensure that they are " characters (and that's all it checks).
364
- # If they are not, it will blindly surround that argument with " characters. It won't do this
365
- # operation if no space is present, even if other special characters are present. If it notices
366
- # leading and trailing " characters, it won't actually check to see if there are other "
367
- # characters in the string. Since PS 5.0 changes this behavior, we could consider using the --%
368
- # "stop screwing up my arguments" operator, which is available since PS 3.0. When encountered
369
- # --% indicates that the rest of line is to be sent literally... except if the parser encounters
370
- # %FOO% cmd style environment variables. Because reasons. And there is no way to escape the
371
- # % character in *any* waym shape or form.
372
- # https://connect.microsoft.com/PowerShell/feedback/details/376207/executing-commands-which-require-quotes-and-variables-is-practically-impossible
373
- #
374
- # In case you think that you're either reading this incorrectly or that I'm full of shit, here
375
- # are some examples. These use EchoArgs.exe from the PowerShell Community Extensions package.
376
- # I have not included the argument parsing output from EchoArgs.exe to prevent confusing you with
377
- # more details about MSVCRT's parsing algorithm.
378
- #
379
- # $x = "foo '' bar `"baz`""
380
- # & EchoArgs @($x, $x)
381
- # Command line:
382
- # "C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx\Apps\EchoArgs.exe" "foo '' bar "baz"" "foo '' bar "baz""
383
- #
384
- # $x = "abc'123'nospace`"lol`"!!!"
385
- # & EchoArgs @($x, $x)
386
- # Command line:
387
- # "C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx\Apps\EchoArgs.exe" abc'123'nospace"lol"!!! abc'123'nospace"lol"!!!
388
- #
389
- # $x = "`"`"Look ma! Tonnes of spaces! 'foo' 'bar'`"`""
390
- # & EchoArgs @($x, $x)
391
- # Command line:
392
- # "C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx\Apps\EchoArgs.exe" ""Look ma! Tonnes of spaces! 'foo' 'bar'"" ""Look ma! Tonnes of spaces! 'foo' 'bar'""
393
- #
394
- # Given all this, we can now device a strategy to work around all these immensely helpful, well
395
- # documented and useful tools by looking at each incoming argument, escaping any ' characters
396
- # with a '"'"' sequence, surrounding each argument with ' & joining them with a space separating
397
- # them.
398
- # There is another bug (https://bugs.ruby-lang.org/issues/11142) that causes ruby to mangle any
399
- # "" two-character double quote sequence but since we always emit our strings inside ' except for
400
- # ' characters, this should be ok. Just remember that an argument '' should get translated to
401
- # ''"'"''"'"'' on the command line. If those intervening empty ''s are not present, the presence
402
- # of "" will cause ruby to mangle that argument.
403
- $transformedList = $argList | foreach { "'" + ( $_ -replace "'","'`"'`"'" ) + "'" }
404
- $fortifiedArgString = $transformedList -join ' '
405
-
406
- # Use the correct embedded ruby path. We'll be deployed at a path that looks like
407
- # [C:\opscode or some other prefix]\chef\modules\chef
408
- $ruby = Join-Path (Get-ScriptDirectory) "..\..\embedded\bin\ruby.exe"
409
- $commandPath = Join-Path (Get-ScriptDirectory) "..\..\bin\$command"
410
-
411
- Run-ExecutableAndWait $ruby """$ruby"" '$commandPath' $fortifiedArgString"
412
- }
413
-
414
-
415
- function chef-apply {
416
- Run-RubyCommand 'chef-apply' $args
417
- }
418
-
419
- function chef-client {
420
- Run-RubyCommand 'chef-client' $args
421
- }
422
-
423
- function chef-service-manager {
424
- Run-RubyCommand 'chef-service-manager' $args
425
- }
426
-
427
- function chef-shell {
428
- Run-RubyCommand 'chef-shell' $args
429
- }
430
-
431
- function chef-solo {
432
- Run-RubyCommand 'chef-solo' $args
433
- }
434
-
435
- function chef-windows-service {
436
- Run-RubyCommand 'chef-windows-service' $args
437
- }
438
-
439
- function knife {
440
- Run-RubyCommand 'knife' $args
441
- }
442
-
443
- Export-ModuleMember -function chef-apply
444
- Export-ModuleMember -function chef-client
445
- Export-ModuleMember -function chef-service-manager
446
- Export-ModuleMember -function chef-shell
447
- Export-ModuleMember -function chef-solo
448
- Export-ModuleMember -function chef-windows-service
449
- Export-ModuleMember -function knife
450
-
451
- # To debug this module, uncomment the line below
452
- # Export-ModuleMember -function Run-RubyCommand
453
-
454
- # Then run the following to reload the module. Use puts_argv as a helpful debug executable.
455
- # Remove-Module chef
456
- # Import-Module chef
457
- # "puts ARGV" | Out-File C:\opscode\chef\bin\puts_args -Encoding ASCII
458
- # Copy-Item C:\opscode\chef\bin\ohai.bat C:\opscode\chef\bin\puts_args.bat
459
- # Run-RubyCommand puts_args 'Here' "are" some '"very interesting"' 'arguments[to]' "`"try out`""
@@ -1 +0,0 @@
1
- The file copy is working!
@@ -1,63 +0,0 @@
1
- #
2
- # Author:: Tim Hinderliter (<tim@chef.io>)
3
- # Copyright:: Copyright (c) Chef Software Inc.
4
- # License:: Apache License, Version 2.0
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- # Wrapper class for interacting with JSON.
19
-
20
- autoload :FFI_Yajl, "ffi_yajl"
21
- require_relative "exceptions"
22
- # We're requiring this to prevent breaking consumers using Hash.to_json
23
- require "json" unless defined?(JSON)
24
-
25
- class Chef
26
- class JSONCompat
27
-
28
- class << self
29
-
30
- def parse(source, opts = {})
31
- FFI_Yajl::Parser.parse(source, opts)
32
- rescue FFI_Yajl::ParseError => e
33
- raise Chef::PowerShellExceptions::JSON::ParseError, e.message
34
- end
35
-
36
- def from_json(source, opts = {})
37
- obj = parse(source, opts)
38
-
39
- # JSON gem requires top level object to be a Hash or Array (otherwise
40
- # you get the "must contain two octets" error). Yajl doesn't impose the
41
- # same limitation. For compatibility, we re-impose this condition.
42
- unless obj.is_a?(Hash) || obj.is_a?(Array)
43
- raise Chef::PowerShellExceptions::JSON::ParseError, "Top level JSON object must be a Hash or Array. (actual: #{obj.class})"
44
- end
45
-
46
- obj
47
- end
48
-
49
- def to_json(obj, opts = nil)
50
- FFI_Yajl::Encoder.encode(obj, opts)
51
- rescue FFI_Yajl::EncodeError => e
52
- raise Chef::PowerShellExceptions::JSON::EncodeError, e.message
53
- end
54
-
55
- def to_json_pretty(obj, opts = nil)
56
- options_map = { pretty: true }
57
- options_map[:indent] = opts[:indent] if opts.respond_to?(:key?) && opts.key?(:indent)
58
- to_json(obj, options_map).chomp
59
- end
60
-
61
- end
62
- end
63
- end