Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/linux_admin/disk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def check_if_partitions_overlap(partitions)
public

def self.local
Dir.glob('/dev/[vhs]d[a-z]').collect do |d|
Dir.glob(['/dev/[vhs]d[a-z]', '/dev/xvd[a-z]']).collect do |d|
Disk.new :path => d
end
end
Expand Down Expand Up @@ -152,7 +152,7 @@ def create_partition(partition_type, *args)
end

id = partitions.empty? ? 1 : (partitions.last.id + 1)
options = parted_options_array('mkpart', '-a opt', partition_type, start, finish)
options = parted_options_array('mkpart', '-a', 'opt', partition_type, start, finish)
run!(cmd(:parted), :params => { nil => options})

partition = Partition.new(:disk => self,
Expand Down
6 changes: 3 additions & 3 deletions spec/disk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe LinuxAdmin::Disk do
describe "#local" do
it "returns local disks" do
Dir.should_receive(:glob).with('/dev/[vhs]d[a-z]').
Dir.should_receive(:glob).with(['/dev/[vhs]d[a-z]', '/dev/xvd[a-z]']).
and_return(['/dev/hda', '/dev/sda'])
disks = LinuxAdmin::Disk.local
paths = disks.collect { |disk| disk.path }
Expand Down Expand Up @@ -138,13 +138,13 @@
end

it "uses parted" do
params = ['--script', '/dev/hda', 'mkpart', '-a opt', 'primary', 1024, 2048]
params = ['--script', '/dev/hda', 'mkpart', '-a', 'opt', 'primary', 1024, 2048]
@disk.should_receive(:run!).with(@disk.cmd(:parted), :params => { nil => params })
@disk.create_partition 'primary', 1024
end

it "accepts start/end params" do
params = ['--script', '/dev/hda', 'mkpart', '-a opt', 'primary', "0%", "50%"]
params = ['--script', '/dev/hda', 'mkpart', '-a', 'opt', 'primary', "0%", "50%"]
@disk.should_receive(:run!).with(@disk.cmd(:parted), :params => { nil => params })
@disk.create_partition 'primary', "0%", "50%"
end
Expand Down