Sha256: 68437b780a67e6127f70c135e6885c661c4b547230d44a18b2f153ae947af592
Contents?: true
Size: 993 Bytes
Versions: 2
Compression:
Stored size: 993 Bytes
Contents
# LinuxAdmin Partition Representation # # Copyright (C) 2013 Red Hat Inc. # Licensed under the MIT License require 'fileutils' class LinuxAdmin class Partition < LinuxAdmin attr_accessor :id attr_accessor :fs_type attr_accessor :size attr_accessor :disk attr_accessor :mount_point def initialize(args={}) @id = args[:id] @size = args[:size] @disk = args[:disk] @fs_type = args[:fs_type] end def path "#{disk.path}#{id}" end def mount(mount_point=nil) @mount_point = mount_point @mount_point = "/mnt/#{disk.path.split(File::SEPARATOR).last}#{id}" if mount_point.nil? FileUtils.mkdir(@mount_point) unless File.directory?(@mount_point) run(cmd(:mount), :params => { nil => [self.path, @mount_point] }) end def umount run(cmd(:umount), :params => { nil => [@mount_point] }) end def format_to(fs_type) #TODO end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
linux_admin-0.1.2 | lib/linux_admin/partition.rb |
linux_admin-0.1.1 | lib/linux_admin/partition.rb |