|
68 | 68 | } |
69 | 69 | } |
70 | 70 |
|
| 71 | + # Build configuration lines in order (matching expected test output) |
| 72 | + # Services configuration - sudo has to be started by the socket |
| 73 | + $filtered_services = Array($_services) - ['sudo'] |
| 74 | + $services_line = $_services.empty ? { |
| 75 | + true => [], |
| 76 | + false => $filtered_services.empty ? { true => [], false => ["services = ${filtered_services.join(',')}"] } |
| 77 | + } |
| 78 | + |
| 79 | + # Basic configuration |
| 80 | + $description_line = $_description ? { undef => [], default => ["description = ${_description}"] } |
| 81 | + |
| 82 | + # Domains configuration |
| 83 | + $domains_line = $_domains.empty ? { true => [], false => ["domains = ${Array($_domains).join(', ')}"] } |
| 84 | + |
| 85 | + # Required configuration parameters |
| 86 | + $config_file_version_line = ["config_file_version = ${_config_file_version}"] |
| 87 | + $reconnection_retries_line = ["reconnection_retries = ${_reconnection_retries}"] |
| 88 | + |
| 89 | + # Optional string parameters |
| 90 | + $re_expression_line = $_re_expression ? { undef => [], default => ["re_expression = ${_re_expression}"] } |
| 91 | + $full_name_format_line = $_full_name_format ? { undef => [], default => ["full_name_format = ${_full_name_format}"] } |
| 92 | + |
| 93 | + # Optional boolean parameters (special undef checking) |
| 94 | + $try_inotify_line = $_try_inotify ? { undef => [], default => ["try_inotify = ${_try_inotify}"] } |
| 95 | + $enable_files_domain_line = $_enable_files_domain ? { undef => [], default => ["enable_files_domain = ${_enable_files_domain}"] } |
| 96 | + |
| 97 | + # Optional directory and user parameters |
| 98 | + $krb5_rcache_dir_line = $_krb5_rcache_dir ? { undef => [], default => ["krb5_rcache_dir = ${_krb5_rcache_dir}"] } |
| 99 | + $user_line = $_user ? { undef => [], default => ["user = ${_user}"] } |
| 100 | + $default_domain_suffix_line = $_default_domain_suffix ? { undef => [], default => ["default_domain_suffix = ${_default_domain_suffix}"] } |
| 101 | + $override_space_line = $_override_space ? { undef => [], default => ["override_space = ${_override_space}"] } |
| 102 | + |
| 103 | + # Debug configuration |
| 104 | + $debug_level_line = $_debug_level ? { undef => [], default => ["debug_level = ${_debug_level}"] } |
| 105 | + $debug_timestamps_line = ["debug_timestamps = ${_debug_timestamps}"] |
| 106 | + $debug_microseconds_line = ["debug_microseconds = ${_debug_microseconds}"] |
| 107 | + |
| 108 | + # Combine all lines in order |
| 109 | + $config_lines = ( |
| 110 | + $services_line + |
| 111 | + $description_line + |
| 112 | + $domains_line + |
| 113 | + $config_file_version_line + |
| 114 | + $reconnection_retries_line + |
| 115 | + $re_expression_line + |
| 116 | + $full_name_format_line + |
| 117 | + $try_inotify_line + |
| 118 | + $krb5_rcache_dir_line + |
| 119 | + $user_line + |
| 120 | + $default_domain_suffix_line + |
| 121 | + $override_space_line + |
| 122 | + $enable_files_domain_line + |
| 123 | + $debug_level_line + |
| 124 | + $debug_timestamps_line + |
| 125 | + $debug_microseconds_line |
| 126 | + ) |
| 127 | + |
| 128 | + # Join all configuration lines |
| 129 | + $content = $config_lines.join("\n") |
| 130 | + |
71 | 131 | file { '/etc/sssd/sssd.conf': |
72 | 132 | owner => 'root', |
73 | 133 | group => 'root', |
74 | 134 | mode => '0600', |
75 | | - content => epp( |
76 | | - "${module_name}/sssd.conf.epp", |
77 | | - { |
78 | | - '_domains' => $_domains, |
79 | | - '_debug_level' => $_debug_level, |
80 | | - '_debug_timestamps' => $_debug_timestamps, |
81 | | - '_debug_microseconds' => $_debug_microseconds, |
82 | | - '_description' => $_description, |
83 | | - '_enable_files_domain' => $_enable_files_domain, |
84 | | - '_config_file_version' => $_config_file_version, |
85 | | - '_services' => $_services, |
86 | | - '_reconnection_retries' => $_reconnection_retries, |
87 | | - '_re_expression' => $_re_expression, |
88 | | - '_full_name_format' => $_full_name_format, |
89 | | - '_try_inotify' => $_try_inotify, |
90 | | - '_krb5_rcache_dir' => $_krb5_rcache_dir, |
91 | | - '_user' => $_user, |
92 | | - '_default_domain_suffix' => $_default_domain_suffix, |
93 | | - '_override_space' => $_override_space, |
94 | | - }, |
95 | | - ), |
| 135 | + content => epp("${module_name}/sssd.conf.epp", { |
| 136 | + 'content' => $content, |
| 137 | + }), |
96 | 138 | notify => Class["${module_name}::service"], |
97 | 139 | } |
98 | 140 | } |
0 commit comments