Skip to content

Commit f580a24

Browse files
committed
chore: replace the sudoers manage logic without using lookup, by directly setting in common
Signed-off-by: Sidharth Jawale <sidharth@obmondo.com>
1 parent 4a84bed commit f580a24

File tree

5 files changed

+10
-6
lines changed

5 files changed

+10
-6
lines changed

.puppet-lint.rc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
--no-140chars-check
44
--no-parameter_order-check
55
--no-top_scope_facts
6-
--no-strict_indent
6+
--no-strict_indent
7+
--no-file_ensure

modules/enableit/common/data/common.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ common::system::authentication::ignore_expired_root_password: false
192192
common::system::authentication::purge_ubuntu_user: false
193193
common::system::authentication::purge_user: false
194194

195+
common::system::authentication::sudo::manage: true
195196
common::system::authentication::sudo::purge: false
196197

197198
### DNS

modules/enableit/common/data/os/Debian.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,3 @@ common::system::authentication::pam::password_session_lines:
198198

199199
common::monitor::prometheus::env_file_path: "/etc/default"
200200
common::monitor::exporter::security::enable: true
201-
common::system::authentication::sudo::manage: true

modules/enableit/common/manifests/system/authentication/sudo.pp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# @summary Class for managing the sudo settings in the common system authentication
22
#
3+
# @param manage Boolean - If true, will manage the authentication sudo settings. Defaults to true.
4+
#
35
# @param purge Whether to purge existing sudo configurations. Defaults to false.
46
#
57
# @param ssh_agent_auth Whether to enable SSH agent authentication. Defaults to false.
@@ -9,12 +11,13 @@
911
# @param __sudoers_d_dir The absolute path to the sudoers.d directory. Defaults to '/etc/obmondo/sudoers.d'.
1012
#
1113
class common::system::authentication::sudo (
14+
Boolean $manage = true,
1215
Boolean $purge = false,
1316
Boolean $ssh_agent_auth = false,
1417
Eit_types::Sudoers $sudoers = {},
1518
Stdlib::Absolutepath $__sudoers_d_dir = '/etc/obmondo/sudoers.d',
1619
) {
17-
if lookup('common::system::authentication::sudo::manage', Boolean, undef, true) {
20+
if $manage {
1821
include profile::system::sudoers
1922
}
2023
}

modules/enableit/monitor/manifests/system/hwmon.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
class monitor::system::hwmon (
66
Boolean $enable = true,
77
) {
8-
if dig($facts, 'dmi', 'board', 'product') == 'PRIME X670-P WIFI' {
8+
if $facts['dmi']['board']['product'] == 'PRIME X670-P WIFI' {
99
file { '/etc/modprobe.d/nct6775.conf':
10-
ensure => 'file',
10+
ensure => 'present',
1111
content => 'options nct6775 force_id=0xd420',
1212
}
1313
file { '/etc/modules-load.d/nct6775.conf':
14-
ensure => 'file',
14+
ensure => 'present',
1515
content => 'nct6775',
1616
}
1717
}

0 commit comments

Comments
 (0)