6 changes: 6 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
Rakefile:
unmanaged: true
Gemfile:
optional:
':system_tests':
- gem: beaker-testmode_switcher
version: '~> 0.4'
- gem: master_manipulator
spec/spec_helper.rb:
unmanaged: true
appveyor.yml:
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

## Unreleased

## [2.0.2] - 2018-08-08
### Added
- Add Windows Server 2016 and Windows 10 as supported Operating Systems ([MODULES-4271](https://tickets.puppetlabs.com/browse/MODULES-4271))

### Changed
- Convert tests to use testmode switcher ([MODULES-6744](https://tickets.puppetlabs.com/browse/MODULES-6744))

### Fixed
- Fix types to no longer use unsupported proc title patterns ([MODULES-6818](https://tickets.puppetlabs.com/browse/MODULES-6818))
- Fix acceptance tests in master-agent scenarios ([FM-6934](https://tickets.puppetlabs.com/browse/FM-6934))
- Use case insensitive search when purging ([MODULES-7534](https://tickets.puppetlabs.com/browse/MODULES-7534))

### Removed

## [2.0.1] - 2018-01-25
### Fixed
- Fix the restrictive typing introduced for the registry::value defined type to once again allow numeric values to be specified for DWORD, QWORD and arrays for REG_MULTI_SZ values ([MODULES-6528](https://tickets.puppetlabs.com/browse/MODULES-6528))
Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ group :system_tests do
gem "beaker-pe", :require => false
gem "beaker-rspec", *location_for(ENV['BEAKER_RSPEC_VERSION'])
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'])
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
gem "beaker-testmode_switcher", '~> 0.4', :require => false
gem 'master_manipulator', :require => false
gem "puppet-blacksmith", '~> 3.4', :require => false
end

Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/type/registry_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
EOT

def self.title_patterns
[ [ /^(.*?)\Z/m, [ [ :path, lambda{|x| x} ] ] ] ]
[ [ /^(.*?)\Z/m, [ [ :path ] ] ] ]
end

ensurable
Expand Down Expand Up @@ -103,7 +103,7 @@ def eval_generate

# get the "should" names of registry values associated with this key
should_values = catalog.relationship_graph.direct_dependents_of(self).select {|dep| dep.type == :registry_value }.map do |reg|
PuppetX::Puppetlabs::Registry::RegistryValuePath.new(reg.parameter(:path).value).valuename
PuppetX::Puppetlabs::Registry::RegistryValuePath.new(reg.parameter(:path).value).valuename.downcase
end

# get the "is" names of registry values associated with this key
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/type/registry_value.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
EOT

def self.title_patterns
[[/^(.*?)\Z/m, [[:path, lambda { |x| x }]]]]
[[/^(.*?)\Z/m, [[:path]]]]
end

ensurable
Expand Down
4 changes: 2 additions & 2 deletions manifests/value.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
Optional[Variant[
String,
Numeric,
Array[Variant[String]
]]] $data = undef,
Array[String]
]] $data = undef,
) {

# ensure windows os
Expand Down
6 changes: 4 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-registry",
"version": "2.0.1",
"version": "2.0.2",
"author": "Puppet Inc",
"summary": "This module provides a native type and provider to manage keys and values in the Windows Registry",
"license": "Apache-2.0",
Expand All @@ -15,8 +15,10 @@
"Server 2008 R2",
"Server 2012",
"Server 2012 R2",
"Server 2016",
"7",
"8"
"8",
"10"
]
}
],
Expand Down
14 changes: 7 additions & 7 deletions spec/acceptance/should_create_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@
]

windows_agents.each do |agent|
keys_created = keys_created_native + (is_x64(agent) ? keys_created_wow : [])
values_purged = values_purged_native + (is_x64(agent) ? values_purged_wow : [])
agent_is_x64 = is_x64(agent)
keys_created = keys_created_native + (agent_is_x64 ? keys_created_wow : [])
values_purged = values_purged_native + (agent_is_x64 ? values_purged_wow : [])

it 'Registry - Phase 1.a - Create some keys' do
apply_manifest_on(agent, phase1, get_apply_opts) do
execute_manifest_on(agent, phase1, get_apply_opts) do
keys_created.each do |key_re|
assert_match(key_re, @result.stdout, "Expected #{key_re.inspect} to match the output. (First Run)")
end
Expand All @@ -116,7 +117,7 @@

it 'Registry - Phase 1.b - Make sure Puppet is idempotent' do
# Do a second run and make sure the key isn't created a second time.
apply_manifest_on(agent, phase1, get_apply_opts) do
execute_manifest_on(agent, phase1, get_apply_opts) do
keys_created.each do |key_re|
assert_no_match(key_re, @result.stdout,
"Expected #{key_re.inspect} NOT to match the output. (First Run)")
Expand All @@ -126,7 +127,7 @@
end

it 'Registry - Phase 2 - Make sure purge_values works' do
apply_manifest_on(agent, phase2, get_apply_opts({'FACTER_FACT_PHASE' => '2'})) do
execute_manifest_on(agent, phase2, get_apply_opts({'FACTER_FACT_PHASE' => '2'})) do
values_purged.each do |val_re|
assert_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand All @@ -135,11 +136,10 @@
end

it 'Registry - Phase 3 - Should clean up' do
apply_manifest_on(agent, phase3, get_apply_opts({'FACTER_FACT_PHASE' => '3'})) do
execute_manifest_on(agent, phase3, get_apply_opts({'FACTER_FACT_PHASE' => '3'})) do
assert_no_match(/err:/, @result.stdout, 'Expected no error messages.')
end
end
end
end
end

9 changes: 4 additions & 5 deletions spec/acceptance/should_have_defined_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
]
windows_agents.each do |agent|
it 'Phase 1.a - Create some values' do
apply_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do
execute_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do
phase1_resources_created.each do |val_re|
assert_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand All @@ -60,7 +60,7 @@
end

it 'Phase 1.b - Make sure Puppet is idempotent' do
apply_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do
execute_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do
phase1_resources_created.each do |val_re|
assert_no_match(val_re, @result.stdout, "Expected output not to contain #{val_re.inspect}.")
end
Expand All @@ -69,7 +69,7 @@
end

it 'Phase 2.a - Change some values' do
apply_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '2'}) do
execute_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '2'}) do
phase2_resources_changed.each do |val_re|
assert_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand All @@ -78,7 +78,7 @@
end

it 'Phase 2.b - Make sure Puppet is idempotent' do
apply_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '2'}) do
execute_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '2'}) do
(phase1_resources_created + phase2_resources_changed).each do |val_re|
assert_no_match(val_re, @result.stdout, "Expected output not to contain #{val_re.inspect}.")
end
Expand All @@ -88,4 +88,3 @@
end
end
end

9 changes: 4 additions & 5 deletions spec/acceptance/should_manage_values_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def getManifest(keypath, vendor_path, phase)


it 'Registry Values - Phase 1.a - Create some values' do
apply_manifest_on agent, getManifest(keypath, vendor_path, '1'), get_apply_opts do
execute_manifest_on agent, getManifest(keypath, vendor_path, '1'), get_apply_opts do
assert_no_match(/err:/, @result.stdout, 'Expected no error messages.')
phase1_resources_created.each do |val_re|
assert_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
Expand All @@ -278,7 +278,7 @@ def getManifest(keypath, vendor_path, phase)
end

it 'Registry Values - Phase 1.b - Make sure Puppet is idempotent' do
apply_manifest_on agent, getManifest(keypath, vendor_path, '1'), get_apply_opts do
execute_manifest_on agent, getManifest(keypath, vendor_path, '1'), get_apply_opts do
phase1_resources_created.each do |val_re|
assert_no_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand All @@ -287,7 +287,7 @@ def getManifest(keypath, vendor_path, phase)
end

it 'Registry Values - Phase 2.a - Change some values' do
apply_manifest_on agent, getManifest(keypath, vendor_path, '2'), get_apply_opts do
execute_manifest_on agent, getManifest(keypath, vendor_path, '2'), get_apply_opts do
assert_no_match(/err:/, @result.stdout, 'Expected no error messages.')
phase2_resources_changed.each do |val_re|
assert_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
Expand All @@ -296,7 +296,7 @@ def getManifest(keypath, vendor_path, phase)
end

it 'Registry Values - Phase 2.b - Make sure Puppet is idempotent' do
apply_manifest_on agent, getManifest(keypath, vendor_path, '2'), get_apply_opts do
execute_manifest_on agent, getManifest(keypath, vendor_path, '2'), get_apply_opts do
phase2_resources_changed.each do |val_re|
assert_no_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand All @@ -321,4 +321,3 @@ def getManifest(keypath, vendor_path, phase)
end
end
end

2 changes: 1 addition & 1 deletion spec/acceptance/should_tolerate_mixed_case_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
end

it "Registry Tolerate Mixed Case Values - Phase 1.a - Create some values" do
apply_manifest_on agent, phase1, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do |result|
execute_manifest_on agent, phase1, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do |result|
phase1_resources_created.each do |val_re|
assert_match(val_re, result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand Down
20 changes: 9 additions & 11 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
require 'beaker-rspec'
require 'beaker/puppet_install_helper'
require 'beaker/module_install_helper'
require 'beaker/testmode_switcher'
require 'beaker/testmode_switcher/dsl'

run_puppet_install_helper

install_module_dependencies_on(hosts)

test_name "Installing Puppet Modules" do
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
hosts.each do |host|
if host['platform'] =~ /windows/
on host, "mkdir -p #{host['distmoduledir']}/registry"
target = (on host, "echo #{host['distmoduledir']}/registry").raw_output.chomp
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
staging = { module_name: 'puppetlabs-registry' }
local = { module_name: 'registry', source: proj_root }

%w(lib manifests metadata.json).each do |file|
scp_to host, "#{proj_root}/#{file}", target
end
end
end
hosts.each do |host|
# Install Registry Module
# in CI allow install from staging forge, otherwise from local
install_dev_puppet_module_on(host, options[:forge_host] ? staging : local)
end

def is_x64(agent)
Expand Down
2 changes: 1 addition & 1 deletion spec/unit/puppet/type/registry_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
key[:purge_values] = true
catalog.add_resource(key)
catalog.add_resource(Puppet::Type.type(:registry_value).new(:path => "#{key[:path]}\\val1", :catalog => catalog))
catalog.add_resource(Puppet::Type.type(:registry_value).new(:path => "#{key[:path]}\\val2", :catalog => catalog))
catalog.add_resource(Puppet::Type.type(:registry_value).new(:path => "#{key[:path]}\\vAl2", :catalog => catalog))
catalog.add_resource(Puppet::Type.type(:registry_value).new(:path => "#{key[:path]}\\\\val\\3", :catalog => catalog))
end

Expand Down