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')
18 validate_re($ensure, ['file', 'present', 'absent'])
19 validate_bool($notify_update)
21 $title_array = split($title, '-')
22 $setting_type = $title_array[0]
23 $base_name = join(delete_at($title_array, 0), '-')
25 validate_re($setting_type, ['\Aconf\z', '\Apref\z', '\Alist\z'], "apt::setting resource name/title must start with either 'conf-', 'pref-' or 'list-'")
27 unless is_integer($priority) {
28 # need this to allow zero-padded priority.
29 validate_re($priority, '^\d+$', 'apt::setting priority must be an integer or a zero-padded integer')
33 validate_string($source)
37 validate_string($content)
40 if ($setting_type == 'list') or ($setting_type == 'pref') {
43 $_priority = $priority
46 $_path = $::apt::params::config_files[$setting_type]['path']
47 $_ext = $::apt::params::config_files[$setting_type]['ext']
50 $_notify = Class['apt::update']
55 file { "${_path}/${_priority}${base_name}${_ext}":