summaryrefslogtreecommitdiffstats
path: root/ruby/examples/inspect_vm.rb
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2011-01-11 10:43:51 +0000
committerRichard W.M. Jones <rjones@redhat.com>2011-03-08 14:50:23 +0000
commit3b4ff15f15f323f6dcafef6a2ee59d6b527d749f (patch)
treef6b76e2107b0f13b02d2f07f4f41b552edb661a9 /ruby/examples/inspect_vm.rb
parent5b656fac03146c331cd1310f22febf631b2d8e36 (diff)
downloadlibguestfs-3b4ff15f15f323f6dcafef6a2ee59d6b527d749f.tar.gz
libguestfs-3b4ff15f15f323f6dcafef6a2ee59d6b527d749f.tar.xz
libguestfs-3b4ff15f15f323f6dcafef6a2ee59d6b527d749f.zip
fish: Don't fail if some mountpoints in /etc/fstab are bogus (RHBZ#668574).
Fix guestfish (and other C tools) so that they ignore errors when /etc/fstab contains bogus entries. Update the documentation for inspect-get-mountpoints to emphasize that callers must be aware of this when mounting the returned values. Add a regression test. Update the example code ("inspect_vm") to reflect the way this API ought to be called. For more detail see: https://bugzilla.redhat.com/show_bug.cgi?id=668574 (cherry picked from commit 0c60e4d9dd6549c2135699490ba8a9ec1dd50ab9)
Diffstat (limited to 'ruby/examples/inspect_vm.rb')
-rw-r--r--ruby/examples/inspect_vm.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/ruby/examples/inspect_vm.rb b/ruby/examples/inspect_vm.rb
index 032dec4f..abf22790 100644
--- a/ruby/examples/inspect_vm.rb
+++ b/ruby/examples/inspect_vm.rb
@@ -41,7 +41,11 @@ for root in roots do
mps = g.inspect_get_mountpoints(root)
mps = mps.sort {|a,b| a[0].length <=> b[0].length}
for mp in mps do
- g.mount_ro(mp[1], mp[0])
+ begin
+ g.mount_ro(mp[1], mp[0])
+ rescue Guestfs::Error => msg
+ printf("%s (ignored)\n", msg)
+ end
end
# If /etc/issue.net file exists, print up to 3 lines.