Warn user we're pruning exports

This commit is contained in:
Mitchell Hashimoto 2012-01-12 23:33:17 -08:00
parent 7fdbb68917
commit 3456bfd2fe
3 changed files with 26 additions and 7 deletions

View File

@ -40,7 +40,7 @@ module Vagrant
# The sleep ensures that the output is truly flushed before any `sudo`
# commands are issued.
@ui.info I18n.t("vagrant.hosts.bsd.nfs_export.prepare")
@ui.info I18n.t("vagrant.hosts.bsd.nfs_export")
sleep 0.5
# First, clean up the old entry
@ -60,11 +60,19 @@ module Vagrant
def nfs_prune(valid_ids)
@logger.info("Pruning invalid NFS entries...")
output = false
File.read("/etc/exports").lines.each do |line|
if line =~ /^# VAGRANT-BEGIN: (.+?)$/
if valid_ids.include?($1.to_s)
@logger.debug("Valid ID: #{$1.to_s}")
else
if !output
# We want to warn the user but we only want to output once
@ui.info I18n.t("vagrant.hosts.bsd.nfs_prune")
output = true
end
@logger.info("Invalid ID, pruning: #{$1.to_s}")
nfs_cleanup($1.to_s)
end

View File

@ -39,7 +39,7 @@ module Vagrant
:ip => ip,
:folders => folders)
@ui.info I18n.t("vagrant.hosts.linux.nfs_export.prepare")
@ui.info I18n.t("vagrant.hosts.linux.nfs_export")
sleep 0.5
nfs_cleanup(id)
@ -58,11 +58,19 @@ module Vagrant
def nfs_prune(valid_ids)
@logger.info("Pruning invalid NFS entries...")
output = false
File.read("/etc/exports").lines.each do |line|
if line =~ /^# VAGRANT-BEGIN: (.+?)$/
if valid_ids.include?($1.to_s)
@logger.debug("Valid ID: #{$1.to_s}")
else
if !output
# We want to warn the user but we only want to output once
@ui.info I18n.t("vagrant.hosts.linux.nfs_prune")
output = true
end
@logger.info("Invalid ID, pruning: #{$1.to_s}")
nfs_cleanup($1.to_s)
end

View File

@ -541,12 +541,15 @@ en:
hosts:
bsd:
nfs_export:
prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."
nfs_export: |-
Preparing to edit /etc/exports. Administrator privileges will be required...
nfs_prune: |-
Pruning invalid NFS exports. Administrator privileges will be required...
linux:
nfs_export:
prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."
nfs_export: |-
Preparing to edit /etc/exports. Administrator privileges will be required...
nfs_prune: |-
Pruning invalid NFS exports. Administrator privileges will be required...
arch:
nfs_export:
prepare: "Preparing to edit /etc/exports. Administrator privileges will be required..."