Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/facter/choco_install_path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require Pathname.new(__FILE__).dirname + '../' + 'puppet_x/chocolatey/chocolatey_install'

Facter.add('choco_install_path') do
confine osfamily: :windows
confine 'os.family': :windows
setcode do
PuppetX::Chocolatey::ChocolateyInstall.install_path || 'C:\ProgramData\chocolatey'
end
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/choco_temp_dir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require Pathname.new(__FILE__).dirname + '../' + 'puppet_x/chocolatey/chocolatey_install'

Facter.add('choco_temp_dir') do
confine osfamily: :windows
confine 'os.family': :windows
setcode do
PuppetX::Chocolatey::ChocolateyInstall.temp_dir || ENV.fetch('TEMP', nil)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/chocolateyversion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require Pathname.new(__FILE__).dirname + '../' + 'puppet_x/chocolatey/chocolatey_version'

Facter.add('chocolateyversion') do
confine osfamily: :windows
confine 'os.family': :windows
setcode do
choco_ver = PuppetX::Chocolatey::ChocolateyVersion.version || '0'
choco_ver.to_s
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/chocolateyconfig/windows.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Puppet::Type.type(:chocolateyconfig).provide(:windows) do
@doc = 'Windows based provider for chocolateyconfig type.'

confine operatingsystem: :windows
confine 'os.name': :windows
defaultfor operatingsystem: :windows

require Pathname.new(__FILE__).dirname + '../../../' + 'puppet_x/chocolatey/chocolatey_common'
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
{
"name": "puppetlabs/ruby_task_helper",
"version_requirement": ">= 0.4.0 < 1.0.0"
"version_requirement": ">= 0.4.0 <= 1.0.0"
}
],
"operatingsystem_support": [
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/puppet/provider/chocolateyconfig/windows_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
before(:each) do
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
allow(File).to receive(:read).with(choco_config).and_return(choco_config_contents)
allow(File).to receive(:open).with(choco_config).and_return(StringIO.new(choco_config_contents))
end

it 'matches the count of configs in the config' do
Expand Down Expand Up @@ -248,7 +248,7 @@
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:set_env_chocolateyinstall).at_most(:once)
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config).at_most(:once)
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true).at_most(:once)
allow(File).to receive(:read).with(choco_config).and_return(choco_config_contents).at_most(:once)
allow(File).to receive(:open).with(choco_config).and_return(StringIO.new(choco_config_contents)).at_most(:once)

resource[:name] = resource_name
resource[:value] = resource_value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
before :each do
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
allow(File).to receive(:read).with(choco_config).and_return(choco_config_contents)
allow(File).to receive(:open).with(choco_config).and_return(StringIO.new(choco_config_contents))

features = provider_class.read_choco_features
end
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/puppet/provider/chocolateysource/windows_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
before :each do
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
allow(File).to receive(:read).with(choco_config).and_return choco_config_contents
allow(File).to receive(:open).with(choco_config).and_return(StringIO.new(choco_config_contents))

sources = provider_class.read_sources
end
Expand Down Expand Up @@ -511,7 +511,7 @@
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:set_env_chocolateyinstall).at_most(:once)
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config).at_most(:once)
allow(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true).at_most(:once)
allow(File).to receive(:read).with(choco_config).and_return(choco_config_contents).at_most(:once)
allow(File).to receive(:open).with(choco_config).and_return(StringIO.new(choco_config_contents)).at_most(:once)

resource[:name] = resource_name
resource[:location] = resource_location
Expand Down
18 changes: 9 additions & 9 deletions spec/unit/puppet/provider/package/chocolatey_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:set_env_chocolateyinstall)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
expect(File).to receive(:read).with(choco_config).and_return choco_config_contents
expect(File).to receive(:open).with(choco_config).and_return StringIO.new(choco_config_contents)

choco_features = provider.read_choco_features
expect(choco_features.count).to eq 14
Expand All @@ -170,7 +170,7 @@
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:set_env_chocolateyinstall)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
expect(File).to receive(:read).with(choco_config).and_return choco_config_contents
expect(File).to receive(:open).with(choco_config).and_return StringIO.new(choco_config_contents)

choco_features = provider.read_choco_features
expect(choco_features[0]).to be_an_instance_of REXML::Element
Expand Down Expand Up @@ -212,7 +212,7 @@
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:set_env_chocolateyinstall)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
expect(File).to receive(:read).with(choco_config).and_return choco_config_contents
expect(File).to receive(:open).with(choco_config).and_return StringIO.new(choco_config_contents)
expect(provider.choco_features.count).to eq 14
provider.choco_features[0].is_a?(Hash)
end
Expand Down Expand Up @@ -240,7 +240,7 @@
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:set_env_chocolateyinstall).twice
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
expect(File).to receive(:read).with(choco_config).and_return choco_config_contents
expect(File).to receive(:open).with(choco_config).and_return StringIO.new(choco_config_contents)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_version).and_return(minimum_supported_choco_exit_codes).at_least(:once)
resource[:ensure] = :present
expect(provider).to receive(:chocolatey).with('install', 'chocolatey', '-y', nil, '--ignore-package-exit-codes')
Expand All @@ -252,7 +252,7 @@
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:set_env_chocolateyinstall).twice
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
expect(File).to receive(:read).with(choco_config).and_return choco_config_contents
expect(File).to receive(:open).with(choco_config).and_return StringIO.new(choco_config_contents)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_version).and_return(choco_zero_ten_zero).at_least(:once)
resource[:ensure] = :present
expect(provider).to receive(:chocolatey).with('install', 'chocolatey', '-y', nil, '--ignore-package-exit-codes')
Expand All @@ -264,7 +264,7 @@
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:set_env_chocolateyinstall).twice
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
expect(File).to receive(:read).with(choco_config).and_return choco_config_contents_upec
expect(File).to receive(:open).with(choco_config).and_return choco_config_contents_upec
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_version).and_return(choco_zero_ten_zero).at_least(:once)
resource[:ensure] = :present
expect(provider).to receive(:chocolatey).with('install', 'chocolatey', '-y', nil)
Expand All @@ -276,7 +276,7 @@
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:set_env_chocolateyinstall).twice
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
expect(File).to receive(:read).with(choco_config).and_return choco_config_contents
expect(File).to receive(:open).with(choco_config).and_return StringIO.new(choco_config_contents)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_version).and_return(minimum_supported_choco_no_progress).at_least(:once)
resource[:ensure] = :present
expect(provider).to receive(:chocolatey).with('install', 'chocolatey', '-y', nil, '--ignore-package-exit-codes', '--no-progress')
Expand All @@ -288,7 +288,7 @@
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:set_env_chocolateyinstall).twice
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
expect(File).to receive(:read).with(choco_config).and_return choco_config_contents
expect(File).to receive(:open).with(choco_config).and_return StringIO.new(choco_config_contents)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_version).and_return(choco_zero_eleven_zero).at_least(:once)
resource[:ensure] = :present
expect(provider).to receive(:chocolatey).with('install', 'chocolatey', '-y', nil, '--ignore-package-exit-codes', '--no-progress')
Expand All @@ -300,7 +300,7 @@
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:set_env_chocolateyinstall).twice
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_config_file).and_return(choco_config)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:file_exists?).with(choco_config).and_return(true)
expect(File).to receive(:read).with(choco_config).and_return choco_config_contents
expect(File).to receive(:open).with(choco_config).and_return StringIO.new(choco_config_contents)
expect(PuppetX::Chocolatey::ChocolateyCommon).to receive(:choco_version).and_return(minimum_supported_choco_no_progress).at_least(:once)
resource[:ensure] = :present
resource[:package_settings] = { 'verbose' => true }
Expand Down
Loading