From ca840dc21e6283ed2149e28cdc7d70ef52384b9f Mon Sep 17 00:00:00 2001 From: James Robinson Date: Tue, 28 Oct 2014 15:52:34 -0400 Subject: [PATCH 01/18] - Updated .gitignore to stop Netbeans project folder from being added. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 82d1b5c..71fdee5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .kitchen/ .kitchen.local.yml +/nbproject/ \ No newline at end of file From eabc8bdc1314cdbbf3ef9033e780437d5a4881f0 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Tue, 28 Oct 2014 16:02:17 -0400 Subject: [PATCH 02/18] Changed install URL to the git repository (fixes #9). --- recipes/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/install.rb b/recipes/install.rb index 86b4dfb..e35f657 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -45,7 +45,7 @@ end s3fs_version = node[:s3fs_fuse][:version] -source_url = "http://s3fs.googlecode.com/files/s3fs-#{s3fs_version}.tar.gz" +source_url = "http://github.com/s3fs-fuse/s3fs-fuse/archive/v#{s3fs_version}.tar.gz" remote_file "/tmp/s3fs-#{s3fs_version}.tar.gz" do source source_url From 37fc2c1e98b34c693b654cc806672c8e061e6a1b Mon Sep 17 00:00:00 2001 From: James Robinson Date: Tue, 28 Oct 2014 16:29:01 -0400 Subject: [PATCH 03/18] Added check for "fuse-utils" package with fallback to fuse for newer debian versions. --- recipes/install.rb | 49 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/recipes/install.rb b/recipes/install.rb index e35f657..1fdea82 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -11,31 +11,30 @@ mode 0600 end -prereqs = case node.platform_family -when 'debian' - %w( - build-essential - libfuse-dev - fuse-utils - libcurl4-openssl-dev - libxml2-dev - mime-support - ) -when 'rhel' - %w( - gcc - libstdc++-devel - gcc-c++ - curl-devel - libxml2-devel - openssl-devel - mailcap - fuse - fuse-devel - fuse-libs - ) -else - raise "Unsupported platform family provided: #{node.platform_family}" +prereqs = [] + +case node.platform_family + when 'debian' + prereqs.push( + 'build-essential', 'libfuse-dev', 'libcurl4-openssl-dev', 'libxml2-dev', + 'mime-support' + ) + # As of Ubuntu 14.04 "fuse-utils" has been merged into package "fuse" + # so try to install both (auto-installed by fuse-utils in older) + %x(sudo apt-cache show fuse-utils) + if( $? == 0 ) then + prereqs.push( 'fuse-utils' ) + else + prereqs.push( 'fuse' ) + end + when 'rhel' + prereqs.push( + 'gcc', 'libstdc++-devel', 'gcc-c++', 'curl-devel', 'libxml2-devel', + 'libxml2-devel', 'openssl-devel', 'mailcap', 'fuse', 'fuse-devel', + 'fuse-libs' + ) + else + raise "Unsupported platform family provided: #{node.platform_family}" end prereqs = node[:s3fs_fuse][:packages] unless node[:s3fs_fuse][:packages].empty? From 01d202523d458b41d7c916f00c6dc058a92e590e Mon Sep 17 00:00:00 2001 From: James Robinson Date: Tue, 28 Oct 2014 23:44:43 -0400 Subject: [PATCH 04/18] Altered install URI to use SSL (HTTPS). --- recipes/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/install.rb b/recipes/install.rb index 1fdea82..42ca064 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -44,7 +44,7 @@ end s3fs_version = node[:s3fs_fuse][:version] -source_url = "http://github.com/s3fs-fuse/s3fs-fuse/archive/v#{s3fs_version}.tar.gz" +source_url = "https://github.com/s3fs-fuse/s3fs-fuse/archive/v#{s3fs_version}.tar.gz" remote_file "/tmp/s3fs-#{s3fs_version}.tar.gz" do source source_url From 3db2ab6804a47f47d5e8d5ed54ae90afad5728d4 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Wed, 29 Oct 2014 00:10:58 -0400 Subject: [PATCH 05/18] Updated s3fs-fuse version to current latest (previous version did not exist in the GitHub repository). --- attributes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index cb87847..f85d4eb 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] = '1.78' default[:s3fs_fuse][:no_upload] = false default[:s3fs_fuse][:mounts] = [] default[:s3fs_fuse][:bluepill] = false From d9f3fc842c917010562b8b1ddd417eb9fdd8a03f Mon Sep 17 00:00:00 2001 From: James Robinson Date: Wed, 29 Oct 2014 00:33:51 -0400 Subject: [PATCH 06/18] Fixed moving into wrong directory during install. --- recipes/install.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/install.rb b/recipes/install.rb index 42ca064..8474484 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -54,8 +54,8 @@ bash "compile_and_install_s3fs" do cwd '/tmp' code <<-EOH - tar -xzf s3fs-#{s3fs_version}.tar.gz - cd s3fs-#{s3fs_version} + tar -xzf s3fs-#{s3fs_version}.tar.gz -C ./s3fs-#{s3fs_version} + 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 From 91cb3f75e8c93eda1de6bbd2ba30a1714e3d53a9 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Wed, 29 Oct 2014 00:39:11 -0400 Subject: [PATCH 07/18] Added mkdir for missing directory. --- recipes/install.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/install.rb b/recipes/install.rb index 8474484..c13ebb5 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -54,6 +54,7 @@ bash "compile_and_install_s3fs" do cwd '/tmp' code <<-EOH + mkdir ./s3fs-#{s3fs_version} tar -xzf s3fs-#{s3fs_version}.tar.gz -C ./s3fs-#{s3fs_version} cd ./s3fs-#{s3fs_version}/* #{'export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib64/pkgconfig' if node.platform_family == 'rhel'} From cc2396c0f10fe60edfdda3dbc0d8ae8e96bb74ad Mon Sep 17 00:00:00 2001 From: James Robinson Date: Wed, 29 Oct 2014 00:48:32 -0400 Subject: [PATCH 08/18] Added ./autogen.sh command per the install directions. --- recipes/install.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/install.rb b/recipes/install.rb index c13ebb5..bb71d01 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -58,6 +58,7 @@ tar -xzf s3fs-#{s3fs_version}.tar.gz -C ./s3fs-#{s3fs_version} cd ./s3fs-#{s3fs_version}/* #{'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 From ba80294978580879424f73d25b5eecb40821b7c9 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Wed, 29 Oct 2014 10:21:50 -0400 Subject: [PATCH 09/18] Removed "sudo" and added output to /dev/null for package existence check. --- recipes/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/install.rb b/recipes/install.rb index bb71d01..5733077 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -21,7 +21,7 @@ ) # As of Ubuntu 14.04 "fuse-utils" has been merged into package "fuse" # so try to install both (auto-installed by fuse-utils in older) - %x(sudo apt-cache show fuse-utils) + %x(apt-cache show fuse-utils >> /dev/null) if( $? == 0 ) then prereqs.push( 'fuse-utils' ) else From 254cf9657fdea3eaa6e81df53aac043fce3e68d7 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Wed, 29 Oct 2014 10:23:33 -0400 Subject: [PATCH 10/18] Fixed typo in README: '-' should be '_". --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c32d7b..1f760f1 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Usage ```ruby override_attributes( - 's3fs-fuse' => { + 's3fs_fuse' => { :s3_key => 'key', :s3_secret => 'secret', :mounts => [ From 5cec860c909d0d0229773433a5b79136fea43a72 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Wed, 29 Oct 2014 11:04:07 -0400 Subject: [PATCH 11/18] Fixed incorrect attribute index (causing error). --- recipes/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/install.rb b/recipes/install.rb index 5733077..ae48dab 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -69,7 +69,7 @@ false end end - if(node[:s3fs_fuse][:bluepill] && File.exists?(File.join(node[:bluepill][:conf_dir], 's3fs.pill'))) + if(node[:s3fs_fuse][:bluepill] && File.exists?(File.join(node[:s3fs_fuse][:bluepill][:conf_dir], 's3fs.pill'))) notifies :stop, 'bluepill_service[s3fs]' notifies :start, 'bluepill_service[s3fs]' end From 64d796f627906377e2f52d0c890937be84951453 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Wed, 29 Oct 2014 11:11:31 -0400 Subject: [PATCH 12/18] Added type check (causing error with boolean value). --- recipes/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/install.rb b/recipes/install.rb index ae48dab..98591ce 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -69,7 +69,7 @@ false end end - if(node[:s3fs_fuse][:bluepill] && File.exists?(File.join(node[:s3fs_fuse][:bluepill][:conf_dir], 's3fs.pill'))) + if(node[:s3fs_fuse][:bluepill].kind_of?(Array) && File.exists?(File.join(node[:s3fs_fuse][:bluepill][:conf_dir], 's3fs.pill'))) notifies :stop, 'bluepill_service[s3fs]' notifies :start, 'bluepill_service[s3fs]' end From 203580fc9a3c6afaa6818f125a4ad721bfd468a4 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Wed, 29 Oct 2014 11:25:03 -0400 Subject: [PATCH 13/18] Added Berksfile with dependencies to work with newer versions of Bookshelf. --- Berksfile | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Berksfile diff --git a/Berksfile b/Berksfile new file mode 100644 index 0000000..582d105 --- /dev/null +++ b/Berksfile @@ -0,0 +1,4 @@ +source "https://supermarket.getchef.com" + +cookbook 'rc_mon' +cookbook 'bluepill' \ No newline at end of file From 3c35fb4350a7ad28976f77eddf09c63ac48a7925 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Wed, 29 Oct 2014 11:36:56 -0400 Subject: [PATCH 14/18] Added metadata to Berksfile --- Berksfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Berksfile b/Berksfile index 582d105..20281f2 100644 --- a/Berksfile +++ b/Berksfile @@ -1,4 +1,6 @@ source "https://supermarket.getchef.com" +metadata + cookbook 'rc_mon' cookbook 'bluepill' \ No newline at end of file From 59582cb7fdb757679b4573146c77df7269687032 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Wed, 29 Oct 2014 11:44:19 -0400 Subject: [PATCH 15/18] Changed "suggests" to "depends" - "suggests" not officially supported. --- metadata.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.rb b/metadata.rb index 4d2f820..ce8b7c9 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,5 +6,5 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version "0.1.4" -suggests 'bluepill' +depends 'bluepill' depends 'rc_mon' From 63544bbaea8e293fa3ae659785eecb20f6513c71 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Fri, 31 Oct 2014 11:00:13 -0400 Subject: [PATCH 16/18] Fixed sending output to /dev/null. --- recipes/install.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/install.rb b/recipes/install.rb index 98591ce..71de519 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -21,7 +21,7 @@ ) # As of Ubuntu 14.04 "fuse-utils" has been merged into package "fuse" # so try to install both (auto-installed by fuse-utils in older) - %x(apt-cache show fuse-utils >> /dev/null) + %x(apt-cache show fuse-utils 2>&1 1>/dev/null) if( $? == 0 ) then prereqs.push( 'fuse-utils' ) else From 232ac4dcf33294d26ce6e2440002862647128cd9 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Sun, 2 Nov 2014 01:15:52 -0400 Subject: [PATCH 17/18] Separated install from mount process and added checks to prevent installing each time the code is run. --- attributes/default.rb | 2 ++ recipes/default.rb | 33 ++++++++++++++++++++++++++++++++- recipes/install.rb | 9 +++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/attributes/default.rb b/attributes/default.rb index f85d4eb..52f1564 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -9,3 +9,5 @@ default[:s3fs_fuse][:maxmemory] = 100 default[:s3fs_fuse][:fuse_mirror] = 'voxel' default[:s3fs_fuse][:packages] = [] +default[:s3fs_fuse][:force_install] = false +default[:s3fs_fuse][:version_file] = '/etc/s3fs_fuse_version' diff --git a/recipes/default.rb b/recipes/default.rb index 604708d..651902e 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -16,7 +16,38 @@ end end -include_recipe "s3fs-fuse::install" +def s3fs_fuse_installed() + + # Is s3fs installed? + if !`which s3fs`.empty? && $? == 0 + return true # No + end + + return false # Yes +end + +def s3fs_fuse_diff_version( check_against ) + + if !s3fs_fuse_installed() + return true + end + + if File.exists?( node[:s3fs_fuse][:version_file] ) + installed_version = File.open( node[:s3fs_fuse][:version_file], &:gets ) + if installed_version.empty? || installed_version != check_against + # Not properly installed by this script or version is different + return true + end + end + + # s3fs is installed and is the correct version + return false +end + +# Should I run install? +if node[:s3fs_fuse][:force_install] || s3fs_fuse_diff_version( node[:s3fs_fuse][:version] ) + include_recipe "s3fs-fuse::install" +end if(node[:s3fs_fuse][:bluepill]) include_recipe 's3fs-fuse::bluepill' diff --git a/recipes/install.rb b/recipes/install.rb index 71de519..415c75d 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -84,3 +84,12 @@ system('cat /boot/config-`uname -r` | grep -P "^CONFIG_FUSE_FS=y$" > /dev/null') } end + +ruby_block 's3fs_fuse_post_install' do + block do + if s3fs_fuse_installed() + `echo "#{node[:s3fs_fuse][:version]}" > #{node[:s3fs_fuse][:version_file]}` + end + end + action :run +end From 33c74816c1009008d3f4135709a78ad3892cce6f Mon Sep 17 00:00:00 2001 From: James Robinson Date: Sun, 2 Nov 2014 01:29:27 -0400 Subject: [PATCH 18/18] Switched to using template instead of block. --- recipes/install.rb | 9 ++------- templates/default/s3fs_fuse_version | 1 + 2 files changed, 3 insertions(+), 7 deletions(-) create mode 100644 templates/default/s3fs_fuse_version diff --git a/recipes/install.rb b/recipes/install.rb index 415c75d..8681f95 100644 --- a/recipes/install.rb +++ b/recipes/install.rb @@ -85,11 +85,6 @@ } end -ruby_block 's3fs_fuse_post_install' do - block do - if s3fs_fuse_installed() - `echo "#{node[:s3fs_fuse][:version]}" > #{node[:s3fs_fuse][:version_file]}` - end - end - action :run +template node[:s3fs_fuse][:version_file] do + mode 0655 end diff --git a/templates/default/s3fs_fuse_version b/templates/default/s3fs_fuse_version new file mode 100644 index 0000000..081383d --- /dev/null +++ b/templates/default/s3fs_fuse_version @@ -0,0 +1 @@ +<%= node[:s3fs_fuse][:version] %> \ No newline at end of file