Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Commit

Permalink
Skip chmod 777 for cache bucket root for smb synced folders
Browse files Browse the repository at this point in the history
Closes GH-107
  • Loading branch information
fgrehm committed Jul 21, 2014
1 parent f8314ab commit 2b6a07d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ IMPROVEMENTS:

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]]

[GH-107]: https://github.com/fgrehm/vagrant-cachier/issues/107
[GH-86]: https://github.com/fgrehm/vagrant-cachier/issues/86
[GH-89]: https://github.com/fgrehm/vagrant-cachier/issues/89

Expand Down
23 changes: 21 additions & 2 deletions lib/vagrant-cachier/action/install_buckets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ def call(env)
end

def chmod_bucket_root(machine)
@logger.info "'chmod'ing bucket root dir to 777..."
machine.communicate.sudo 'mkdir -p /tmp/vagrant-cache && chmod 777 /tmp/vagrant-cache'
machine.communicate.sudo 'mkdir -p /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

def configure_cache_buckets(env)
Expand All @@ -41,6 +46,20 @@ def configure_cache_buckets(env)
data_file = env[:machine].data_dir.join('cache_dirs')
data_file.open('w') { |f| f.print env[:cache_dirs].uniq.join("\n") }
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
Expand Down

0 comments on commit 2b6a07d

Please sign in to comment.