Skip to content

Commit

Permalink
Try using proc for centos override
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorific committed Sep 26, 2024
1 parent f79389f commit 2ba0fbd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
12 changes: 6 additions & 6 deletions cookbooks/boxcutter_site_settings/recipes/remap_users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

if node.centos?
FB::Users::GID_MAP.delete('nogroup')
FB::Users::GID_MAP['nobody'] = {
'gid' => 65534,
}
end
# if node.centos?
# FB::Users::GID_MAP.delete('nogroup')
# FB::Users::GID_MAP['nobody'] = {
# 'gid' => 65534,
# }
# end

FB::Users::UID_MAP.each do |user_name, desired_user_data|
puts "MISCHA: node['root_user']=#{node['root_user']}, node.root_user=#{node.root_user}"
Expand Down
10 changes: 10 additions & 0 deletions cookbooks/boxcutter_site_settings/recipes/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,14 @@
'gid' => 'nogroup',
'home' => '/nonexistent',
'action' => :add,
'only_if' => proc { node.ubuntu? }
}

node.default['fb_users']['users']['nobody'] = {
'comment' => 'Kernel Overflow User',
'shell' => '/usr/sbin/nologin',
'gid' => '65534',
'home' => '/',
'action' => :add,
'only_if' => proc { node.centos? }
}
6 changes: 3 additions & 3 deletions cookbooks/boxcutter_users/libraries/default.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module FB
class Users
UID_MAP = { # rubocop:disable Style/MutableConstant
UID_MAP = {
# system
'root' => {
'uid' => 0,
Expand Down Expand Up @@ -48,9 +48,9 @@ class Users
'uid' => 65534,
'comment' => 'nobody',
},
}
}.freeze

GID_MAP = { # rubocop:disable Style/MutableConstant
GID_MAP = {
'root' => {
'gid' => 0,
'system' => true,
Expand Down

0 comments on commit 2ba0fbd

Please sign in to comment.