Skip to content

Commit

Permalink
clean up for cookstyle and markdown check
Browse files Browse the repository at this point in the history
Signed-off-by: Jakob Pfeiffer <jakob.pfeiffer@m-net.de>
  • Loading branch information
Jakob Pfeiffer committed Dec 8, 2024
1 parent dfc7ca2 commit 3448977
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion chefignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ examples/*
features/*
Guardfile
kitchen*.yml
mlc_config.json
mlc_config*.json
Procfile
Rakefile
spec/*
Expand Down
10 changes: 5 additions & 5 deletions libraries/fs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ def canonical_path(path)

# Check to determine if a device is mounted.
def mounted?(params = {})
params.is_a?(String) && params = {device: params} # backward compatibility
params.is_a?(String) && params = { device: params } # backward compatibility

mounts = File.readlines('/proc/mounts').map(&:split).map do |field|
{
device: field[0].start_with?('/dev/') && canonical_path(field[0]) || field[0],
mountpoint: field[1]
mountpoint: field[1],
}
end

if params.key?(:device) && params.key?(:mountpoint)
mounts.select { |mount|
mounts.select do |mount|
mount[:device] == canonical_path(params[:device]) &&
mount[:mountpoint] == params[:mountpoint].chomp('/')
}.any?
mount[:mountpoint] == params[:mountpoint].chomp('/')
end.any?
elsif params.key?(:device)
mounts.select { |mount| mount[:device] == canonical_path(params[:device]) }.any?
elsif params.key?(:mountpoint)
Expand Down
2 changes: 1 addition & 1 deletion resources/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def mount_point(mount_location)
fstype fstype
options options
action :mount
not_if { mounted?(device: device, mountpoint: mount ) }
not_if { mounted?(device: device, mountpoint: mount) }
end

# set directory attributes within the mounted file system
Expand Down

0 comments on commit 3448977

Please sign in to comment.