diff --git a/.gitignore b/.gitignore index 82d1b5c..f608a68 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +.idea/ .kitchen/ .kitchen.local.yml diff --git a/Gemfile.lock b/Gemfile.lock index dd64512..1d931d8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -21,6 +21,35 @@ GEM plist (~> 3.1.0) pry (~> 0.9) rest-client (>= 1.0.4, <= 1.6.7) + chef (11.16.2-x86-mingw32) + chef-zero (~> 2.1, >= 2.1.4) + diff-lcs (~> 1.2, >= 1.2.4) + erubis (~> 2.7) + ffi (~> 1.9) + ffi-yajl (~> 1.0) + highline (~> 1.6, >= 1.6.9) + mime-types (~> 1.16) + mixlib-authentication (~> 1.3) + mixlib-cli (~> 1.4) + mixlib-config (~> 2.0) + mixlib-log (~> 1.3) + mixlib-shellout (~> 1.4) + net-ssh (~> 2.6) + net-ssh-multi (~> 1.1) + ohai (~> 7.4) + plist (~> 3.1.0) + pry (~> 0.9) + rest-client (>= 1.0.4, <= 1.6.7) + win32-api (= 1.5.1) + win32-dir (= 0.4.5) + win32-event (= 0.6.1) + win32-mmap (= 0.4.0) + win32-mutex (= 0.4.1) + win32-process (= 0.7.3) + win32-service (= 0.8.2) + windows-api (= 0.4.2) + windows-pr (= 1.2.2) + wmi-lite (~> 1.0) chef-zero (2.2) hashie (~> 2.0) json @@ -39,6 +68,7 @@ GEM net-ssh ohai ffi (1.9.5) + ffi (1.9.5-x86-mingw32) ffi-yajl (1.1.0) ffi (~> 1.5) libyajl2 (~> 1.0) @@ -53,6 +83,8 @@ GEM formatador (0.2.5) gherkin (2.12.2) multi_json (~> 1.3) + gherkin (2.12.2-x86-mingw32) + multi_json (~> 1.3) guard (2.6.1) formatador (>= 0.2.4) listen (~> 2.7) @@ -68,6 +100,7 @@ GEM hashie (2.1.2) highline (1.6.21) hitimes (1.2.2) + hitimes (1.2.2-x86-mingw32) ipaddress (0.8.0) json (1.8.1) kitchen-docker (1.5.0) @@ -97,6 +130,9 @@ GEM mixlib-config (2.1.0) mixlib-log (1.6.0) mixlib-shellout (1.4.0) + mixlib-shellout (1.4.0-x86-mingw32) + win32-process (~> 0.7.1) + windows-pr (~> 1.2.2) multi_json (1.10.1) net-scp (1.2.1) net-ssh (>= 2.6.5) @@ -108,6 +144,8 @@ GEM net-ssh-gateway (>= 1.2.0) nokogiri (1.6.3.1) mini_portile (= 0.6.0) + nokogiri (1.6.3.1-x86-mingw32) + mini_portile (= 0.6.0) ohai (7.4.0) ffi (~> 1.9) ffi-yajl (~> 1.0) @@ -125,6 +163,11 @@ GEM coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) + pry (0.10.1-x86-mingw32) + coderay (~> 1.1.0) + method_source (~> 0.8.1) + slop (~> 3.4) + win32console (~> 1.3) rack (1.5.2) rake (10.3.2) rb-fsevent (0.9.4) @@ -165,11 +208,33 @@ GEM hitimes treetop (1.5.3) polyglot (~> 0.3) + win32-api (1.5.1-x86-mingw32) + win32-dir (0.4.5) + ffi (>= 1.0.0) + win32-event (0.6.1) + win32-ipc (>= 0.6.0) + win32-ipc (0.6.6) + ffi + win32-mmap (0.4.0) + ffi + win32-mutex (0.4.1) + win32-ipc (>= 0.6.0) + win32-process (0.7.3) + ffi (>= 1.0.0) + win32-service (0.8.2) + ffi + win32console (1.3.2-x86-mingw32) + windows-api (0.4.2) + win32-api (>= 1.4.5) + windows-pr (1.2.2) + win32-api (>= 1.4.5) + windows-api (>= 0.3.0) wmi-lite (1.0.0) yajl-ruby (1.2.1) PLATFORMS ruby + x86-mingw32 DEPENDENCIES chefspec diff --git a/README.md b/README.md index 7c32d7b..2e02a40 100644 --- a/README.md +++ b/README.md @@ -8,9 +8,10 @@ Usage ```ruby override_attributes( - 's3fs-fuse' => { + 's3fs_fuse' => { :s3_key => 'key', :s3_secret => 'secret', + :version => 'v1.79' :mounts => [ {:bucket => 'my-bucket', :path => '/mount/path', :tmp_store => '/tmp/cache'} ], @@ -18,12 +19,16 @@ override_attributes( :maxmemory => 50 } ) +``` -Multiple buckets can be mounted (which is why the `:mounts` attribute is an Array +Multiple buckets can be mounted (which is why the ```:mounts``` attribute is an Array of Hashes). Bluepill monitoring is optional and the maxmemory allows bluepill to kill off and remount any s3 mounts that misbehave. +The value of ```node[:s3fs_fuse][:version]``` will be used to download the specific tag +from the [s3fs-fuse github](https://github.com/s3fs-fuse/s3fs-fuse) for versions 1.74 and greater. + Note: Bluepill should be considered for any s3fs built bucket that has large number -of entries within directories. Running an `ls` on these directories will cause the +of entries within directories. Running an ```ls``` on these directories will cause the mount's memory to balloon. Bluepill will happily watch for this (ballooning memory) and remount the bucket. diff --git a/attributes/default.rb b/attributes/default.rb index cb87847..94a8e43 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,7 +1,7 @@ default[:s3fs_fuse][:s3_url] = 'https://s3.amazonaws.com' default[:s3fs_fuse][:s3_key] = '' default[:s3fs_fuse][:s3_secret] = '' -default[:s3fs_fuse][:version] = '1.61' +default[:s3fs_fuse][:version] = 'v1.79' default[:s3fs_fuse][:no_upload] = false default[:s3fs_fuse][:mounts] = [] default[:s3fs_fuse][:bluepill] = false diff --git a/recipes/install.rb b/recipes/install.rb index 86b4dfb..9f8d1f6 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -44,23 +44,49 @@ package prereq_name end -s3fs_version = node[:s3fs_fuse][:version] -source_url = "http://s3fs.googlecode.com/files/s3fs-#{s3fs_version}.tar.gz" +s3fs_git_tag = node[:s3fs_fuse][:version] +s3fs_version = node[:s3fs_fuse][:version].tr('^0-9.','') -remote_file "/tmp/s3fs-#{s3fs_version}.tar.gz" do +puts s3fs_version.to_f.to_s + +if s3fs_version.to_f >= 1.74 + source_url = "https://github.com/s3fs-fuse/s3fs-fuse/tarball/tags/#{s3fs_git_tag}" +else + source_url = "http://s3fs.googlecode.com/files/s3fs-#{s3fs_git_tag}.tar.gz" +end + + +remote_file "/tmp/s3fs-#{s3fs_git_tag}.tar.gz" do source source_url action :create_if_missing end +directory "/tmp/s3fs-#{s3fs_git_tag}" do + mode 0755 + action :create +end + + bash "compile_and_install_s3fs" do cwd '/tmp' - code <<-EOH - tar -xzf s3fs-#{s3fs_version}.tar.gz - cd s3fs-#{s3fs_version} - #{'export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig' if node.platform_family == 'rhel'} - ./configure --prefix=/usr/local - make && make install - EOH + if s3fs_version.to_f >= 1.74 # Added ./autogen.sh + code <<-EOH + tar -xzf s3fs-#{s3fs_git_tag}.tar.gz -C s3fs-#{s3fs_git_tag} --strip-components 1 + cd s3fs-#{s3fs_git_tag} + #{'export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig' if node.platform_family == 'rhel'} + ./autogen.sh + ./configure --prefix=/usr/local + make && make install + EOH + else + code <<-EOH + tar -xzf s3fs-#{s3fs_git_tag}.tar.gz -C s3fs-#{s3fs_git_tag} --strip-components 1 + cd s3fs-#{s3fs_git_tag} + #{'export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig' if node.platform_family == 'rhel'} + ./configure --prefix=/usr/local + make && make install + EOH + end not_if do begin %x{s3fs --version}.to_s.split("\n").first.to_s.split.last == s3fs_version.to_s