Mercurial > repos > other > Puppet
annotate modules/apache/util/apache_mod_platform_support.rb @ 478:adf6fe9bbc17
Update Puppet modules to latest versions
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Thu, 29 Aug 2024 18:47:29 +0100 |
parents | b8d6ada284dd |
children |
rev | line source |
---|---|
437
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 # frozen_string_literal: true |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
3 require 'json' |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 # Helper class to facilitate exclusion of tests that use an Apache MOD on platforms it isn't supported on. |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 # All Apache MOD classes are defined under 'manifests/mod'. The exclusion should be in the format: |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 # |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 # @note Unsupported platforms: OS: ver, ver; OS: ver, ver, ver; OS: all' |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
8 # class apache::mod::foobar { |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
9 # ... |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
10 # |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
11 # For example: |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
12 # @note Unsupported platforms: RedHat: 5, 6; Ubuntu: 14.04; SLES: all; Scientific: 11 SP1' |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
13 # class apache::mod::actions { |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
14 # apache::mod { 'actions': } |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
15 # } |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
16 # |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
17 # Filtering is then performed during the test using RSpec's filtering, like so: |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
18 # |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
19 # describe 'auth_oidc', unless: mod_unsupported_on_platform('apache::mod::auth_openidc') do |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
20 # ... |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
21 # it 'applies cleanly', unless: mod_unsupported_on_platform('apache::mod::auth_openidc') do |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
22 # ... |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
23 class ApacheModPlatformCompatibility |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
24 ERROR_MSG = { |
478
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
437
diff
changeset
|
25 tag_parse: 'OS and version information in incorrect format:', |
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
437
diff
changeset
|
26 os_parse: 'OS name is not present in metadata.json:' |
437
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
27 }.freeze |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
28 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
29 def initialize |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
30 @os = {} |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
31 @mapping = {} |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
32 @manifest_errors = [] |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
33 @compatible_platform_versions = {} |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
34 @mod_platform_compatibility_mapping = {} |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
35 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
36 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
37 def register_running_platform(os) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
38 @os = { family: os[:family], release: os[:release].to_i } |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
39 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
40 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
41 def generate_supported_platforms_versions |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
42 metadata = JSON.parse(File.read('metadata.json')) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
43 metadata['operatingsystem_support'].each do |os| |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
44 @compatible_platform_versions[os['operatingsystem'].downcase] = os['operatingsystemrelease'].map(&:to_i) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
45 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
46 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
47 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
48 # Class to hold the details of an error whilst parsing an unsupported tag |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
49 class ManifestError |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
50 attr_reader :manifest, :line_num, :error_type, :error_detail |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
51 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
52 def initialize(manifest, line_num, error_type, error_detail) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
53 @manifest = manifest |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
54 @line_num = line_num |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
55 @error_type = error_type |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
56 @error_detail = error_detail |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
57 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
58 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
59 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
60 def print_parsing_errors |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
61 return if @manifest_errors.empty? |
478
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
437
diff
changeset
|
62 |
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
437
diff
changeset
|
63 warn "The following errors were encountered when trying to parse the 'Unsupported platforms' tag(s) in 'manifests/mod':\n" |
437
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
64 @manifest_errors.each do |manifest_error| |
478
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
437
diff
changeset
|
65 warn " * #{manifest_error.manifest} (line #{manifest_error.line_num}): #{ERROR_MSG[manifest_error.error_type]} #{manifest_error.error_detail}" |
437
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
66 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
67 File.readlines('util/_resources/tag_format_help_msg.txt').each do |line| |
478
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
437
diff
changeset
|
68 warn line |
437
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
69 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
70 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
71 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
72 def valid_os?(os) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
73 @compatible_platform_versions.key?(os) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
74 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
75 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
76 def register_error(manifest, line_num, error_type, error_detail) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
77 @manifest_errors << ManifestError.new(manifest, line_num, error_type, error_detail) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
78 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
79 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
80 def register_unsupported_platforms(manifest, line_num, mod, platforms_versions) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
81 platforms_versions.each_key do |os| |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
82 unless valid_os?(os) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
83 register_error(manifest, line_num, :os_parse, os) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
84 next |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
85 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
86 if @mod_platform_compatibility_mapping.key? mod |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
87 @mod_platform_compatibility_mapping[mod].merge!(platforms_versions) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
88 else |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
89 @mod_platform_compatibility_mapping[mod] = platforms_versions |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
90 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
91 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
92 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
93 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
94 def extract_os_ver_pairs(line) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
95 platforms_versions = {} |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
96 os_ver_groups = line.delete(' ').downcase |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
97 # E.g. "debian:5,6;centos:5;sles:11sp1,12;scientific:all;ubuntu:14.04,16.04" |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
98 if %r{^((?:\w+:(?:(?:\d+(?:\.\d+|sp\d+)?|all),?)+;?)+)$}i.match?(os_ver_groups) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
99 os_ver_groups.split(';').each do |os_vers| |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
100 os, vers = os_vers.split(':') |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
101 vers.gsub!(%r{sp\d+}, '') # Remove SP ver as we cannot determine this level of granularity from values from Litmus |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
102 platforms_versions[os] = vers.split(',').map(&:to_i) # 'all' will be converted to 0 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
103 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
104 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
105 platforms_versions |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
106 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
107 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
108 def process_line(line) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
109 data = {} |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
110 return data unless %r{@note\sUnsupported\splatforms?:\s?|class\sapache::mod}i.match?(line) |
478
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
437
diff
changeset
|
111 |
437
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
112 if (match = %r{@note\sUnsupported\splatforms?:\s?(?<os_vers>.*)$}i.match(line)) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
113 data[:type] = :unsupported_platform_declaration |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
114 data[:value] = match[:os_vers] |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
115 elsif (match = %r{class\s(?<mod>apache::mod::\w+)}i.match(line)) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
116 data[:type] = :class_declaration |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
117 data[:value] = match[:mod] |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
118 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
119 data |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
120 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
121 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
122 def generate_mod_platform_exclusions |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
123 Dir.glob('manifests/mod/*.pp').each do |manifest| |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
124 platforms_versions = [] |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
125 line_num = 0 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
126 File.readlines(manifest).each do |line| |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
127 line_num += 1 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
128 data = process_line(line) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
129 next if data.empty? |
478
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
437
diff
changeset
|
130 |
437
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
131 if data[:type] == :unsupported_platform_declaration |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
132 platforms_versions = extract_os_ver_pairs(data[:value]) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
133 register_error(manifest, line_num, :tag_parse, line) if platforms_versions.empty? |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
134 next |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
135 elsif data[:type] == :class_declaration |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
136 register_unsupported_platforms(manifest, line_num, data[:value], platforms_versions) unless platforms_versions.empty? |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
137 break # Once we detect the class declaration, we can move on |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
138 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
139 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
140 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
141 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
142 |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
143 # Called from within the context of a test run, making use of RSpec's filtering, e.g.: |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
144 # it 'should do some test', if: mod_supported_on_platform('apache::mod::foobar') |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
145 def mod_supported_on_platform?(mod) |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
146 return true if @mod_platform_compatibility_mapping.empty? |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
147 return true unless @mod_platform_compatibility_mapping.key? mod |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
148 return true unless @mod_platform_compatibility_mapping[mod].key? @os[:family] |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
149 return false if @mod_platform_compatibility_mapping[mod][@os[:family]] == [0] |
478
adf6fe9bbc17
Update Puppet modules to latest versions
IBBoard <dev@ibboard.co.uk>
parents:
437
diff
changeset
|
150 |
437
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
151 !@mod_platform_compatibility_mapping[mod][@os[:family]].include? @os[:release] |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
152 end |
b8d6ada284dd
Update Apache module to latest version
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
153 end |