Skip to content

Commit

Permalink
fix issue#1511 , fix enter new label issue, fix give the option again…
Browse files Browse the repository at this point in the history
… to format,etc
  • Loading branch information
tmkasun committed Aug 1, 2014
1 parent 8ff8310 commit 7ffa0c4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def self.new_disks
unmounted_devices.push device
next
end
device.partitions.delete_if { |partition| (fstab.has_device? partition.path) }
device.partitions.delete_if { |partition| (fstab.has_device? partition.path or partition.mountpoint) }
unmounted_devices.push device if not device.partitions.blank?
end
return unmounted_devices
Expand Down
7 changes: 3 additions & 4 deletions app/views/disk_wizards/manage_disk.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,22 @@
</li>
<li class="list-group-item">
<div class="checkbox">
<label> <%= check_box_tag('option[]', 1, !!((user_selections['option'].include? '1') rescue false), class: 'mount_check') %>
<%= check_box_tag('option[]', 1, !!((user_selections['option'].include? '1') rescue false), class: 'mount_check') %>
<div class="alert alert-info">
Mount this drive automatically.
<label for="option_"> Mount this drive automatically.</label>
<div style="<%= !!((user_selections['option'].include? '1') rescue false) ? nil : 'display: none' %>" id="label_input" class="input-group input-group-sm">
<span class="input-group-addon">Enter a label</span>
<input style="margin: auto;" type="text" name="label" id="label" class="form-control" placeholder="Label" value="<%= user_selections['label'] || nil %>">
</div>
</div>
</label>
</div>
</li>

</ul>
</div>
</div>
<div class="row text-left">
<%= link_to(defined?(disk_wizards_engine) ? disk_wizards_engine.file_system_path : file_system_path, class: "btn btn-default") do %>
<%= link_to(disk_wizards_engine.file_system_path , class: "btn btn-default") do %>
&larr; Back
<% end %>
<%= link_to '#', :onclick => "$('#options').submit()", style: "float: right;", class: "btn btn-success" do %>
Expand Down
4 changes: 2 additions & 2 deletions lib/diskwz.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def probe_kernal device_path = nil
device_path = device_path.path
end
commands = {'partprobe' => '', 'udevadm' => ' trigger'}
commands['hdparm'] = "trigger -z #{device_path}" if not device_path.nil? # Do not execute 'hdparm' when device/partition is not given.
commands['hdparm'] = " -z #{device_path}" if not device_path.nil? # Do not execute 'hdparm' when device/partition is not given.
DebugLogger.info "|#{self.class.name}|>|#{__method__}|:Commands = #{commands}"
commands.each do |command, args|
executor = DiskCommand.new(command, args)
Expand Down Expand Up @@ -328,7 +328,7 @@ def get_path device
blkid = DiskCommand.new command, params
DebugLogger.info "|#{self.class.name}|>|#{__method__}|:device = #{device.kname}, uuid = #{device.uuid}, params = #{params}"
blkid.execute
raise "Command execution error: #{blkid.stderr.read}" if not blkid.success?
raise "Command execution error:blkid error: #{blkid.stderr.read}" if not blkid.success?
return blkid.result.lines.first.squish!
end

Expand Down
7 changes: 6 additions & 1 deletion lib/modules/operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ def path
# Reload the device/partition attribute from system.
def reload
dev_path = "/dev/#{self.kname}"
if self.instance_of? Device
Diskwz.probe_kernal dev_path
else
#TODO: Reloading a partitions, hdparm need its parent device path in -z option.no the path of the partition itself (man hdparm)
Diskwz.probe_kernal
end
DebugLogger.info "|#{self.class.name}|>|#{__method__}|:Device Kname #{self.kname}"
Diskwz.probe_kernal dev_path
node = Diskwz.find dev_path
if node['type'].eql? 'part'
node.each do |key, value|
Expand Down

0 comments on commit 7ffa0c4

Please sign in to comment.