Sha256: 7e7d99b57862d619e131989a6361c0cd29d28f4c89f17ba680c138ea817c417d

Contents?: true

Size: 539 Bytes

Versions: 53

Compression:

Stored size: 539 Bytes

Contents

class Specinfra::Command::Linux::Base::File < Specinfra::Command::Base::File
  class << self
    def check_is_accessible_by_user(file, user, access)
      "sudo -u #{user} test -#{access} #{file}"
    end

    def check_is_immutable(file)
      check_attribute(file, 'i')
    end

    def check_attribute(file, attribute)
      "lsattr -d #{escape(file)} 2>&1 | " + 
      "awk '$1~/^[A-Za-z-]+$/ && $1~/#{escape(attribute)}/ {exit 0} {exit 1}'"
    end

    def get_selinuxlabel(file)
      "stat -c %C #{escape(file)}"
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
specinfra-2.91.0 lib/specinfra/command/linux/base/file.rb
specinfra-2.90.1 lib/specinfra/command/linux/base/file.rb
specinfra-2.90.0 lib/specinfra/command/linux/base/file.rb
specinfra-2.89.0 lib/specinfra/command/linux/base/file.rb
specinfra-2.88.2 lib/specinfra/command/linux/base/file.rb
specinfra-2.88.1 lib/specinfra/command/linux/base/file.rb
specinfra-2.88.0 lib/specinfra/command/linux/base/file.rb
specinfra-2.87.2 lib/specinfra/command/linux/base/file.rb
specinfra-2.87.1 lib/specinfra/command/linux/base/file.rb
specinfra-2.87.0 lib/specinfra/command/linux/base/file.rb
specinfra-2.86.0 lib/specinfra/command/linux/base/file.rb
specinfra-2.85.1 lib/specinfra/command/linux/base/file.rb
specinfra-2.85.0 lib/specinfra/command/linux/base/file.rb
specinfra-2.84.1 lib/specinfra/command/linux/base/file.rb
specinfra-2.84.0 lib/specinfra/command/linux/base/file.rb
specinfra-2.83.4 lib/specinfra/command/linux/base/file.rb
specinfra-2.83.3 lib/specinfra/command/linux/base/file.rb
specinfra-2.83.2 lib/specinfra/command/linux/base/file.rb
specinfra-2.83.1 lib/specinfra/command/linux/base/file.rb
specinfra-2.83.0 lib/specinfra/command/linux/base/file.rb