diff options
Diffstat (limited to 'distro/powershell/chef.psm1')
-rw-r--r-- | distro/powershell/chef.psm1 | 61 |
1 files changed, 37 insertions, 24 deletions
diff --git a/distro/powershell/chef.psm1 b/distro/powershell/chef.psm1 index cdcaed55bb..670667b7a2 100644 --- a/distro/powershell/chef.psm1 +++ b/distro/powershell/chef.psm1 @@ -1,24 +1,4 @@ -function chef-client { - <# - .SYNOPSIS - A chef-client is an agent that runs locally on every node that is under management by Chef. - .DESCRIPTION - When a chef-client is run, it will perform all of the steps that are required to bring the node into the expected state, including: - - Registering and authenticating the node with the Chef server - Building the node object - Synchronizing cookbooks - Compiling the resource collection by loading each of the required cookbooks, including recipes, attributes, and all other dependencies - Taking the appropriate and required actions to configure the node - Looking for exceptions and notifications, handling each as required - .EXAMPLE - chef-client --help - #> - [CmdletBinding()] - param ( - [parameter(ValueFromRemainingArguments=$true)] $All - ) - +function Run-Command($command, $argList) { # Take each input string, escape any \ ' or " character in it and then surround it with "s. # This is to defeat the second-level parsing performed by the MSVCRT argument parser used # by ruby which only understands \ ' and ". @@ -29,6 +9,39 @@ # The replacement pattern must be '\$1' and not "\$1" because $1 is not a real variable # that needs substituting - it's a capture group that's interpreted by the regex engine. # \ in the replacement pattern does not need to be escaped - it is literally substituted. - $Transformed = $All | foreach { '"' + ( $_ -replace "([\\'""])",'\$1' ) + '"' } - & "ruby.exe" "chef-client" $Transformed -}
\ No newline at end of file + $transformed = $argList | foreach { '"' + ( $_ -replace "([\\'""])",'\$1' ) + '"' } + #& "echoargs.exe" $transformed + & "ruby.exe" $command $transformed +} + + +function chef-apply { + Run-Command 'chef-apply' $args +} + +function chef-client { + Run-Command 'chef-client' $args +} + +function chef-service-manager { + Run-Command 'chef-service-manager' $args +} + +function chef-shell { + Run-Command 'chef-shell' $args +} + +function chef-solo { + Run-Command 'chef-solo' $args +} + +function chef-windows-service { + Run-Command 'chef-windows-service' $args +} + +function knife { + Run-Command 'knife' $args +} + +Export-ModuleMember -function chef-* +Export-ModuleMember -function knife
\ No newline at end of file |