3030 expect ( Puppet ::Util ::Execution ) . to receive ( :execpipe ) . with ( execpipe_args ) . and_yield ( bash_installed_io )
3131
3232 installed = double ( 'bash' )
33- expect ( described_class ) . to receive ( :new ) . with ( :ensure => "4.2-5ubuntu3" , :error => "ok" , :desired => "install" , :name => "bash" , :status => "installed" , :provider => :dpkg ) . and_return ( installed )
33+ expect ( described_class ) . to receive ( :new ) . with ( :ensure => "4.2-5ubuntu3" , :hold => false , : error => "ok" , :desired => "install" , :name => "bash" , :status => "installed" , :provider => :dpkg ) . and_return ( installed )
3434
3535 expect ( described_class . instances ) . to eq ( [ installed ] )
3636 end
3939 expect ( Puppet ::Util ::Execution ) . to receive ( :execpipe ) . with ( execpipe_args ) . and_yield ( all_installed_io )
4040
4141 bash = double ( 'bash' )
42- expect ( described_class ) . to receive ( :new ) . with ( :ensure => "4.2-5ubuntu3" , :error => "ok" , :desired => "install" , :name => "bash" , :status => "installed" , :provider => :dpkg ) . and_return ( bash )
42+ expect ( described_class ) . to receive ( :new ) . with ( :ensure => "4.2-5ubuntu3" , :hold => false , : error => "ok" , :desired => "install" , :name => "bash" , :status => "installed" , :provider => :dpkg ) . and_return ( bash )
4343 vim = double ( 'vim' )
44- expect ( described_class ) . to receive ( :new ) . with ( :ensure => "2:7.3.547-6ubuntu5" , :error => "ok" , :desired => "install" , :name => "vim" , :status => "installed" , :provider => :dpkg ) . and_return ( vim )
44+ expect ( described_class ) . to receive ( :new ) . with ( :ensure => "2:7.3.547-6ubuntu5" , :hold => false , : error => "ok" , :desired => "install" , :name => "vim" , :status => "installed" , :provider => :dpkg ) . and_return ( vim )
4545
4646 expect ( described_class . instances ) . to eq ( [ bash , vim ] )
4747 end
@@ -81,7 +81,7 @@ def dpkg_query_execution_returns(output)
8181 it "returns a hash of the found package status for an installed package" do
8282 dpkg_query_execution_returns ( bash_installed_output )
8383
84- expect ( provider . query ) . to eq ( { :ensure => "4.2-5ubuntu3" , :error => "ok" , :desired => "install" , :name => "bash" , :status => "installed" , :provider => :dpkg } )
84+ expect ( provider . query ) . to eq ( { :ensure => "4.2-5ubuntu3" , :hold => false , : error => "ok" , :desired => "install" , :name => "bash" , :status => "installed" , :provider => :dpkg } )
8585 end
8686
8787 it "considers the package absent if the dpkg-query result cannot be interpreted" do
@@ -126,7 +126,10 @@ def dpkg_query_execution_returns(output)
126126
127127 it "considers the package held if its state is 'hold'" do
128128 dpkg_query_execution_returns ( bash_installed_output . gsub ( "install" , "hold" ) )
129- expect ( provider . query [ :ensure ] ) . to eq ( :held )
129+ query = provider . query
130+ expect ( query [ :ensure ] ) . to eq ( "4.2-5ubuntu3" )
131+ expect ( query [ :hold ] ) . to eq ( true )
132+
130133 end
131134
132135 context "parsing tests" do
@@ -138,6 +141,7 @@ def dpkg_query_execution_returns(output)
138141 :status => 'status' ,
139142 :name => resource_name ,
140143 :ensure => 'ensure' ,
144+ :hold => false ,
141145 :provider => :dpkg ,
142146 }
143147 end
@@ -183,6 +187,7 @@ def parser_test(dpkg_output_string, gold_hash, number_of_debug_logs = 0)
183187 end
184188
185189 it "uses 'dpkg -i' to install the package" do
190+ expect ( resource ) . to receive ( :[] ) . with ( :hold ) . and_return ( false )
186191 expect ( resource ) . to receive ( :[] ) . with ( :source ) . and_return ( "mypackagefile" )
187192 expect ( provider ) . to receive ( :unhold )
188193 expect ( provider ) . to receive ( :dpkg ) . with ( any_args , "-i" , "mypackagefile" )
@@ -191,6 +196,7 @@ def parser_test(dpkg_output_string, gold_hash, number_of_debug_logs = 0)
191196 end
192197
193198 it "keeps old config files if told to do so" do
199+ expect ( resource ) . to receive ( :[] ) . with ( :hold ) . and_return ( false )
194200 expect ( resource ) . to receive ( :[] ) . with ( :configfiles ) . and_return ( :keep )
195201 expect ( provider ) . to receive ( :unhold )
196202 expect ( provider ) . to receive ( :dpkg ) . with ( "--force-confold" , any_args )
@@ -199,6 +205,7 @@ def parser_test(dpkg_output_string, gold_hash, number_of_debug_logs = 0)
199205 end
200206
201207 it "replaces old config files if told to do so" do
208+ expect ( resource ) . to receive ( :[] ) . with ( :hold ) . and_return ( false )
202209 expect ( resource ) . to receive ( :[] ) . with ( :configfiles ) . and_return ( :replace )
203210 expect ( provider ) . to receive ( :unhold )
204211 expect ( provider ) . to receive ( :dpkg ) . with ( "--force-confnew" , any_args )
@@ -207,6 +214,7 @@ def parser_test(dpkg_output_string, gold_hash, number_of_debug_logs = 0)
207214 end
208215
209216 it "ensures any hold is removed" do
217+ expect ( resource ) . to receive ( :[] ) . with ( :hold ) . and_return ( false )
210218 expect ( provider ) . to receive ( :unhold ) . once
211219 expect ( provider ) . to receive ( :dpkg )
212220 provider . install
@@ -226,7 +234,7 @@ def parser_test(dpkg_output_string, gold_hash, number_of_debug_logs = 0)
226234 allow ( provider ) . to receive ( :execute )
227235 allow ( provider ) . to receive ( :package_not_installed? ) . and_return ( true )
228236 expect ( provider ) . to receive ( :install ) . once
229- provider . hold
237+ provider . deprecated_hold
230238 end
231239
232240 it "skips install new package if package is allready installed" do
0 commit comments