2 Variant[String, Integer, Array] $priority = 50,
3 Optional[Enum['file', 'present', 'absent']] $ensure = file,
4 Optional[String] $source = undef,
5 Optional[String] $content = undef,
6 Boolean $notify_update = true,
9 if $content and $source {
10 fail('apt::setting cannot have both content and source')
13 if !$content and !$source {
14 fail('apt::setting needs either of content or source')
17 $title_array = split($title, '-')
18 $setting_type = $title_array[0]
19 $base_name = join(delete_at($title_array, 0), '-')
21 assert_type(Pattern[/\Aconf\z/, /\Apref\z/, /\Alist\z/], $setting_type) |$a, $b| {
22 fail("apt::setting resource name/title must start with either 'conf-', 'pref-' or 'list-'")
25 if $priority !~ Integer {
26 # need this to allow zero-padded priority.
27 assert_type(Pattern[/^\d+$/], $priority) |$a, $b| {
28 fail('apt::setting priority must be an integer or a zero-padded integer')
32 if ($setting_type == 'list') or ($setting_type == 'pref') {
35 $_priority = $priority
38 $_path = $::apt::config_files[$setting_type]['path']
39 $_ext = $::apt::config_files[$setting_type]['ext']
42 $_notify = Class['apt::update']
47 file { "${_path}/${_priority}${base_name}${_ext}":