Skip to content

Commit

Permalink
Merge pull request #296 from puppetlabs/gh-295-fix_vg_datatype
Browse files Browse the repository at this point in the history
(GH-295) - fix vg datatype
  • Loading branch information
chelnak authored Jun 7, 2023
2 parents d7c5136 + 66bad02 commit 427287d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
7 changes: 4 additions & 3 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2023-05-30 12:44:48 UTC using RuboCop version 1.48.1.
# on 2023-06-07 11:03:43 UTC using RuboCop version 1.48.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -98,7 +98,7 @@ RSpec/ContextWording:
Exclude:
- 'spec/unit/puppet/provider/logical_volume/lvm_spec.rb'

# Offense count: 22
# Offense count: 23
# Configuration parameters: IgnoredMetadata.
RSpec/DescribeClass:
Enabled: false
Expand Down Expand Up @@ -133,11 +133,12 @@ RSpec/MultipleDescribes:
Exclude:
- 'spec/unit/facter/lvm_support_spec.rb'

# Offense count: 25
# Offense count: 26
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
# SupportedStyles: always, named_only
RSpec/NamedSubject:
Exclude:
- 'spec/defines/volume_spec.rb'
- 'spec/functions/bytes_to_size_spec.rb'
- 'spec/functions/size_to_bytes_spec.rb'
- 'spec/unit/classes/lvm_spec.rb'
Expand Down
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ Data type: `Stdlib::Absolutepath`

##### <a name="-lvm--volume--vg"></a>`vg`

Data type: `Stdlib::Absolutepath`
Data type: `String[1]`



Expand Down
3 changes: 1 addition & 2 deletions lib/puppet/type/logical_volume.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ def insync?(is)
desc 'An optimization in lvcreate, at least on Linux.'
end
newparam(:region_size) do
desc 'A mirror is divided into regions of this size (in MB), the mirror log uses this granularity to track which regions are in sync. CAN NOT BE CHANGED on already mirrored volume.' \
'Take your mirror size in terabytes and round up that number to the next power of 2, using that number as the -R argument.'
desc 'A mirror is divided into regions of this size (in MB), the mirror log uses this granularity to track which regions are in sync. CAN NOT BE CHANGED on already mirrored volume. Take your mirror size in terabytes and round up that number to the next power of 2, using that number as the -R argument.' # rubocop:disable Layout/LineLength
validate do |value|
raise ArgumentError, "#{value} is not a valid region size in MB." unless %r{^[0-9]+$}i.match?(value.to_s)
end
Expand Down
2 changes: 1 addition & 1 deletion manifests/volume.pp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
define lvm::volume (
Enum['present', 'absent', 'cleaned'] $ensure,
Stdlib::Absolutepath $pv,
Stdlib::Absolutepath $vg,
String[1] $vg,
Optional[String[1]] $fstype = undef,
Optional[String[1]] $size = undef,
Optional[Variant[String[1], Integer]] $extents = undef,
Expand Down
23 changes: 23 additions & 0 deletions spec/defines/volume_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# frozen_string_literal: true

require 'spec_helper'

describe 'lvm::volume' do
let(:title) { 'lv_example0' }

context 'when passed valid parameters, it will compile' do
let :params do
{
ensure: 'present',
vg: 'vg_example0',
pv: '/dev/sdd1',
fstype: 'ext4',
size: '100GB'
}
end

it {
expect(subject).to compile
}
end
end

0 comments on commit 427287d

Please sign in to comment.