From b90a2addbbdf03da8e6f38be425c5f1837b2c6bc Mon Sep 17 00:00:00 2001 From: Richard Shade Date: Fri, 13 Jul 2018 14:17:19 -0500 Subject: [PATCH] Additional device support (#68) (#71) * Additional device support (#68) * new additonal_devices attribute * back down lvm version * Running Cookstyle * trying to update chefdk * updating foodcritic rules --- .foodcritic | 2 ++ .travis.yml | 2 +- Berksfile.lock | 6 +++--- README.md | 1 + Rakefile | 2 +- Vagrantfile | 6 +++--- attributes/default.rb | 5 ++++- libraries/helper.rb | 1 + metadata.rb | 6 +++--- 9 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 .foodcritic diff --git a/.foodcritic b/.foodcritic new file mode 100644 index 0000000..0b7e69f --- /dev/null +++ b/.foodcritic @@ -0,0 +1,2 @@ +~FC072 + diff --git a/.travis.yml b/.travis.yml index 7e05ac7..e728025 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: ruby rvm: - 2.3.1 before_install: -- curl -L https://www.getchef.com/chef/install.sh | sudo bash -s -- -P chefdk -v 1.0.3 +- curl -L https://www.getchef.com/chef/install.sh | sudo bash -s -- -P chefdk -v 2.4.17 - gem install bundler -v 1.11.2 install: - chef exec bundle install --jobs=3 --retry=3 diff --git a/Berksfile.lock b/Berksfile.lock index 6d6d1bf..400c6a9 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -6,9 +6,9 @@ DEPENDENCIES path: test/cookbooks/fake GRAPH - ephemeral_lvm (3.0.0) - lvm (>= 4.0.0) + ephemeral_lvm (3.0.2) + lvm (>= 4.0.6) now (>= 0.0.0) fake (0.1.1) - lvm (4.0.5) + lvm (4.1.13) now (1.0.0) diff --git a/README.md b/README.md index daac670..791fdea 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Place the `ephemeral_lvm::default` in the runlist and the ephemeral devices will * `node['ephemeral_lvm']['logical_volume_size']` - the size to be used for the ephemeral LVM. Default: `'100%VG'` - This will use all available space in the volume group. * `node['ephemeral_lvm']['logical_volume_name']` - the name of the logical volume for ephemeral LVM. Default: `'ephemeral0'` * `node['ephemeral_lvm']['stripe_size']` - the stripe size to be used for the ephemeral logical volume. Default: `512` +* `node['ephemeral_lvm']['additonal_devices']` - array of additional devices to add to stripe. Use if we are not finding them in metadata. default: [] # Recipes diff --git a/Rakefile b/Rakefile index e0fbcd0..7987380 100644 --- a/Rakefile +++ b/Rakefile @@ -76,7 +76,7 @@ desc 'runs foodcritic linttask' task :fc_new do FoodCritic::Rake::LintTask.new(:chef) do |t| t.options = { - fail_tags: ['any'] + fail_tags: ['any'], } end end diff --git a/Vagrantfile b/Vagrantfile index bc4fb26..1168d8e 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -78,12 +78,12 @@ Vagrant.configure('2') do |config| mysql: { server_root_password: 'rootpass', server_debian_password: 'debpass', - server_repl_password: 'replpass' - } + server_repl_password: 'replpass', + }, } chef.run_list = [ - 'recipe[ephemeral_lvm::default]' + 'recipe[ephemeral_lvm::default]', ] end end diff --git a/attributes/default.rb b/attributes/default.rb index 5a09a1b..7e69204 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -29,7 +29,7 @@ # The ephemeral mount point options default['ephemeral_lvm']['mount_point_properties'] = { options: %w(defaults noauto), - pass: 0 + pass: 0, } # The ephemeral volume group name @@ -46,3 +46,6 @@ # Whether to wipe signatures on any existing drives default['ephemeral_lvm']['wipe_signatures'] = false + +# Array of devices to force into the ephemeral device list +default['ephemeral_lvm']['additonal_devices'] = [] diff --git a/libraries/helper.rb b/libraries/helper.rb index 899bf92..f9e7348 100644 --- a/libraries/helper.rb +++ b/libraries/helper.rb @@ -56,6 +56,7 @@ def self.gce_ephemeral_devices?(cloud, node) # def self.get_ephemeral_devices(cloud, node) ephemeral_devices = [] + ephemeral_devices.concat node['ephemeral_lvm']['additonal_devices'] # Detects the ephemeral disks available on the instance. # # If the cloud plugin supports block device mapping on the node, obtain the diff --git a/metadata.rb b/metadata.rb index 22788cb..31e209f 100644 --- a/metadata.rb +++ b/metadata.rb @@ -2,10 +2,10 @@ name 'ephemeral_lvm' maintainer 'RightScale, Inc.' maintainer_email 'cookbooks@rightscale.com' -license 'Apache 2.0' +license 'Apache-2.0' description 'Configures available ephemeral devices on a cloud server' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '3.0.1' +version '3.0.2' issues_url 'https://github.com/rightscale-cookbooks/ephemeral_lvm/issues' if respond_to?(:issues_url) source_url 'https://github.com/rightscale-cookbooks/ephemeral_lvm' if respond_to?(:source_url) chef_version '>= 12.0' if respond_to?(:chef_version) @@ -15,7 +15,7 @@ supports 'debian' depends 'now' -depends 'lvm', '>= 4.0' +depends 'lvm', '>= 4.0.6' recipe 'ephemeral_lvm::default', 'Sets up ephemeral devices on a cloud server'