29 changes: 17 additions & 12 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This module has grown over time based on a range of contributions from
people using it. If you follow these contributing guidelines your patch
will likely make it into a release a little quicker.
will likely make it into a release a little more quickly.

## Contributing

Expand Down Expand Up @@ -65,6 +65,10 @@ add tests if you're adding new functionality. If you've not used
[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask
about how best to test your new feature.

To run the linter, the syntax checker and the unit tests:

bundle exec rake test

To run your all the unit tests

bundle exec rake spec SPEC_OPTS='--format documentation'
Expand All @@ -73,10 +77,6 @@ To run a specific spec test set the `SPEC` variable:

bundle exec rake spec SPEC=spec/foo_spec.rb

To run the linter, the syntax checker and the unit tests:

bundle exec rake test

## Integration tests

The unit tests just check the code runs, not that it does exactly what
Expand All @@ -89,15 +89,20 @@ with:

bundle exec rake acceptance

This will run the tests on an Ubuntu 12.04 virtual machine. You can also
run the integration tests against Centos 6.6 with.
This will run the tests on the module's default nodeset. You can override the
nodeset used, e.g.,

BEAKER_set=centos-7-x64 bundle exec rake acceptance

There are default rake tasks for the various acceptance test modules, e.g.,

BEAKER_set=centos-66-x64 bundle exec rake acceptances
bundle exec rake beaker:centos-7-x64
bundle exec rake beaker:ssh:centos-7-x64

If you don't want to have to recreate the virtual machine every time you
can use `BEAKER_DESTROY=no` and `BEAKER_PROVISION=no`. On the first run you will
at least need `BEAKER_PROVISION` set to yes (the default). The Vagrantfile
for the created virtual machines will be in `.vagrant/beaker_vagrant_fies`.
If you don't want to have to recreate the virtual machine every time you can
use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at
least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the
created virtual machines will be in `.vagrant/beaker_vagrant_files`.

The easiest way to debug in a docker container is to open a shell:

Expand Down
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '1.1.0'
modulesync_config_version: '1.8.0'
9 changes: 9 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ AllCops:
- Gemfile
- Rakefile
- Guardfile
- Vagrantfile
Lint/ConditionPosition:
Enabled: True

Expand Down Expand Up @@ -45,6 +46,9 @@ Style/HashSyntax:
Style/RedundantReturn:
Enabled: True

Layout/EndOfLine:
Enabled: False

Lint/AmbiguousOperator:
Enabled: True

Expand Down Expand Up @@ -534,3 +538,8 @@ Security/YAMLLoad:
# This affects hiera interpolation, as well as some configs that we push.
Style/FormatStringToken:
Enabled: false

# This is useful, but sometimes a little too picky about where unit tests files
# are located.
RSpec/FilePath:
Enabled: false
31 changes: 17 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,38 @@ dist: trusty
language: ruby
cache: bundler
before_install:
- bundle -v
- rm Gemfile.lock || true
- gem update --system
- gem update bundler
- gem --version
- bundle -v
- rm -f Gemfile.lock
script:
- 'bundle exec rake $CHECK'
matrix:
fast_finish: true
include:
- rvm: 2.1.9
bundler_args: --without system_tests development
env: PUPPET_VERSION="~> 4.0" CHECK=test
- rvm: 2.4.1
bundler_args: --without system_tests development
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 4.0" CHECK=test PARALLEL_TEST_PROCESSORS=12
- rvm: 2.4.3
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls
- rvm: 2.4.1
bundler_args: --without system_tests development
- rvm: 2.5.0
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=test_with_coveralls
- rvm: 2.4.3
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=rubocop
- rvm: 2.4.1
bundler_args: --without system_tests development
- rvm: 2.4.3
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
branches:
only:
- master
- /^v\d/
notifications:
email: false
irc:
on_success: always
on_failure: always
channels:
- "chat.freenode.org#voxpupuli-notifications"
deploy:
provider: puppetforge
user: puppet
Expand Down
24 changes: 23 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v3.1.0](https://github.com/voxpupuli/puppet-windowsfeature/tree/v3.1.0) (2017-09-21)
## [v3.2.0](https://github.com/voxpupuli/puppet-windowsfeature/tree/v3.2.0) (2018-02-14)
[Full Changelog](https://github.com/voxpupuli/puppet-windowsfeature/compare/v3.1.0...v3.2.0)

**Implemented enhancements:**

- Add support and code for windows 2008 non-r2 [\#104](https://github.com/voxpupuli/puppet-windowsfeature/issues/104)

**Fixed bugs:**

- add Import-Module ServerManager for win2012r2 PS commands [\#110](https://github.com/voxpupuli/puppet-windowsfeature/pull/110) ([devcfgc](https://github.com/devcfgc))

**Closed issues:**

- Windowsfeature gives Corrective change every time [\#111](https://github.com/voxpupuli/puppet-windowsfeature/issues/111)
- UTF8 error with french windows 2012 [\#109](https://github.com/voxpupuli/puppet-windowsfeature/issues/109)
- Missing release [\#107](https://github.com/voxpupuli/puppet-windowsfeature/issues/107)

**Merged pull requests:**

- Resolve UTF8 problem with PowerShell output [\#112](https://github.com/voxpupuli/puppet-windowsfeature/pull/112) ([ahotton](https://github.com/ahotton))

## [v3.1.0](https://github.com/voxpupuli/puppet-windowsfeature/tree/v3.1.0) (2017-09-22)
[Full Changelog](https://github.com/voxpupuli/puppet-windowsfeature/compare/v3.0.0...v3.1.0)

**Closed issues:**
Expand All @@ -14,6 +35,7 @@ These should not affect the functionality of the module.

**Merged pull requests:**

- 3.1.0 release [\#105](https://github.com/voxpupuli/puppet-windowsfeature/pull/105) ([TraGicCode](https://github.com/TraGicCode))
- Remove Windows 2008 Support and Add Windows 2016 Support [\#103](https://github.com/voxpupuli/puppet-windowsfeature/pull/103) ([TraGicCode](https://github.com/TraGicCode))
- Deprecation notice for the restart parameter [\#102](https://github.com/voxpupuli/puppet-windowsfeature/pull/102) ([TraGicCode](https://github.com/TraGicCode))
- Fixing readme markdown formatting issues [\#99](https://github.com/voxpupuli/puppet-windowsfeature/pull/99) ([TraGicCode](https://github.com/TraGicCode))
Expand Down
16 changes: 10 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil)
end

group :test do
gem 'puppetlabs_spec_helper', '~> 2.2.0', :require => false
gem 'puppetlabs_spec_helper', '~> 2.6.0', :require => false
gem 'rspec-puppet', '~> 2.5', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'rspec-puppet-utils', :require => false
Expand All @@ -22,18 +22,13 @@ group :test do
gem 'puppet-lint-unquoted_string-check', :require => false
gem 'puppet-lint-variable_contains_upcase', :require => false
gem 'metadata-json-lint', :require => false
gem 'puppet-blacksmith', :require => false
gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem'
gem 'puppet-strings', '~> 1.0', :require => false
gem 'redcarpet', :require => false
gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0'
gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0'
gem 'mocha', '>= 1.2.1', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'github_changelog_generator', '~> 1.13.0', :require => false if RUBY_VERSION < '2.2.2'
gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2'
gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2'
gem 'parallel_tests', :require => false
end

Expand All @@ -48,6 +43,8 @@ group :system_tests do
gem 'winrm', :require => false
if beaker_version = ENV['BEAKER_VERSION']
gem 'beaker', *location_for(beaker_version)
else
gem 'beaker', '>= 3.9.0', :require => false
end
if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
gem 'beaker-rspec', *location_for(beaker_rspec_version)
Expand All @@ -59,6 +56,13 @@ group :system_tests do
gem 'beaker-module_install_helper', :require => false
end

group :release do
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator' if RUBY_VERSION >= '2.2.2'
gem 'puppet-blacksmith', :require => false
gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem'
gem 'puppet-strings', '~> 1.0', :require => false
end



if facterversion = ENV['FACTER_GEM_VERSION']
Expand Down
42 changes: 39 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet_blacksmith/rake_tasks'
require 'voxpupuli/release/rake_tasks'
require 'puppet-strings/tasks'

# load optional tasks for releases
# only available if gem group releases is installed
begin
require 'puppet_blacksmith/rake_tasks'
require 'voxpupuli/release/rake_tasks'
require 'puppet-strings/tasks'
rescue LoadError
end

PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}'
PuppetLint.configuration.fail_on_warnings = true
Expand All @@ -20,6 +26,12 @@ exclude_paths = %w(
PuppetLint.configuration.ignore_paths = exclude_paths
PuppetSyntax.exclude_paths = exclude_paths

desc 'Auto-correct puppet-lint offenses'
task 'lint:auto_correct' do
PuppetLint.configuration.fix = true
Rake::Task[:lint].invoke
end

desc 'Run acceptance tests'
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = 'spec/acceptance'
Expand All @@ -42,6 +54,27 @@ task test_with_coveralls: [:test] do
end
end

desc "Print supported beaker sets"
task 'beaker_sets', [:directory] do |t, args|
directory = args[:directory]

metadata = JSON.load(File.read('metadata.json'))

(metadata['operatingsystem_support'] || []).each do |os|
(os['operatingsystemrelease'] || []).each do |release|
if directory
beaker_set = "#{directory}/#{os['operatingsystem'].downcase}-#{release}"
else
beaker_set = "#{os['operatingsystem'].downcase}-#{release}-x64"
end

filename = "spec/acceptance/nodesets/#{beaker_set}.yml"

puts beaker_set if File.exists? filename
end
end
end

begin
require 'github_changelog_generator/task'
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
Expand All @@ -50,6 +83,9 @@ begin
config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module."
config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog}
config.user = 'voxpupuli'
metadata_json = File.join(File.dirname(__FILE__), 'metadata.json')
metadata = JSON.load(File.read(metadata_json))
config.project = metadata['name']
end
rescue LoadError
end
Expand Down
13 changes: 3 additions & 10 deletions lib/puppet/provider/windowsfeature/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,7 @@
def self.instances
# an array to store feature hashes
features = []
# set windows 2008 to true/False
win2008 = Facter.value(:kernelmajversion) == '6.1' || Facter.value(:kernelmajversion) == '6.0'
# if win2008 import ServerManager module
result = if win2008 == true
ps('Import-Module ServerManager; Get-WindowsFeature | Select Name,Installed | ConvertTo-XML -As String -Depth 4 -NoTypeInformation')
else
ps('Get-WindowsFeature | ConvertTo-XML -As String -Depth 4 -NoTypeInformation')
end
result = ps('Import-Module ServerManager; Get-WindowsFeature | Select-Object -Property Name, Installed | ConvertTo-XML -As String -Depth 4 -NoTypeInformation')
# create the XML document and parse the objects
xml = Document.new result
xml.root.each_element do |object|
Expand Down Expand Up @@ -70,7 +63,7 @@ def create
win2008 = Facter.value(:kernelmajversion) == '6.1'
# set the install line
array << "Import-Module ServerManager; Add-WindowsFeature #{resource[:name]}" if win2008 == true
array << "Install-WindowsFeature #{resource[:name]}" if win2008 == false
array << "Import-Module ServerManager; Install-WindowsFeature #{resource[:name]}" if win2008 == false
# add restart, subfeatures and a source optionally
array << '-IncludeAllSubFeature' if @resource[:installsubfeatures] == true
array << '-Restart' if @resource[:restart] == true
Expand All @@ -94,7 +87,7 @@ def destroy
win2008 = Facter.value(:kernelmajversion) == '6.1'
# set the uninstall line
array << "Import-Module ServerManager; Remove-WindowsFeature #{resource[:name]}" if win2008 == true
array << "Uninstall-WindowsFeature #{resource[:name]}" if win2008 == false
array << "Import-Module ServerManager; Uninstall-WindowsFeature #{resource[:name]}" if win2008 == false
# add the restart flag optionally
array << '-Restart' if @resource[:restart] == true
# show the created ps string, get the result, show the result (debug)
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-windowsfeature",
"version": "3.1.0",
"version": "3.2.0",
"author": "Vox Pupuli",
"license": "MIT",
"summary": "A module that will turn windows features on or off for Windows Server 2008 and above",
Expand Down
20 changes: 20 additions & 0 deletions spec/acceptance/nodesets/docker/debian-9.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/theforeman/foreman-installer-modulesync
HOSTS:
debian-9-x64:
platform: debian-9-amd64
hypervisor: docker
image: debian:9
docker_preserve_image: true
docker_cmd: '["/sbin/init"]'
docker_image_commands:
- 'apt-get update && apt-get install -y cron locales-all net-tools wget systemd-sysv'
- 'rm -f /usr/sbin/policy-rc.d'
- 'systemctl mask getty@tty1.service getty-static.service'
CONFIG:
trace_limit: 200
masterless: true
...
# vim: syntax=yaml
2 changes: 0 additions & 2 deletions spec/acceptance/nodesets/fedora-25-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
# platform is fedora 24 because there is no
# puppet-agent for fedora 25 by 2016-12-30
HOSTS:
fedora-25-x64:
roles:
Expand Down
16 changes: 16 additions & 0 deletions spec/acceptance/nodesets/fedora-26-x64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
# This file is managed via modulesync
# https://github.com/voxpupuli/modulesync
# https://github.com/voxpupuli/modulesync_config
#
HOSTS:
fedora-26-x64:
roles:
- master
platform: fedora-26-x86_64
box: fedora/26-cloud-base
hypervisor: vagrant
CONFIG:
type: aio
...
# vim: syntax=yaml
Loading