Skip to content

Commit 1501c67

Browse files
authored
Merge pull request saz#163 from esalberg/file_comments
Add file managed by Puppet comments to all sudoers files
2 parents 1abeedf + 361026e commit 1501c67

18 files changed

+35
-11
lines changed

files/sudoers.aix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## sudoers file.
24
##
35
## This file MUST be edited with the 'visudo' command as root.

files/sudoers.archlinux

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## sudoers file.
24
##
35
## This file MUST be edited with the 'visudo' command as root.

files/sudoers.darwin

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
# sudoers file.
24
#
35
# This file MUST be edited with the 'visudo' command as root.

files/sudoers.debian

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
12
#
2-
# This file is managed by puppet.
3-
#
4-
53
Defaults env_reset
64
Defaults mail_badpass
75
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

files/sudoers.freebsd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## sudoers file.
24
##
35
## This file MUST be edited with the 'visudo' command as root.

files/sudoers.gentoo

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## sudoers file.
24
##
35
## This file MUST be edited with the 'visudo' command as root.

files/sudoers.olddebian

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## sudoers file.
24
##
35
## This file MUST be edited with the 'visudo' command as root.

files/sudoers.omnios

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## sudoers file.
24
##
35
## This file MUST be edited with the 'visudo' command as root.

files/sudoers.openbsd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# NOTE: This file is managed via Puppet, manual changes will be lost
2-
# on next puppet run.
3-
#
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
43
# sudoers file.
54
#
65
# This file MUST be edited with the 'visudo' command as root.

files/sudoers.rhel5

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## Sudoers allows particular users to run various commands as
24
## the root user, without needing the root password.
35
##

files/sudoers.rhel6

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## Sudoers allows particular users to run various commands as
24
## the root user, without needing the root password.
35
##

files/sudoers.rhel7

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## Sudoers allows particular users to run various commands as
24
## the root user, without needing the root password.
35
##

files/sudoers.smartos

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## sudoers file.
24
##
35
## This file MUST be edited with the 'visudo' command as root.

files/sudoers.solaris

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## sudoers file.
24
##
35
## This file MUST be edited with the 'visudo' command as root.

files/sudoers.suse

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# file managed by puppet (unless config_file_replace=false)
2+
#
13
## sudoers file.
24
##
35
## This file MUST be edited with the 'visudo' command as root.

files/sudoers.ubuntu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# file managed by puppet (unless config_file_replace=false)
12
#
23
# This file MUST be edited with the 'visudo' command as root.
34
#

manifests/conf.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
$lines = join($content, "\n")
8787
$content_real = "${lines}\n"
8888
} else {
89-
$content_real = "${content}\n"
89+
$content_real = "# This file is managed by Puppet; changes may be overwritten\n${content}\n"
9090
}
9191
} else {
9292
$content_real = undef

spec/defines/sudo_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
it { should contain_file(filename).with({
3434
'ensure' => 'present',
35-
'content' => "%admins ALL=(ALL) NOPASSWD: ALL\n",
35+
'content' => "# This file is managed by Puppet; changes may be overwritten\n%admins ALL=(ALL) NOPASSWD: ALL\n",
3636
'owner' => 'root',
3737
'group' => 'root',
3838
'path' => file_path,
@@ -73,7 +73,7 @@
7373

7474
it { should contain_file(filename).with({
7575
'ensure' => 'present',
76-
'content' => "%admins ALL=(ALL) NOPASSWD: ALL\n",
76+
'content' => "# This file is managed by Puppet; changes may be overwritten\n%admins ALL=(ALL) NOPASSWD: ALL\n",
7777
'owner' => 'root',
7878
'group' => 'root',
7979
'path' => file_path,
@@ -106,7 +106,7 @@
106106

107107
it { should contain_file(filename).with({
108108
'ensure' => 'absent',
109-
'content' => "%admins ALL=(ALL) NOPASSWD: ALL\n",
109+
'content' => "# This file is managed by Puppet; changes may be overwritten\n%admins ALL=(ALL) NOPASSWD: ALL\n",
110110
'owner' => 'root',
111111
'group' => 'root',
112112
'path' => file_path,
@@ -130,7 +130,7 @@
130130

131131
it { should contain_file(filename).with({
132132
'ensure' => 'absent',
133-
'content' => "%admins ALL=(ALL) NOPASSWD: ALL\n",
133+
'content' => "# This file is managed by Puppet; changes may be overwritten\n%admins ALL=(ALL) NOPASSWD: ALL\n",
134134
'owner' => 'root',
135135
'group' => 'root',
136136
'path' => file_path,

0 commit comments

Comments
 (0)