Class: Puppet::Provider::Iispowershell
- Inherits:
-
Puppet::Provider
- Object
- Puppet::Provider
- Puppet::Provider::Iispowershell
- Defined in:
- lib/puppet/provider/iispowershell.rb
Class Method Summary collapse
- .args ⇒ Object
- .native_path(path) ⇒ Object
- .run(command, _check = false) ⇒ Object
- .write_script(content) ⇒ Object
Class Method Details
.args ⇒ Object
33 34 35 |
# File 'lib/puppet/provider/iispowershell.rb', line 33 def self.args '-NoProfile -NonInteractive -NoLogo -ExecutionPolicy Bypass' end |
.native_path(path) ⇒ Object
29 30 31 |
# File 'lib/puppet/provider/iispowershell.rb', line 29 def self.native_path(path) path.gsub(File::SEPARATOR, File::ALT_SEPARATOR) end |
.run(command, _check = false) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/puppet/provider/iispowershell.rb', line 14 def self.run(command, _check = false) write_script(command) do |native_path| psh = "cmd.exe /c \"\"#{native_path(command(:powershell))}\" #{args} -Command - < \"#{native_path}\"\"" return `#{psh}` end end |
.write_script(content) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/puppet/provider/iispowershell.rb', line 21 def self.write_script(content) Tempfile.open(['puppet-powershell', '.ps1']) do |file| file.write(content) file.flush yield native_path(file.path) end end |