10 $_file = merge($::apt::file_defaults, $file_perms)
12 if $content and $source {
13 fail('apt::setting cannot have both content and source')
16 if !$content and !$source {
17 fail('apt::setting needs either of content or source')
20 validate_re($ensure, ['file', 'present', 'absent'])
21 validate_bool($notify_update)
23 $title_array = split($title, '-')
24 $setting_type = $title_array[0]
25 $base_name = join(delete_at($title_array, 0), '-')
27 validate_re($setting_type, ['\Aconf\z', '\Apref\z', '\Alist\z'], "apt::setting resource name/title must start with either 'conf-', 'pref-' or 'list-'")
29 unless is_integer($priority) {
30 # need this to allow zero-padded priority.
31 validate_re($priority, '^\d+$', 'apt::setting priority must be an integer or a zero-padded integer')
35 validate_string($source)
39 validate_string($content)
42 if $setting_type == 'list' {
45 $_priority = $priority
48 $_path = $::apt::config_files[$setting_type]['path']
49 $_ext = $::apt::config_files[$setting_type]['ext']
52 $_notify = Exec['apt_update']
57 file { "${_path}/${_priority}${base_name}${_ext}":
59 owner => $_file['owner'],
60 group => $_file['group'],
61 mode => $_file['mode'],
68 anchor { "apt::setting::${name}":
69 require => Class['apt::update']