[chef] Issue with Chef not finding contents within a file


Chronological Thread 
  • From: Matt Clark < >
  • To: Chef Mailing List < >
  • Subject: [chef] Issue with Chef not finding contents within a file
  • Date: Tue, 8 Sep 2015 11:56:42 -0500

Hello Chefs! 

I am working on an audit mode cookbook that verifies an application was deployed to IIS with the expected configuration and token values in the Web.config. The issue I am experiencing is that Chef tells me that the values I am expecting to exist in the Web.config file are not there, but manually reviewing the file shows them to be there. I thought perhaps IIS was locking the file, so I copied it out to a temporary location but I am still seeing it fail. 

Exception 
========= 
1) Verify deployment tokens should exist 
   Failure/Error: expect(file(web_config_file)).to contain token 
     expected File "Web.config" to contain "<add key=\"GFSIntranetDBType\" value=\"false\"/>" 
   # c:/chef/cache/cookbooks/nsm_deploy_audit/recipes/audit.rb:93:in `block (5 levels) in from_file'

Snippet of Web.config 
=================== 
... 
<add key="GFSIntranetDBType" value="false" /> 
... 

Relevant code in cookbook 
======================== 
web_config_file = "Web.config" 

control "tokens" do 
        # tokens_to_check is an array of strings each containing XML text that is expected in the web.config 
        tokens_to_check.each do |token| 
                it 'should exist' do 
                        expect(file(web_config_file)).to contain token 
                end 
        end 
end 

Any guidance you all could provide in identifying the cause of the failures is appreciated! 

Thanks, 
Matt




Archive powered by MHonArc 2.6.16.

§