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 validate_re($ensure, ['file', 'present', 'absent'])
18 validate_bool($notify_update)
20 $title_array = split($title, '-')
21 $setting_type = $title_array[0]
22 $base_name = join(delete_at($title_array, 0), '-')
24 validate_re($setting_type, ['\Aconf\z', '\Apref\z', '\Alist\z'], "apt::setting resource name/title must start with either 'conf-', 'pref-' or 'list-'")
26 unless is_integer($priority) {
27 # need this to allow zero-padded priority.
28 validate_re($priority, '^\d+$', 'apt::setting priority must be an integer or a zero-padded integer')
32 validate_string($source)
36 validate_string($content)
39 if $setting_type == 'list' {
42 $_priority = $priority
45 $_path = $::apt::config_files[$setting_type]['path']
46 $_ext = $::apt::config_files[$setting_type]['ext']
49 $_notify = Exec['apt_update']
54 file { "${_path}/${_priority}${base_name}${_ext}":
65 anchor { "apt::setting::${name}":
66 require => Class['apt::update']