Skip to content

Commit

Permalink
Install lvm package during compile phase and don't execute volume_ext…
Browse files Browse the repository at this point in the history
…end recipe unless di-ruby-lvm gem is installed
  • Loading branch information
dpattmann committed Jun 10, 2016
1 parent 19bca42 commit f46d411
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased
- **[PR #58](https://github.com/shortdudey123/chef-gluster/pull/58)** - Fix case statement syntax
- **[PR #59](https://github.com/shortdudey123/chef-gluster/pull/59)** - Fix problems with volume_extend recipe
- **[PR #61](https://github.com/shortdudey123/chef-gluster/pull/61)** - Update disk controller logic for Vagrant template

## v5.0.1 (2016-03-12)
Expand Down
4 changes: 2 additions & 2 deletions attributes/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
# Package dependencies
case node['platform']
when 'ubuntu'
default['gluster']['server']['dependencies'] = ['xfsprogs']
default['gluster']['server']['dependencies'] = %w(xfsprogs lvm2)
when 'redhat', 'centos'
default['gluster']['server']['dependencies'] = ['xfsprogs']
default['gluster']['server']['dependencies'] = %w(xfsprogs lvm2)
end

# Default path to use for mounting bricks
Expand Down
7 changes: 6 additions & 1 deletion recipes/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@
include_recipe 'lvm'
include_recipe 'gluster::server_setup'
include_recipe 'gluster::server_extend'
include_recipe 'gluster::volume_extend'
include_recipe 'gluster::volume_extend' if begin
Gem::Specification.find_by_name('di-ruby-lvm')
rescue Gem::LoadError
Chef::Log.info('not including gluster::volume_extend since di-ruby-lvm was not found')
return false
end
4 changes: 3 additions & 1 deletion recipes/server_install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@

# Install dependencies
node['gluster']['server']['dependencies'].each do |d|
package d
package d do
action :nothing
end.run_action :install
end

# Install the server package
Expand Down

4 comments on commit f46d411

@laurencepettitt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth bumping the version number after this commit as it is a bug fix?
I am having trouble with berkshelf getting this commit because it sees no difference between this and any other commit at version 5.0.1.

@shortdudey123
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

want to close one other issue before bumping the version
Do bundle exec berks update gluster and it will pick up this one assuming you have the correct commit hash in your Berksfile

@laurencepettitt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great thanks, it is working now. However I am still not exactly sure why! If you have any interest, although its not specific to your cookbook, perhaps you might be able to throw some light on this quirky thing:

I have a cookbook called 'servu-stack' which depends upon a cookbook called 'servu-gluster' which is a wrapper cookbook and thus depends upon this cookbook, called 'gluster'. Dependancy tree like this:

servu-stack
  ↳ servu-gluster
      ↳ gluster

In the 'servu-gluster' cookbook's Berksfile it defines this commit:

cookbook 'gluster', git: 'https://github.com/shortdudey123/chef-gluster.git', :ref => '128da'

Running berks install in the 'servu-gluster' cookbook correctly pulls down this cookbook into the Berkshelf, at this commit.

However, running berks install in the 'servu-stack' cookbook, pulls this cookbook into the Berkshelf at the wrong (previous) commit.

So I added into the Berksfile of the 'servu-stack' cookbook a line, exactly like above:

cookbook 'gluster', git: 'https://github.com/shortdudey123/chef-gluster.git', :ref => '128da'

This meant the 'servu-stack' now resolves to the correct dependancy. However, I do not understand why this is necessary, as surely Berkshelf should look down the dependancy tree and resolve the correct dependency of a dependant, in the same way as the dependant does?

@shortdudey123
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Berkshelf only locks its dependency tree for the Berksfile you give it. It doesn't do that if you do berks install between Berksfile's

Please sign in to comment.