Sha256: ed2967447903e67dfd544e39b7cb8559451365a81649eb07d722df09755b0e20

Contents?: true

Size: 1.02 KB

Versions: 26

Compression:

Stored size: 1.02 KB

Contents

#
# Author:: Greg Zapp (<greg.zapp@gmail.com>)
# Cookbook Name:: windows
# Provider:: feature_powershell
#

include Chef::Provider::WindowsFeature::Base
include Chef::Mixin::PowershellOut
include Windows::Helper

def install_feature(name)
  cmd = powershell_out("Install-WindowsFeature #{@new_resource.feature_name}")
  Chef::Log.info(cmd.stdout)
end

def remove_feature(name)
  cmd = powershell_out("Uninstall-WindowsFeature #{@new_resource.feature_name}")
  Chef::Log.info(cmd.stdout)
end

def delete_feature(name)
  cmd = powershell_out("Uninstall-WindowsFeature #{@new_resource.feature_name} -Remove")
  Chef::Log.info(cmd.stdout)
end

def installed?
  @installed ||= begin
    cmd = powershell_out("Get-WindowsFeature #{@new_resource.feature_name} | Select Installed | % { Write-Host $_.Installed }")
    cmd.stderr.empty? &&  cmd.stdout =~ /True/i
  end
end

def available?
  @available ||= begin
    cmd = powershell_out("Get-WindowsFeature #{@new_resource.feature_name}")
    cmd.stderr.empty? && cmd.stdout !~ /Removed/i
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
madscience-0.0.29 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.28 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.27 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.26 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.25 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.24 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.23 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.21 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.20 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.19 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.17 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.16 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.15 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.14 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.13 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.11 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.10 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.9 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.8 cookbooks/windows/providers/feature_powershell.rb
madscience-0.0.7 cookbooks/windows/providers/feature_powershell.rb