2 Variant[String, Stdlib::Compat::String, Integer, Stdlib::Compat::Integer, Array, Stdlib::Compat::Array] $priority = 50,
3 Optional[Enum['file', 'present', 'absent']] $ensure = file,
4 Optional[Variant[String, Stdlib::Compat::String]] $source = undef,
5 Optional[Variant[String, Stdlib::Compat::String]] $content = undef,
6 Optional[Boolean] $notify_update = true,
10 if $content and $source {
11 fail('apt::setting cannot have both content and source')
14 if !$content and !$source {
15 fail('apt::setting needs either of content or source')
19 validate_legacy(Boolean, 'validate_bool', $notify_update)
22 $title_array = split($title, '-')
23 $setting_type = $title_array[0]
24 $base_name = join(delete_at($title_array, 0), '-')
26 validate_re($setting_type, ['\Aconf\z', '\Apref\z', '\Alist\z'], "apt::setting resource name/title must start with either 'conf-', 'pref-' or 'list-'")
28 unless is_integer($priority) {
29 # need this to allow zero-padded priority.
30 validate_re($priority, '^\d+$', 'apt::setting priority must be an integer or a zero-padded integer')
34 validate_legacy(String, 'validate_string', $source)
38 validate_legacy(String, 'validate_string', $content)
41 if ($setting_type == 'list') or ($setting_type == 'pref') {
44 $_priority = $priority
47 $_path = $::apt::config_files[$setting_type]['path']
48 $_ext = $::apt::config_files[$setting_type]['ext']
51 $_notify = Class['apt::update']
56 file { "${_path}/${_priority}${base_name}${_ext}":