2 describe 'apt::source', :type => :define do
13 :required_packages => false,
15 :key_server => 'keyserver.ubuntu.com',
16 :key_content => false,
24 :location => 'somewhere',
25 :release => 'precise',
27 :include_src => false,
28 :required_packages => 'apache',
30 :key_server => 'keyserver.debian.com',
32 :key_content => 'ABCD1234'
36 :key_server => 'keyserver.debian.com',
37 :key_content => false,
40 describe "when #{param_set == {} ? "using default" : "specifying"} class parameters" do
42 default_params.merge(param_set)
50 "/etc/apt/sources.list.d/#{title}.list"
54 content = "# #{title}"
55 content << "\ndeb #{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n"
56 if param_hash[:include_src]
57 content << "deb-src #{param_hash[:location]} #{param_hash[:release]} #{param_hash[:repos]}\n"
62 it { should contain_apt__params }
64 it { should contain_file("#{title}.list").with({
76 should contain_apt__pin(param_hash[:release]).with({
77 "priority" => param_hash[:pin],
78 "before" => "File[#{title}.list]"
81 should_not contain_apt__pin(param_hash[:release]).with({
82 "priority" => param_hash[:pin],
83 "before" => "File[#{title}.list]"
89 should contain_exec("#{title} apt update").with({
90 "command" => "/usr/bin/apt-get update",
91 "subscribe" => "File[#{title}.list]",
97 if param_hash[:required_packages]
98 should contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({
99 "command" => "/usr/bin/apt-get -y install #{param_hash[:required_packages]}",
100 "subscribe" => "File[#{title}.list]",
101 "refreshonly" => true
104 should_not contain_exec("Required packages: '#{param_hash[:required_packages]}' for #{title}").with({
105 "command" => "/usr/bin/apt-get -y install #{param_hash[:required_packages]}",
106 "subscribe" => "File[#{title}.list]",
107 "refreshonly" => true
114 should contain_apt__key("Add key: #{param_hash[:key]} from Apt::Source #{title}").with({
115 "key" => param_hash[:key],
116 "ensure" => :present,
117 "key_server" => param_hash[:key_server],
118 "key_content" => param_hash[:key_content],
119 "key_source" => param_hash[:key_source],
120 "before" => "File[#{title}.list]"
123 should_not contain_apt__key("Add key: #{param_hash[:key]} from Apt::Source #{title}").with({
124 "key" => param_hash[:key],
125 "ensure" => :present,
126 "key_server" => param_hash[:key_server],
127 "key_content" => param_hash[:key_content],
128 "key_source" => param_hash[:key_source],
129 "before" => "File[#{title}.list]"