This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Setup:
bundle install
bundle exec rake spec_prep # Install fixture modules (required before running specs)Tests:
bundle exec rake spec # Run all unit tests
bundle exec rspec spec/unit/puppet/provider/logical_volume/lvm_spec.rb # Run a single spec file
bundle exec rspec spec/unit/puppet/provider/logical_volume/lvm_spec.rb:42 # Run a specific exampleLinting and validation:
bundle exec rake lint # puppet-lint (configured via .puppet-lint.rc)
bundle exec rake rubocop # RuboCop Ruby style checks
bundle exec rake validate # Syntax check Ruby, Puppet manifests, and metadata
bundle exec rake syntax # Puppet manifest and Hiera syntax checkAll checks (pre-release):
bundle exec rake release_checksThis is a Puppet module that manages Linux LVM and AIX logical volume resources. It follows standard Puppet module structure.
filesystem -> logical_volume -> volume_group -> physical_volume(s)
Each layer must be defined before the one above it. The lvm::volume defined type in manifests/volume.pp wraps this full chain for the common single-PV case.
Each of the four resource types (logical_volume, volume_group, physical_volume, filesystem) has:
- A type definition in
lib/puppet/type/— declares parameters, properties, validation, andautorequirerelationships - A Linux provider (
lvm) inlib/puppet/provider/<type>/lvm.rb— wraps LVM CLI commands (lvcreate,lvextend,vgcreate, etc.) - An AIX provider (
aix) inlib/puppet/provider/<type>/aix.rb— wraps AIX-specific commands; usesdefaultfor/confineonos.name: :AIX
The Linux providers use commands to declare required binaries (e.g., lvcreate, lvremove) and optional_commands for optional ones (e.g., xfs_growfs, resize4fs). Puppet raises an error at catalog application time if a required command is missing.
Many boolean parameters accept [:true, true, 'true', :false, false, 'false'] to handle Puppet's symbol-vs-string boolean ambiguity. When passing these values to shell commands, convert explicitly — e.g., [:true, true, 'true'].include?(value) ? 'y' : 'n'.
Four custom facts: lvm_support, logical_volumes, physical_volumes, volume_groups. These are used internally and in manifests; some flat lvm_vg_* / lvm_pv_* facts are deprecated in favour of structured facts.
lvm::bytes_to_size— converts bytes integer to human-readable size stringlvm::size_to_bytes— converts size string (e.g."20G") to bytes
Puppet_X::LVM::Output.parse parses columnar LVM CLI output (e.g. lvs, vgs) into a hash, stripping column name prefixes (e.g., lv_name → name).
lvmclass — optionallvm2package management + iterates$volume_groupshash viacreate_resourceslvm::volumedefined type — convenience wrapper for the full PV→VG→LV→FS chainlvm::volume_group/lvm::logical_volume/lvm::physical_volume— defined types iterated from thelvmclass hash
Bolt tasks for imperative operations: ensure_pv, ensure_vg, ensure_lv, ensure_fs, extend_lv, extend_vg, mount_lv. Each task has a .rb implementation and a .json parameter schema.
lvm::expand — Bolt plan for expanding an LV and its filesystem.
spec/unit/puppet/provider/<type>/— provider unit tests using Mocha stubs (stub_everything,stubs,expects)spec/unit/puppet/type/— type unit testsspec/unit/facter/— fact unit testsspec/acceptance/— Litmus acceptance tests (require provisioned targets)spec/lib/helpers.rb,spec/lib/matchers.rb— shared test helpers