Method: ChefMetal::Machine::UnixMachine#get_attributes

Defined in:
lib/chef_metal/machine/unix_machine.rb

#get_attributes(path) ⇒ Object

Get file attributes { :mode, :owner, :group }



87
88
89
90
91
92
93
94
95
96
97
# File 'lib/chef_metal/machine/unix_machine.rb', line 87

def get_attributes(path)
  file_info = transport.execute("stat -c '%a %U %G %n' #{path}", :read_only => true).stdout.split(/\s+/)
  if file_info.size <= 1
    raise "#{path} does not exist in set_attributes()"
  end
  result = {
    :mode => file_info[0],
    :owner => file_info[1],
    :group => file_info[2]
  }
end