Skip chmod 777
for cache bucket root for smb synced folders
Closes GH-107
This commit is contained in:
parent
f8314aba52
commit
2b6a07d000
2 changed files with 23 additions and 2 deletions
|
@ -11,8 +11,10 @@ IMPROVEMENTS:
|
||||||
|
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
|
- Skip `chmod 777` for `smb` mounted folders [[GH-107]]
|
||||||
- Do not error if base box has been removed and `:box` is configured as the cache scope [[GH-86]]
|
- Do not error if base box has been removed and `:box` is configured as the cache scope [[GH-86]]
|
||||||
|
|
||||||
|
[GH-107]: https://github.com/fgrehm/vagrant-cachier/issues/107
|
||||||
[GH-86]: https://github.com/fgrehm/vagrant-cachier/issues/86
|
[GH-86]: https://github.com/fgrehm/vagrant-cachier/issues/86
|
||||||
[GH-89]: https://github.com/fgrehm/vagrant-cachier/issues/89
|
[GH-89]: https://github.com/fgrehm/vagrant-cachier/issues/89
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,13 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def chmod_bucket_root(machine)
|
def chmod_bucket_root(machine)
|
||||||
@logger.info "'chmod'ing bucket root dir to 777..."
|
machine.communicate.sudo 'mkdir -p /tmp/vagrant-cache'
|
||||||
machine.communicate.sudo 'mkdir -p /tmp/vagrant-cache && chmod 777 /tmp/vagrant-cache'
|
|
||||||
|
# https://github.com/fgrehm/vagrant-cachier/issues/107
|
||||||
|
if ! smb_synced_folder_enabled?(machine)
|
||||||
|
@logger.info "'chmod'ing bucket root dir to 777..."
|
||||||
|
machine.communicate.sudo 'chmod 777 /tmp/vagrant-cache'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def configure_cache_buckets(env)
|
def configure_cache_buckets(env)
|
||||||
|
@ -41,6 +46,20 @@ module VagrantPlugins
|
||||||
data_file = env[:machine].data_dir.join('cache_dirs')
|
data_file = env[:machine].data_dir.join('cache_dirs')
|
||||||
data_file.open('w') { |f| f.print env[:cache_dirs].uniq.join("\n") }
|
data_file.open('w') { |f| f.print env[:cache_dirs].uniq.join("\n") }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def smb_synced_folder_enabled?(machine)
|
||||||
|
synced_folder_opts = machine.config.cache.synced_folder_opts
|
||||||
|
synced_folder_opts ||= {}
|
||||||
|
|
||||||
|
# If smb was explicitly enabled
|
||||||
|
if synced_folder_opts[:type] && synced_folder_opts[:type].to_s == 'smb'
|
||||||
|
return true
|
||||||
|
elsif machine.provider_name.to_sym == :hyperv
|
||||||
|
# If the provider in use is hyperv, the default synced folder is 'smb'
|
||||||
|
# unless specified
|
||||||
|
return synced_folder_opts[:type] == nil
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue