From 983cef7b1b82c3b1ac395db46c05e6fce001ffc6 Mon Sep 17 00:00:00 2001 From: Diego Tapia <64498901+dtapia-IT@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:42:21 -0400 Subject: [PATCH 1/4] (profile::core::fiberspec) add spectrometer udev rule --- site/profile/manifests/core/fiberspec.pp | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 site/profile/manifests/core/fiberspec.pp diff --git a/site/profile/manifests/core/fiberspec.pp b/site/profile/manifests/core/fiberspec.pp new file mode 100644 index 0000000000..356b424892 --- /dev/null +++ b/site/profile/manifests/core/fiberspec.pp @@ -0,0 +1,10 @@ +# @summary +# Manages Avantes Fiberspectrometer USB devices. +# +class profile::core::fiberspec { + systemd::udev::rule { 'fiberspec.rules': + rules => [ + "SUBSYSTEM==\"usb\", ATTR{idVendor}==\"1992\", ATTR{idProduct}==\"0667\", ACTION==\"add\", GROUP=\"saluser\", MODE=\"0664\"", + ], + } +} From a2734f42e5d62dc46443eaafaf48f5f71010cf6f Mon Sep 17 00:00:00 2001 From: Diego Tapia <64498901+dtapia-IT@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:11:51 -0400 Subject: [PATCH 2/4] (role/fiberspec) add fiberspec role --- hieradata/role/fiberspec.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 hieradata/role/fiberspec.yaml diff --git a/hieradata/role/fiberspec.yaml b/hieradata/role/fiberspec.yaml new file mode 100644 index 0000000000..4b6c078785 --- /dev/null +++ b/hieradata/role/fiberspec.yaml @@ -0,0 +1,4 @@ +--- +classes: + - "profile::core::common" + - "profile::core::fiberspec" From 2e1c06de590b5c6e70cac5b00256c54863c0c4ec Mon Sep 17 00:00:00 2001 From: Diego Tapia <64498901+dtapia-IT@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:25:25 -0400 Subject: [PATCH 3/4] (spec/fiberspec.rb) add rule test --- spec/support/spec/fiberspec.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 spec/support/spec/fiberspec.rb diff --git a/spec/support/spec/fiberspec.rb b/spec/support/spec/fiberspec.rb new file mode 100644 index 0000000000..cb2c048d14 --- /dev/null +++ b/spec/support/spec/fiberspec.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +shared_examples 'fiberspec' do + it do + is_expected.to contain_systemd__udev__rule('fiberspec.rules').with( + rules: [ + 'SUBSYSTEM=="usb", ATTR{idVendor}=="1992", ATTR{idProduct}=="0667", ACTION=="add", GROUP="saluser", MODE="0664"', + ], + ) + end +end From c5165fd8e68a096b3b29be791c52c88e0ee06e17 Mon Sep 17 00:00:00 2001 From: Diego Tapia <64498901+dtapia-IT@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:39:05 -0400 Subject: [PATCH 4/4] (spec) add tests --- spec/classes/core/fiberspec_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 spec/classes/core/fiberspec_spec.rb diff --git a/spec/classes/core/fiberspec_spec.rb b/spec/classes/core/fiberspec_spec.rb new file mode 100644 index 0000000000..fdbc5413ef --- /dev/null +++ b/spec/classes/core/fiberspec_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'profile::core::fiberspec' do + on_supported_os.each do |os, os_facts| + context "on #{os}" do + let(:facts) { os_facts } + + it { is_expected.to compile.with_all_deps } + + include_examples 'fiberspec' + end + end +end