lib/dev-lxc/container.rb in dev-lxc-0.2.5 vs lib/dev-lxc/container.rb in dev-lxc-0.3.0
- old
+ new
@@ -35,11 +35,16 @@
self.clear_config_item('lxc.mount.entries')
self.set_config_item("lxc.mount.entry", preserved_mounts)
end
mounts.each do |mount|
raise "Mount source #{mount.split.first} does not exist." unless File.exists?(mount.split.first)
- puts "Adding mount entry #{mount}"
- self.set_config_item("lxc.mount.entry", "#{mount} none bind,optional,create=dir 0 0 ## dev-lxc ##")
+ if preserved_mounts.any? { |m| m.start_with?("#{mount} ") }
+ puts "Skipping mount entry #{mount}, it already exists"
+ next
+ else
+ puts "Adding mount entry #{mount}"
+ self.set_config_item("lxc.mount.entry", "#{mount} none bind,optional,create=dir 0 0 ## dev-lxc ##")
+ end
end
self.save_config
end
def run_command(command)