Class: Specinfra::Command::Aix::Base::File

Inherits:
Base::File show all
Defined in:
lib/specinfra/command/aix/base/file.rb

Class Method Summary collapse

Methods inherited from Base::File

change_group, change_mode, change_owner, check_contains, check_contains_lines, check_contains_with_fixed_strings, check_contains_with_regexp, check_contains_within, check_exists, check_is_block_device, check_is_character_device, check_is_directory, check_is_file, check_is_link, check_is_linked_to, check_is_mounted, check_is_pipe, check_is_socket, check_is_symlink, copy, create_as_directory, download, get_content, get_link_target, get_md5sum, get_mode, get_mtime, get_owner_group, get_owner_user, get_sha256sum, get_size, link_to, move, remove

Methods inherited from Base

create, escape

Class Method Details

.check_has_mode(file, mode) ⇒ Object



7
8
9
# File 'lib/specinfra/command/aix/base/file.rb', line 7

def check_has_mode(file, mode)
  raise NotImplementedError.new('check_has_mode is not implemented in Specinfra::Command::AIX::Base::File')
end

.check_is_accessible_by_user(file, user, access) ⇒ Object



3
4
5
# File 'lib/specinfra/command/aix/base/file.rb', line 3

def check_is_accessible_by_user(file, user, access)
  "su -s sh -c \"test -#{access} #{file}\" #{user}"
end

.check_is_grouped(file, group) ⇒ Object



16
17
18
19
# File 'lib/specinfra/command/aix/base/file.rb', line 16

def check_is_grouped(file, group)
  regexp = "^#{group}$"
  "ls -al #{escape(file)} | awk '{print $4}' | grep -- #{escape(regexp)}"
end

.check_is_owned_by(file, owner) ⇒ Object



11
12
13
14
# File 'lib/specinfra/command/aix/base/file.rb', line 11

def check_is_owned_by(file, owner)
  regexp = "^#{owner}$"
  "ls -al #{escape(file)} | awk '{print $3}' | grep -- #{escape(regexp)}"
end