Method: Specinfra::Command::Base::File.check_is_owned_by

Defined in:
lib/specinfra/command/base/file.rb

.check_is_owned_by(file, owner) ⇒ Object

[View source]

44
45
46
47
48
49
50
51
# File 'lib/specinfra/command/base/file.rb', line 44

def check_is_owned_by(file, owner)
  regexp = "^#{owner}$"
  if owner.is_a?(Numeric) || (owner =~ /\A\d+\z/ ? true : false)
    "stat -c %u #{escape(file)} | grep -- #{escape(regexp)}"
  else
    "stat -c %U #{escape(file)} | grep -- #{escape(regexp)}"
  end
end