diff options
author | Tim Smith <tsmith@chef.io> | 2020-02-24 17:29:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-24 17:29:01 -0800 |
commit | 452b131478e707cb320b53f25951d5d3b7c26262 (patch) | |
tree | c8c439ad924cb8c12726e6342627c2e377e9a0c2 | |
parent | 7b45cbe3a758741ed9a07a8b7542ccb037235c3e (diff) | |
parent | ba1f7c0d3afb0b82185c60f4367dd8b0936ebc42 (diff) | |
download | chef-452b131478e707cb320b53f25951d5d3b7c26262.tar.gz |
Merge pull request #9065 from cinc-project/dist_windows_powershell_wrapper
Dist windows powershell wrapper
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Rakefile | 9 | ||||
-rw-r--r-- | distro/templates/powershell/chef/chef.psm1.erb (renamed from distro/powershell/chef/chef.psm1) | 36 |
3 files changed, 28 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore index a72dd9f33b..52705a76ef 100644 --- a/.gitignore +++ b/.gitignore @@ -80,6 +80,7 @@ docs_site # Rendered Templates ext/win32-eventlog/chef-log.man +distro/powershell/chef/chef.psm1 # tool logs ext/win32-eventlog/mkmf.log @@ -22,6 +22,7 @@ begin require_relative "tasks/dependencies" require_relative "tasks/announce" require_relative "tasks/docs" + require_relative "lib/chef/dist" rescue LoadError => e puts "Skipping missing rake dep: #{e}" end @@ -35,6 +36,14 @@ task :super_install do Dir.chdir(path) sh("rake install") end + +# Templating the powershell extensions so we can inject distro constants + template_file = ::File.join(::File.dirname(__FILE__), "distro", "templates", "powershell", "chef", "chef.psm1.erb") + psm1_path = ::File.join(::File.dirname(__FILE__), "distro", "powershell", "chef") + FileUtils.mkdir_p psm1_path + template = ERB.new(IO.read(template_file)) + chef_psm1 = template.result + File.open(::File.join(psm1_path, "chef.psm1"), "w") { |f| f.write(chef_psm1) } end task install: :super_install diff --git a/distro/powershell/chef/chef.psm1 b/distro/templates/powershell/chef/chef.psm1.erb index 05fee05e5e..652dec04f6 100644 --- a/distro/powershell/chef/chef.psm1 +++ b/distro/templates/powershell/chef/chef.psm1.erb @@ -412,40 +412,40 @@ function Run-RubyCommand($command, $argList) { } -function chef-apply { - Run-RubyCommand 'chef-apply' $args +function <%= Chef::Dist::APPLY %> { + Run-RubyCommand '<%= Chef::Dist::APPLY %>' $args } -function chef-client { - Run-RubyCommand 'chef-client' $args +function <%= Chef::Dist::CLIENT %> { + Run-RubyCommand '<%= Chef::Dist::CLIENT %>' $args } -function chef-service-manager { - Run-RubyCommand 'chef-service-manager' $args +function <%= Chef::Dist::EXEC %>-service-manager { + Run-RubyCommand '<%= Chef::Dist::EXEC %>-service-manager' $args } -function chef-shell { - Run-RubyCommand 'chef-shell' $args +function <%= Chef::Dist::SHELL %> { + Run-RubyCommand '<%= Chef::Dist::SHELL %>' $args } -function chef-solo { - Run-RubyCommand 'chef-solo' $args +function <%= Chef::Dist::SOLOEXEC %> { + Run-RubyCommand '<%= Chef::Dist::SOLOEXEC %>' $args } -function chef-windows-service { - Run-RubyCommand 'chef-windows-service' $args +function <%= Chef::Dist::EXEC %>-windows-service { + Run-RubyCommand '<%= Chef::Dist::EXEC %>-windows-service' $args } function knife { Run-RubyCommand 'knife' $args } -Export-ModuleMember -function chef-apply -Export-ModuleMember -function chef-client -Export-ModuleMember -function chef-service-manager -Export-ModuleMember -function chef-shell -Export-ModuleMember -function chef-solo -Export-ModuleMember -function chef-windows-service +Export-ModuleMember -function <%= Chef::Dist::APPLY %> +Export-ModuleMember -function <%= Chef::Dist::CLIENT %> +Export-ModuleMember -function <%= Chef::Dist::EXEC %>-service-manager +Export-ModuleMember -function <%= Chef::Dist::SHELL %> +Export-ModuleMember -function <%= Chef::Dist::SOLOEXEC %> +Export-ModuleMember -function <%= Chef::Dist::EXEC %>-windows-service Export-ModuleMember -function knife # To debug this module, uncomment the line below |