Skip to content

Commit fa13eaa

Browse files
authored
Merge pull request #273 from puppetlabs/CONT-362-Syntax_update
(CONT-362) Syntax update
2 parents 2b2b042 + 687f01e commit fa13eaa

File tree

10 files changed

+39
-60
lines changed

10 files changed

+39
-60
lines changed

.puppet-lint.rc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
11
--relative
2-
--no-parameter_types-check
3-
--no-parameter_documentation-check
4-
--no-top_scope_facts-check
5-
--no-legacy_facts-check
6-
--no-relative_classname_inclusion-check
7-
--no-unquoted_string_in_selector-check
8-
--no-unquoted_string_in_case-check

.sync.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,3 @@ spec/spec_helper.rb:
2828
unmanaged: false
2929
.travis.yml:
3030
delete: true
31-
Rakefile:
32-
extra_disabled_lint_checks:
33-
- parameter_types
34-
- parameter_documentation
35-
- top_scope_facts
36-
- legacy_facts
37-
- relative_classname_inclusion
38-
- unquoted_string_in_selector
39-
- unquoted_string_in_case

Rakefile

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ def changelog_future_release
4242
end
4343

4444
PuppetLint.configuration.send('disable_relative')
45-
PuppetLint.configuration.send('disable_parameter_types')
46-
PuppetLint.configuration.send('disable_parameter_documentation')
47-
PuppetLint.configuration.send('disable_top_scope_facts')
48-
PuppetLint.configuration.send('disable_legacy_facts')
49-
PuppetLint.configuration.send('disable_relative_classname_inclusion')
50-
PuppetLint.configuration.send('disable_unquoted_string_in_selector')
51-
PuppetLint.configuration.send('disable_unquoted_string_in_case')
52-
5345

5446
if Bundler.rubygems.find_name('github_changelog_generator').any?
5547
GitHubChangelogGenerator::RakeTask.new :changelog do |config|

examples/compliance_example.pp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
# include registry::compliance_example
1616
#
1717
# (MARKUP: http://links.puppetlabs.com/puppet_manifest_documentation)
18-
class { '::registry': }
18+
class { 'registry': }
1919

2020
$key_path = 'HKLM\Software\Vendor\Puppet Labs\Examples\Compliance'
2121

22-
case $::registry_compliance_example_mode {
23-
audit: {
22+
case $registry_compliance_example_mode {
23+
'audit': {
2424
$mode = 'audit'
2525
}
2626
default: {
@@ -40,29 +40,29 @@
4040
# Resource Defaults
4141
Registry_key {
4242
ensure => $mode ? {
43-
setup => present,
43+
'setup' => present,
4444
default => undef,
4545
},
4646
purge_values => $mode ? {
47-
setup => true,
47+
'setup' => true,
4848
default => false,
4949
},
5050
}
5151
Registry_value {
5252
ensure => $mode ? {
53-
setup => present,
53+
'setup' => present,
5454
default => undef,
5555
},
5656
type => $mode ? {
57-
setup => string,
57+
'setup' => string,
5858
default => undef,
5959
},
6060
data => $mode ? {
61-
setup => 'Puppet Default Data',
61+
'setup' => 'Puppet Default Data',
6262
default => undef,
6363
},
6464
audit => $mode ? {
65-
setup => undef,
65+
'setup' => undef,
6666
default => all,
6767
},
6868
}

examples/purge_example.pp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
# include registry::purge_example
3232
#
3333
# (MARKUP: http://links.puppetlabs.com/puppet_manifest_documentation)
34-
class { '::registry': }
34+
class { 'registry': }
3535

3636
$key_path = 'HKLM\Software\Vendor\Puppet Labs\Examples\KeyPurge'
3737

38-
case $::purge_example_mode {
39-
setup: {
38+
case $purge_example_mode {
39+
'setup': {
4040
registry_key { $key_path:
4141
ensure => present,
4242
purge_values => false,
@@ -86,7 +86,7 @@
8686
data => '01AB CDEF',
8787
}
8888
}
89-
purge: {
89+
'purge': {
9090
registry_key { $key_path:
9191
ensure => present,
9292
purge_values => true,

examples/registry_examples.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# include registry_example
1414
#
1515
# (MARKUP: http://links.puppetlabs.com/puppet_manifest_documentation)
16-
class { '::registry': }
16+
class { 'registry': }
1717

1818
registry_key { 'HKLM\Software\Vendor':
1919
ensure => present,

manifests/service.pp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@
77
#
88
# [1] http://support.microsoft.com/kb/137890
99
#
10-
# @param ensure[ present, absent ]
10+
# @param ensure
11+
# Ensures the presence or absence of a registry key. Valid values: 'present', 'absent', 'UNSET'.
12+
#
1113
# @param display_name
12-
# The Display Name of the service. Defaults to the title of
13-
# the resource.
14+
# The Display Name of the service. Defaults to the title of the resource.
15+
#
1416
# @param description
15-
# A description of the service
17+
# A description of the service. String value set to 'UNSET' by default.
18+
#
1619
# @param command
17-
# The command to execute
20+
# The command to execute. Set to 'UNSET' by default.
21+
#
1822
# @param start
1923
# The starting mode of the service. (Note, the native service
2024
# resource can also be used to manage this setting.)
21-
# [ automatic, manual, disabled ]
25+
# Valid values: 'automatic', 'manual', 'disabled'
2226
#
2327
#
2428
# Manages the values in the key HKLM\System\CurrentControlSet\Services\$name\
@@ -28,22 +32,21 @@
2832
# ensure => present,
2933
# display_name => 'Puppet Agent',
3034
# description => 'Periodically fetches and applies
31-
# configurations from a Puppet Server.',
35+
# configurations from a Puppet Server.',
3236
# command => 'C:\PuppetLabs\Puppet\service\daemon.bat',
3337
# }
3438
#
3539
define registry::service (
36-
$ensure = 'UNSET',
37-
$display_name = 'UNSET',
38-
$description = 'UNSET',
39-
$command = 'UNSET',
40-
$start = 'UNSET'
40+
Enum['present', 'absent', 'UNSET'] $ensure = 'UNSET',
41+
String[1] $display_name = 'UNSET',
42+
String[1] $description = 'UNSET',
43+
String[1] $command = 'UNSET',
44+
Enum['automatic', 'manual', 'disabled', 'UNSET'] $start = 'UNSET'
4145
) {
4246
$ensure_real = $ensure ? {
4347
'UNSET' => present,
44-
undef => present,
45-
present => present,
46-
absent => absent,
48+
'present' => present,
49+
'absent' => absent,
4750
}
4851

4952
$display_name_real = $display_name ? {
@@ -64,9 +67,9 @@
6467

6568
# Map descriptive names to flags.
6669
$start_real = $start ? {
67-
automatic => 2,
68-
manual => 3,
69-
disabled => 4,
70+
'automatic' => 2,
71+
'manual' => 3,
72+
'disabled' => 4,
7073
}
7174

7275
# Variable to hold the base key path.

manifests/value.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
]] $data = undef,
4848
) {
4949
# ensure windows os
50-
if $::operatingsystem != 'windows' {
51-
fail("Unsupported OS ${::operatingsystem}")
50+
if $facts['os']['name'] != 'windows' {
51+
fail("Unsupported OS ${facts['os']['name']}")
5252
}
5353

5454
$value_real = $value ? {

spec/acceptance/registry_management_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# use a different case here, to exercise the case-conversion codepaths
1717
registry_key { 'HKLM\\Software\\VENDOR': ensure => present }
1818
19-
registry_key { '#{keypath}': ensure => present }
19+
registry_key { '#{keypath}': ensure => 'present' }
2020
registry_key { '#{keypath}\\SubKey1': ensure => present }
2121
2222
registry_key { '#{keypath}\\SubKeyToPurge': ensure => present }

spec/defines/value_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
end
148148
let(:facts) do
149149
{
150-
'operatingsystem' => 'bar',
150+
os: { name: 'bar' },
151151
}
152152
end
153153

0 commit comments

Comments
 (0)