Skip to content

Commit 02c6484

Browse files
authored
wsusserver_install: Remove DSC dependency (#54)
* Remove DSC dependency The DSC module is no longer recommended by Puppet. It requires syncing thousands of files to every computer that checks into a given Puppet environment. Thankfully its use was rather trivial here and can easily be replaced by the dedicated windowsfeature module. Thanks to Kevin Reeuwijk for initially raising this issue and putting in a PR. * Update tests to use windowsfeature instead of DSC
1 parent 8350e33 commit 02c6484

File tree

4 files changed

+20
-26
lines changed

4 files changed

+20
-26
lines changed

.fixtures.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ fixtures:
22
repositories:
33
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
44
powershell: 'https://github.com/puppetlabs/puppetlabs-powershell.git'
5-
dsc: 'https://github.com/puppetlabs/puppetlabs-dsc.git'
5+
windowsfeature: 'https://github.com/voxpupuli/puppet-windowsfeature.git'
66
symlinks:
77
wsusserver: "#{source_dir}"

manifests/install.pp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,18 @@
88
Boolean $join_improvement_program = $wsusserver::params::join_improvement_program,
99
) inherits wsusserver::params {
1010

11-
dsc_windowsfeature { 'UpdateServices':
12-
dsc_ensure => $package_ensure,
13-
dsc_name => 'UpdateServices',
14-
notify => Exec["post install wsus content directory ${wsus_directory}"],
11+
windowsfeature { 'UpdateServices':
12+
ensure => $package_ensure,
13+
notify => Exec["post install wsus content directory ${wsus_directory}"],
1514
}
1615

1716
$_management_console_ensure = $include_management_console ? {
1817
true => 'present',
1918
default => 'absent',
2019
}
21-
dsc_windowsfeature { 'UpdateServices-UI':
22-
dsc_ensure => $_management_console_ensure,
23-
dsc_name => 'UpdateServices-UI',
24-
require => Dsc_windowsfeature['UpdateServices'],
20+
windowsfeature { 'UpdateServices-UI':
21+
ensure => $_management_console_ensure,
22+
require => Windowsfeature['UpdateServices'],
2523
}
2624

2725
$join_improvement_program_flag = bool2num($join_improvement_program)
@@ -40,6 +38,6 @@
4038
refreshonly => true,
4139
timeout => 1200,
4240
provider => 'powershell',
43-
require => [Dsc_windowsfeature['UpdateServices'], Dsc_windowsfeature['UpdateServices-UI']]
41+
require => [Windowsfeature['UpdateServices'], Windowsfeature['UpdateServices-UI']]
4442
}
45-
}
43+
}

metadata.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"version_requirement": ">= 2.0.0 < 5.0.0"
1818
},
1919
{
20-
"name": "puppetlabs/dsc",
21-
"version_requirement": ">= 1.0.0 < 2.0.0"
20+
"name": "puppet/windowsfeature",
21+
"version_requirement": "3.x"
2222
}
2323
],
2424
"operatingsystem_support": [
@@ -36,4 +36,4 @@
3636
"version_requirement": ">= 4.7.1 < 8.0.0"
3737
}
3838
]
39-
}
39+
}

spec/classes/install_spec.rb

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
it { is_expected.to contain_class('wsusserver::params') }
77

88
it {
9-
is_expected.to contain_dsc_windowsfeature('UpdateServices')
10-
.with(dsc_ensure: 'present',
11-
dsc_name: 'UpdateServices')
9+
is_expected.to contain_windowsfeature('UpdateServices')
10+
.with(ensure: 'present',)
1211
}
1312

1413
it {
15-
is_expected.to contain_dsc_windowsfeature('UpdateServices-UI')
16-
.with(dsc_ensure: 'present',
17-
dsc_name: 'UpdateServices-UI')
14+
is_expected.to contain_windowsfeature('UpdateServices-UI')
15+
.with(ensure: 'present',)
1816
}
1917

2018
it {
@@ -35,9 +33,8 @@
3533
end
3634

3735
it {
38-
is_expected.to contain_dsc_windowsfeature('UpdateServices')
39-
.with(dsc_ensure: 'absent',
40-
dsc_name: 'UpdateServices')
36+
is_expected.to contain_windowsfeature('UpdateServices')
37+
.with(ensure: 'absent',)
4138
}
4239
# TODO: I should uninstall this feature if the whole thing is getting uninstalled
4340
# it { should contain_dsc_windowsfeature('UpdateServices-UI').with({
@@ -54,9 +51,8 @@
5451
end
5552

5653
it {
57-
is_expected.to contain_dsc_windowsfeature('UpdateServices-UI')
58-
.with(dsc_ensure: 'absent',
59-
dsc_name: 'UpdateServices-UI')
54+
is_expected.to contain_windowsfeature('UpdateServices-UI')
55+
.with(ensure: 'absent',)
6056
}
6157
end
6258
end

0 commit comments

Comments
 (0)