From a22990d4d5abe1eecd59a818b6e69eb6aa3423e1 Mon Sep 17 00:00:00 2001 From: Benedikt Trefzer Date: Tue, 13 Jun 2023 15:05:16 +0200 Subject: [PATCH] add a separate datatype for servicedefault Needed for non String types if they have a default that points to facts['os_service_default']. Otherwise we need to allow String for all parameters. Since the function is_service_default checks the string, I do not assume that the fact is overwritten in any deployment ! Change-Id: Ic2b969f9b99d1748c80edb691f38f4451e499a80 --- spec/type_aliases/servicedefault_spec.rb | 33 ++++++++++++++++++++++++ types/servicedefault.pp | 1 + 2 files changed, 34 insertions(+) create mode 100644 spec/type_aliases/servicedefault_spec.rb create mode 100644 types/servicedefault.pp diff --git a/spec/type_aliases/servicedefault_spec.rb b/spec/type_aliases/servicedefault_spec.rb new file mode 100644 index 00000000..f1bbbe6e --- /dev/null +++ b/spec/type_aliases/servicedefault_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +describe 'Openstacklib::ServiceDefault' do + describe 'valid types' do + context 'with valid types' do + [ + '', + ].each do |value| + describe value.inspect do + it { is_expected.to allow_value(value) } + end + end + end + end + + describe 'invalid types' do + context 'with garbage inputs' do + [ + 'somethink', + true, + nil, + {}, + '', + 55555, + ].each do |value| + describe value.inspect do + it { is_expected.not_to allow_value(value) } + end + end + end + end +end + diff --git a/types/servicedefault.pp b/types/servicedefault.pp new file mode 100644 index 00000000..5008fd5d --- /dev/null +++ b/types/servicedefault.pp @@ -0,0 +1 @@ +type Openstacklib::ServiceDefault = Enum['']