Skip to content

Commit

Permalink
Merge pull request #85 from nathanlcarlson/disable_detection
Browse files Browse the repository at this point in the history
More reliably test for current user state
  • Loading branch information
jhoblitt authored Sep 19, 2024
2 parents 9884c32 + d4e98f6 commit 287b744
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions manifests/user.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@

exec { "ipmi_user_add_${title}":
command => "/usr/bin/ipmitool user set name ${user_id} ${user}",
unless => "/usr/bin/test \"$(ipmitool user list ${channel} | grep '^${user_id}' | awk '{print \$2}' | head -n1)\" = \"${user}\"",
unless => "/usr/bin/ipmitool user list ${channel} | grep -qE '^${user_id}[ ]+${user} '",
notify => [Exec["ipmi_user_priv_${title}"], Exec["ipmi_user_setpw_${title}"]],
}

exec { "ipmi_user_priv_${title}":
command => "/usr/bin/ipmitool user priv ${user_id} ${priv} ${channel}",
unless => "/usr/bin/test \"$(ipmitool user list ${channel} | grep '^${user_id}' | awk '{print \$6}' | head -n1)\" = ${privilege}",
unless => "/usr/bin/ipmitool user list ${channel} | grep -qE '^${user_id} .+ ${privilege}$'",
notify => [Exec["ipmi_user_enable_${title}"], Exec["ipmi_user_enable_sol_${title}"], Exec["ipmi_user_channel_setaccess_${title}"]],
}

Expand Down Expand Up @@ -97,7 +97,7 @@
} else {
exec { "ipmi_user_priv_${title}":
command => "/usr/bin/ipmitool user priv ${user_id} 0xF ${channel}",
unless => "/usr/bin/test \"$(ipmitool user list ${channel} | grep '^${user_id}' | awk '{print \$6}' | head -n1)\" = 'NO ACCESS'",
unless => "/usr/bin/ipmitool user list ${channel} | grep -qE '^${user_id} .+ NO ACCESS$'",
notify => [Exec["ipmi_user_disable_${title}"], Exec["ipmi_user_disable_sol_${title}"], Exec["ipmi_user_channel_setaccess_${title}"]],
}

Expand Down

0 comments on commit 287b744

Please sign in to comment.