Chef logs suggest a template resource was updated when it wasnt

So I have been investigating an issue with our chef runs on some of our test nodes. The scenario is this. We use a third party cookbook to install and configure selenium (https://github.com/dhoer/chef-selenium) specifically the node recipe, also we are using the latest version 5.0.1. This recipe just is a wrapper for calling a custom resource which in turn configures a config file (selenium/providers/node.rb line 9) in my chef logs I see this update is made. Then following the completion of this recipe in our in house cookbook we reconfigure this same file with another template resource. The end result is the node's configuration file resembles that of the first template run. But on a subsequent run this will flip flop and the config file will resemble the configuration from the in house cookbook. After further testing the issue appeared to be that the template resources had the same name (this was because they were updating the same file), after giving our in house template resource a unique name this flip flop behavior stopped. But it seems the issue was that looking at chef logs you would think the file was updated correctly. Attached is a snippet from our chef logs showing the confusion. Not sure if this is a bug in the logging or a byproduct of resources sharing the same name and chef wanting to only run things once. Below is an example of the build log that was causing confusion. On line 23 you can see that chef logged it updated the contents of C:/selenium/config/selenium_node.json. Then again on 194 you can see chef again logged it update the contents of that file. Though like I said previously depending on the state of that file before the run it would flip flop and either the contents reflected the first template resource or the second template resource.

[08:24:03][chi-grid-node2] Recipe: selenium::node
[08:24:03][chi-grid-node2]   * selenium_node[selenium_node] action install[2019-08-13T08:24:03-07:00] INFO: Processing selenium_node[selenium_node] action install (selenium::node line 1)
[08:24:03][chi-grid-node2]
[08:24:03][chi-grid-node2]   Recipe: selenium::default
[08:24:03][chi-grid-node2]     * directory[C:/selenium/config] action create[2019-08-13T08:24:03-07:00] INFO: Processing directory[C:/selenium/config] action create (selenium::default line 7)
[08:24:03][chi-grid-node2]  (up to date)
[08:24:03][chi-grid-node2]     * directory[C:/selenium/server] action create[2019-08-13T08:24:03-07:00] INFO: Processing directory[C:/selenium/server] action create (selenium::default line 7)
[08:24:03][chi-grid-node2]  (up to date)
[08:24:03][chi-grid-node2]     * directory[C:/selenium/bin] action create[2019-08-13T08:24:03-07:00] INFO: Processing directory[C:/selenium/bin] action create (selenium::default line 7)
[08:24:03][chi-grid-node2]  (up to date)
[08:24:03][chi-grid-node2]     * directory[C:/selenium/log] action create[2019-08-13T08:24:03-07:00] INFO: Processing directory[C:/selenium/log] action create (selenium::default line 7)
[08:24:03][chi-grid-node2]  (up to date)
[08:24:03][chi-grid-node2]     * remote_file[C:/selenium/server/selenium-server-standalone-3.11.0.jar] action create[2019-08-13T08:24:03-07:00] INFO: Processing remote_file[C:/selenium/server/selenium-server-standalone-3.11.0.jar] action create (selenium::default line 16)
[08:24:03][chi-grid-node2]  (skipped due to not_if)
[08:24:03][chi-grid-node2]     * link[C:/selenium/server/selenium-server-standalone.jar] action create[2019-08-13T08:24:03-07:00] INFO: Processing link[C:/selenium/server/selenium-server-standalone.jar] action create (selenium::default line 22)
[08:24:03][chi-grid-node2]  (up to date)
[08:24:03][chi-grid-node2]     - evaluate block and run any associated actions
[08:24:03][chi-grid-node2]     * template[C:/selenium/config/selenium_node.json] action create[2019-08-13T08:24:03-07:00] INFO: Processing template[C:/selenium/config/selenium_node.json] action create (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/selenium/providers/node.rb line 9)
[08:24:03][chi-grid-node2] [2019-08-13T08:24:03-07:00] INFO: template[C:/selenium/config/selenium_node.json] backed up to C:/Users/*******\.chef\local-mode-cache\backup/selenium/config/selenium_node.json.chef-20190813082403.830744
[08:24:03][chi-grid-node2] [2019-08-13T08:24:03-07:00] INFO: template[C:/selenium/config/selenium_node.json] removed backup at C:/Users/*******\.chef\local-mode-cache\backup/selenium/config/selenium_node.json.chef-20190502085035.749512
[08:24:03][chi-grid-node2] [2019-08-13T08:24:03-07:00] INFO: template[C:/selenium/config/selenium_node.json] updated file contents C:/selenium/config/selenium_node.json
[08:24:03][chi-grid-node2]
[08:24:03][chi-grid-node2]       - update content in file C:/selenium/config/selenium_node.json from 3ffc0d to bf93ca
[08:24:03][chi-grid-node2]       --- C:/selenium/config/selenium_node.json	2019-08-08 11:04:38.000000000 -0700
[08:24:03][chi-grid-node2]       +++ C:/selenium/config/chef-selenium_node20190813-860-6kdqlq.json	2019-08-13 08:24:03.000000000 -0700
[08:24:03][chi-grid-node2]       @@ -1,38 +1,40 @@
[08:24:03][chi-grid-node2]        {
[08:24:03][chi-grid-node2]       -    "capabilities": [
[08:24:03][chi-grid-node2]       -        {
[08:24:03][chi-grid-node2]       -            "browserName": "chrome",
[08:24:03][chi-grid-node2]       -            "maxInstances": 1,
[08:24:03][chi-grid-node2]       -            "version": "60.0.3112.113",
[08:24:03][chi-grid-node2]       -            "seleniumProtocol": "WebDriver"
[08:24:03][chi-grid-node2]       -        },
[08:24:03][chi-grid-node2]       -        {
[08:24:03][chi-grid-node2]       -            "browserName": "firefox",
[08:24:03][chi-grid-node2]       -            "maxInstances": 1,
[08:24:03][chi-grid-node2]       -            "version": "56.0b7",
[08:24:03][chi-grid-node2]       -            "seleniumProtocol": "WebDriver"
[08:24:03][chi-grid-node2]       -        },
[08:24:03][chi-grid-node2]       -        {
[08:24:03][chi-grid-node2]       -            "browserName": "internet explorer",
[08:24:03][chi-grid-node2]       -            "maxInstances": 1,
[08:24:03][chi-grid-node2]       -            "version": 11,
[08:24:03][chi-grid-node2]       -            "seleniumProtocol": "WebDriver"
[08:24:03][chi-grid-node2]       -        }
[08:24:03][chi-grid-node2]       -    ],
[08:24:03][chi-grid-node2]       -    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
[08:24:03][chi-grid-node2]       -    "maxSession": 5,
[08:24:03][chi-grid-node2]       -    "port": 5555,
[08:24:03][chi-grid-node2]       -    "register": true,
[08:24:03][chi-grid-node2]       -    "registerCycle": 5000,
[08:24:03][chi-grid-node2]       -    "hub": "http://chi-grid-hub1.corp.*******.com:4444",
[08:24:03][chi-grid-node2]       -    "nodeStatusCheckTimeout": 5000,
[08:24:04][chi-grid-node2]       -    "nodePolling": 5000,
[08:24:04][chi-grid-node2]       -    "role": "node",
[08:24:04][chi-grid-node2]       -    "unregisterIfStillDownAfter": 60000,
[08:24:04][chi-grid-node2]       -    "downPollingLimit": 2,
[08:24:04][chi-grid-node2]       -    "debug": false,
[08:24:04][chi-grid-node2]       -    "servlets": [],
[08:24:04][chi-grid-node2]       -    "withoutServlets": [],
[08:24:04][chi-grid-node2]       -    "custom": {}
[08:24:04][chi-grid-node2]       +  "capabilities": [
[08:24:04][chi-grid-node2]       +  {
[08:24:04][chi-grid-node2]       +    "browserName": "chrome",
[08:24:04][chi-grid-node2]       +    "maxInstances": 1,
[08:24:04][chi-grid-node2]       +    "version": "76.0.3809.100",
[08:24:04][chi-grid-node2]       +    "seleniumProtocol": "WebDriver"
[08:24:04][chi-grid-node2]       +  },
[08:24:05][chi-grid-node2]       +  {
[08:24:05][chi-grid-node2]       +    "browserName": "firefox",
[08:24:05][chi-grid-node2]       +    "maxInstances": 1,
[08:24:05][chi-grid-node2]       +    "version": "65.0",
[08:24:05][chi-grid-node2]       +    "seleniumProtocol": "WebDriver"
[08:24:05][chi-grid-node2]       +  },
[08:24:05][chi-grid-node2]       +  {
[08:24:05][chi-grid-node2]       +    "browserName": "internet explorer",
[08:24:05][chi-grid-node2]       +    "maxInstances": 1,
[08:24:05][chi-grid-node2]       +    "version": "11",
[08:24:05][chi-grid-node2]       +    "seleniumProtocol": "WebDriver"
[08:24:05][chi-grid-node2]       +  }
[08:24:05][chi-grid-node2]       +],
[08:24:05][chi-grid-node2]       +  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
[08:24:05][chi-grid-node2]       +  "maxSession": 5,
[08:24:05][chi-grid-node2]       +  "port": 5555,
[08:24:05][chi-grid-node2]       +  "register": true,
[08:24:05][chi-grid-node2]       +  "registerCycle": 5000,
[08:24:05][chi-grid-node2]       +  "servlets": [],
[08:24:05][chi-grid-node2]       +  "withoutServlets": [],
[08:24:05][chi-grid-node2]       +  "timeout": 1800,
[08:24:05][chi-grid-node2]       +  "debug": true,
[08:24:05][chi-grid-node2]       +  "timeout": 1800,
[08:24:05][chi-grid-node2]       +  "browserTimeout": 0,
[08:24:05][chi-grid-node2]       +  "jettyMaxThreads": 0,
[08:24:05][chi-grid-node2]       +  "nodeStatusCheckTimeout": 5000,
[08:24:05][chi-grid-node2]       +  "nodePolling": 5000,
[08:24:05][chi-grid-node2]       +  "unregisterIfStillDownAfter": 60000,
[08:24:05][chi-grid-node2]       +  "downPollingLimit": 2,
[08:24:05][chi-grid-node2]       +  "hub": "http://localhost:4444"
[08:24:05][chi-grid-node2]        }
[08:24:05][chi-grid-node2]     * file[C:/selenium/bin/selenium_node.cmd] action create[2019-08-13T08:24:03-07:00] INFO: Processing file[C:/selenium/bin/selenium_node.cmd] action create (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/selenium/libraries/default.rb line 34)
[08:24:05][chi-grid-node2]  (up to date)
[08:24:05][chi-grid-node2]     * ruby_block[hack to mkdir on windows] action run[2019-08-13T08:24:03-07:00] INFO: Processing ruby_block[hack to mkdir on windows] action run (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/selenium/libraries/default.rb line 42)
[08:24:05][chi-grid-node2] [2019-08-13T08:24:03-07:00] INFO: ruby_block[hack to mkdir on windows] called
[08:24:05][chi-grid-node2]
[08:24:05][chi-grid-node2]       - execute the ruby block hack to mkdir on windows
[08:24:05][chi-grid-node2]     * windows_shortcut[C:\Users\selenium\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\selenium_node.lnk] action create[2019-08-13T08:24:03-07:00] INFO: Processing windows_shortcut[C:\Users\selenium\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\selenium_node.lnk] action create (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/selenium/libraries/default.rb line 48)
[08:24:05][chi-grid-node2]
[08:24:05][chi-grid-node2]       - creating shortcut C:\Users\selenium\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\selenium_node.lnk
[08:24:05][chi-grid-node2]       - update C:\Users\selenium\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\selenium_node.lnk
[08:24:05][chi-grid-node2]       -   set target to "C:/selenium/bin/selenium_node.cmd" (was "C:\\selenium\\bin\\selenium_node.cmd")
[08:24:05][chi-grid-node2]     * windows_autologin[selenium] action enable[2019-08-13T08:24:03-07:00] INFO: Processing windows_autologin[selenium] action enable (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/selenium/libraries/default.rb line 67)
[08:24:05][chi-grid-node2]
[08:24:05][chi-grid-node2]       * registry_key[set AutoAdminLogon for selenium] action create[2019-08-13T08:24:03-07:00] INFO: Processing registry_key[set AutoAdminLogon for selenium] action create (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_autologin/providers/default.rb line 20)
[08:24:05][chi-grid-node2]
[08:24:05][chi-grid-node2]         - set value {:name=>"DefaultDomainName", :type=>:string, :data=>"*sensitive value suppressed*"}
[08:24:05][chi-grid-node2]       * registry_key[delete AutoLogonCount for selenium] action delete[2019-08-13T08:24:03-07:00] INFO: Processing registry_key[delete AutoLogonCount for selenium] action delete (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_autologin/providers/default.rb line 40)
[08:24:05][chi-grid-node2]  (up to date)
[08:24:05][chi-grid-node2]
[08:24:05][chi-grid-node2]     * execute[Firewall rule selenium_node for port 5555] action run[2019-08-13T08:24:03-07:00] INFO: Processing execute[Firewall rule selenium_node for port 5555] action run (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/selenium/libraries/default.rb line 56)
[08:24:05][chi-grid-node2] [2019-08-13T08:24:03-07:00] INFO: Processing execute[Guard resource] action run (dynamically defined)
[08:24:05][chi-grid-node2] [2019-08-13T08:24:04-07:00] INFO: execute[Guard resource] ran successfully
[08:24:05][chi-grid-node2]  (skipped due to not_if)
[08:24:05][chi-grid-node2]     * reboot[Reboot to start selenium_node] action nothing[2019-08-13T08:24:04-07:00] INFO: Processing reboot[Reboot to start selenium_node] action nothing (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/selenium/providers/node.rb line 46)
[08:24:05][chi-grid-node2]  (skipped due to action :nothing)
[08:24:05][chi-grid-node2] [2019-08-13T08:24:04-07:00] INFO: template[C:/selenium/config/selenium_node.json] sending request_reboot action to reboot[Reboot to start selenium_node] (delayed)
[08:24:05][chi-grid-node2]     * reboot[Reboot to start selenium_node] action request_reboot[2019-08-13T08:24:04-07:00] INFO: Processing reboot[Reboot to start selenium_node] action request_reboot (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/selenium/providers/node.rb line 46)
[08:24:05][chi-grid-node2] [2019-08-13T08:24:04-07:00] WARN: Reboot requested:'Reboot to start selenium_node'
[08:24:05][chi-grid-node2] [2019-08-13T08:24:04-07:00] INFO: Changing reboot status from {} to {:delay_mins=>1, :reason=>"Need to reboot when the run completes successfully.", :timestamp=>2019-08-13 08:24:04 -0700, :requested_by=>"Reboot to start selenium_node"}
[08:24:05][chi-grid-node2]
[08:24:05][chi-grid-node2]       - request a system reboot to occur if the run succeeds
[08:24:05][chi-grid-node2]
[08:24:05][chi-grid-node2] Recipe: selenium_grid::node
[08:24:05][chi-grid-node2]   * windows_screenresolution[selenium] action run[2019-08-13T08:24:04-07:00] INFO: Processing windows_screenresolution[selenium] action run (selenium_grid::node line 74)
[08:24:05][chi-grid-node2] [2019-08-13T08:24:04-07:00] INFO: windows_screenresolution 1024x768
[08:24:05][chi-grid-node2]
[08:24:05][chi-grid-node2]     * windows_user[rdp_local] action create[2019-08-13T08:24:04-07:00] INFO: Processing windows_user[rdp_local] action create (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_screenresolution/providers/default.rb line 17)
[08:24:05][chi-grid-node2]  (up to date)
[08:24:05][chi-grid-node2]     * group[Administrators] action modify[2019-08-13T08:24:04-07:00] INFO: Processing group[Administrators] action modify (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_screenresolution/providers/default.rb line 22)
[08:24:05][chi-grid-node2] [2019-08-13T08:24:04-07:00] INFO: group[Administrators] modified
[08:24:05][chi-grid-node2]
[08:24:05][chi-grid-node2]       - modify group Administrators
[08:24:05][chi-grid-node2]       - add missing member(s): rdp_local
[08:24:05][chi-grid-node2]     * group[Remote Desktop Users] action modify[2019-08-13T08:24:04-07:00] INFO: Processing group[Remote Desktop Users] action modify (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_screenresolution/providers/default.rb line 22)
[08:24:05][chi-grid-node2]  (up to date)
[08:24:05][chi-grid-node2]     * windows_home[rdp_local] action create[2019-08-13T08:24:04-07:00] INFO: Processing windows_home[rdp_local] action create (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_screenresolution/providers/default.rb line 29)
[08:24:05][chi-grid-node2] [2019-08-13T08:24:04-07:00] INFO: C:\Users\rdp_local created
[08:24:05][chi-grid-node2]
[08:24:05][chi-grid-node2]       * execute[create_build_rdp_local_home_task] action run[2019-08-13T08:24:04-07:00] INFO: Processing execute[create_build_rdp_local_home_task] action run (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_home/providers/default.rb line 18)
[08:24:06][chi-grid-node2] [2019-08-13T08:24:05-07:00] INFO: execute[create_build_rdp_local_home_task] ran successfully
[08:24:06][chi-grid-node2]
[08:24:06][chi-grid-node2]         - execute sensitive resource
[08:24:06][chi-grid-node2]       * execute[run_build_rdp_local_home_task] action run[2019-08-13T08:24:05-07:00] INFO: Processing execute[run_build_rdp_local_home_task] action run (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_home/providers/default.rb line 27)
[08:24:06][chi-grid-node2]  (skipped due to not_if)
[08:24:06][chi-grid-node2]       * ruby_block[wait_until_build_rdp_local_home_task_completed] action run[2019-08-13T08:24:05-07:00] INFO: Processing ruby_block[wait_until_build_rdp_local_home_task_completed] action run (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_home/providers/default.rb line 32)
[08:24:06][chi-grid-node2] [2019-08-13T08:24:05-07:00] INFO: ruby_block[wait_until_build_rdp_local_home_task_completed] called
[08:24:06][chi-grid-node2]
[08:24:06][chi-grid-node2]         - execute the ruby block wait_until_build_rdp_local_home_task_completed
[08:24:06][chi-grid-node2]       * execute[delete_build_rdp_local_home_task] action run[2019-08-13T08:24:05-07:00] INFO: Processing execute[delete_build_rdp_local_home_task] action run (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_home/providers/default.rb line 39)
[08:24:07][chi-grid-node2]
[08:24:07][chi-grid-node2]         [execute] SUCCESS: The scheduled task "build_rdp_local_home" was successfully deleted.
[08:24:07][chi-grid-node2]
[08:24:07][chi-grid-node2] [2019-08-13T08:24:06-07:00] INFO: execute[delete_build_rdp_local_home_task] ran successfully
[08:24:07][chi-grid-node2]         - execute schtasks /Delete /TN "build_rdp_local_home" /F
[08:24:07][chi-grid-node2]
[08:24:07][chi-grid-node2]     * ruby_block[hack to mkdir on windows] action run[2019-08-13T08:24:06-07:00] INFO: Processing ruby_block[hack to mkdir on windows] action run (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_screenresolution/providers/default.rb line 38)
[08:24:07][chi-grid-node2]  (skipped due to not_if)
[08:24:07][chi-grid-node2]     * template[C:/Users/rdp_local/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/rdp_screenresolution.cmd] action create[2019-08-13T08:24:06-07:00] INFO: Processing template[C:/Users/rdp_local/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/rdp_screenresolution.cmd] action create (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_screenresolution/providers/default.rb line 47)
[08:24:07][chi-grid-node2]  (up to date)
[08:24:07][chi-grid-node2]     * registry_key[HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server] action create[2019-08-13T08:24:06-07:00] INFO: Processing registry_key[HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server] action create (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_screenresolution/providers/default.rb line 61)
[08:24:07][chi-grid-node2]  (up to date)
[08:24:07][chi-grid-node2]     * registry_key[HKLM\SOFTWARE\Microsoft\Terminal Server Client] action create[2019-08-13T08:24:06-07:00] INFO: Processing registry_key[HKLM\SOFTWARE\Microsoft\Terminal Server Client] action create (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_screenresolution/providers/default.rb line 68)
[08:24:07][chi-grid-node2]  (up to date)
[08:24:07][chi-grid-node2]     * execute[open rdp firewall] action run[2019-08-13T08:24:06-07:00] INFO: Processing execute[open rdp firewall] action run (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_screenresolution/providers/default.rb line 74)
[08:24:07][chi-grid-node2] [2019-08-13T08:24:06-07:00] INFO: Processing execute[Guard resource] action run (dynamically defined)
[08:24:07][chi-grid-node2] [2019-08-13T08:24:06-07:00] INFO: execute[Guard resource] ran successfully
[08:24:07][chi-grid-node2]  (skipped due to not_if)
[08:24:07][chi-grid-node2]     * windows_autologin[set rdp_local] action enable[2019-08-13T08:24:06-07:00] INFO: Processing windows_autologin[set rdp_local] action enable (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_screenresolution/providers/default.rb line 81)
[08:24:07][chi-grid-node2]
[08:24:07][chi-grid-node2]       * registry_key[set AutoAdminLogon for rdp_local] action create[2019-08-13T08:24:06-07:00] INFO: Processing registry_key[set AutoAdminLogon for rdp_local] action create (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_autologin/providers/default.rb line 20)
[08:24:07][chi-grid-node2]
[08:24:07][chi-grid-node2]         - set value {:name=>"DefaultUsername", :type=>:string, :data=>"*sensitive value suppressed*"}
[08:24:07][chi-grid-node2]         - set value {:name=>"DefaultDomainName", :type=>:string, :data=>"*sensitive value suppressed*"}
[08:24:07][chi-grid-node2]       * registry_key[delete AutoLogonCount for rdp_local] action delete[2019-08-13T08:24:06-07:00] INFO: Processing registry_key[delete AutoLogonCount for rdp_local] action delete (C:/Users/*******/.chef/local-mode-cache/cache/cookbooks/windows_autologin/providers/default.rb line 40)
[08:24:07][chi-grid-node2]  (up to date)
[08:24:07][chi-grid-node2]
[08:24:07][chi-grid-node2]
[08:24:07][chi-grid-node2] Recipe: chef-selenium-grid::node
[08:24:07][chi-grid-node2]   * template[C:/selenium/config/selenium_node.json] action create[2019-08-13T08:24:06-07:00] INFO: Processing template[C:/selenium/config/selenium_node.json] action create (chef-selenium-grid::node line 129)
[08:24:07][chi-grid-node2] [2019-08-13T08:24:06-07:00] INFO: template[C:/selenium/config/selenium_node.json] backed up to C:/Users/*******\.chef\local-mode-cache\backup/selenium/config/selenium_node.json.chef-20190813082406.950784
[08:24:07][chi-grid-node2] [2019-08-13T08:24:06-07:00] INFO: template[C:/selenium/config/selenium_node.json] removed backup at C:/Users/*******\.chef\local-mode-cache\backup/selenium/config/selenium_node.json.chef-20190808110317.148109
[08:24:07][chi-grid-node2] [2019-08-13T08:24:06-07:00] INFO: template[C:/selenium/config/selenium_node.json] updated file contents C:/selenium/config/selenium_node.json
[08:24:07][chi-grid-node2]
[08:24:07][chi-grid-node2]     - update content in file C:/selenium/config/selenium_node.json from bf93ca to 3ffc0d
[08:24:07][chi-grid-node2]     --- C:/selenium/config/selenium_node.json	2019-08-13 08:24:03.000000000 -0700
[08:24:07][chi-grid-node2]     +++ C:/selenium/config/chef-selenium_node20190813-860-oisx6z.json	2019-08-13 08:24:06.000000000 -0700
[08:24:07][chi-grid-node2]     @@ -1,40 +1,38 @@
[08:24:07][chi-grid-node2]      {
[08:24:07][chi-grid-node2]     -  "capabilities": [
[08:24:07][chi-grid-node2]     -  {
[08:24:07][chi-grid-node2]     -    "browserName": "chrome",
[08:24:07][chi-grid-node2]     -    "maxInstances": 1,
[08:24:07][chi-grid-node2]     -    "version": "76.0.3809.100",
[08:24:07][chi-grid-node2]     -    "seleniumProtocol": "WebDriver"
[08:24:07][chi-grid-node2]     -  },
[08:24:07][chi-grid-node2]     -  {
[08:24:07][chi-grid-node2]     -    "browserName": "firefox",
[08:24:07][chi-grid-node2]     -    "maxInstances": 1,
[08:24:07][chi-grid-node2]     -    "version": "65.0",
[08:24:07][chi-grid-node2]     -    "seleniumProtocol": "WebDriver"
[08:24:07][chi-grid-node2]     -  },
[08:24:07][chi-grid-node2]     -  {
[08:24:07][chi-grid-node2]     -    "browserName": "internet explorer",
[08:24:07][chi-grid-node2]     -    "maxInstances": 1,
[08:24:07][chi-grid-node2]     -    "version": "11",
[08:24:07][chi-grid-node2]     -    "seleniumProtocol": "WebDriver"
[08:24:07][chi-grid-node2]     -  }
[08:24:07][chi-grid-node2]     -],
[08:24:07][chi-grid-node2]     -  "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
[08:24:07][chi-grid-node2]     -  "maxSession": 5,
[08:24:07][chi-grid-node2]     -  "port": 5555,
[08:24:07][chi-grid-node2]     -  "register": true,
[08:24:07][chi-grid-node2]     -  "registerCycle": 5000,
[08:24:07][chi-grid-node2]     -  "servlets": [],
[08:24:07][chi-grid-node2]     -  "withoutServlets": [],
[08:24:07][chi-grid-node2]     -  "timeout": 1800,
[08:24:07][chi-grid-node2]     -  "debug": true,
[08:24:07][chi-grid-node2]     -  "timeout": 1800,
[08:24:07][chi-grid-node2]     -  "browserTimeout": 0,
[08:24:07][chi-grid-node2]     -  "jettyMaxThreads": 0,
[08:24:07][chi-grid-node2]     -  "nodeStatusCheckTimeout": 5000,
[08:24:07][chi-grid-node2]     -  "nodePolling": 5000,
[08:24:07][chi-grid-node2]     -  "unregisterIfStillDownAfter": 60000,
[08:24:07][chi-grid-node2]     -  "downPollingLimit": 2,
[08:24:07][chi-grid-node2]     -  "hub": "http://localhost:4444"
[08:24:07][chi-grid-node2]     +    "capabilities": [
[08:24:07][chi-grid-node2]     +        {
[08:24:07][chi-grid-node2]     +            "browserName": "chrome",
[08:24:07][chi-grid-node2]     +            "maxInstances": 1,
[08:24:07][chi-grid-node2]     +            "version": "60.0.3112.113",
[08:24:07][chi-grid-node2]     +            "seleniumProtocol": "WebDriver"
[08:24:07][chi-grid-node2]     +        },
[08:24:07][chi-grid-node2]     +        {
[08:24:07][chi-grid-node2]     +            "browserName": "firefox",
[08:24:07][chi-grid-node2]     +            "maxInstances": 1,
[08:24:07][chi-grid-node2]     +            "version": "56.0b7",
[08:24:07][chi-grid-node2]     +            "seleniumProtocol": "WebDriver"
[08:24:07][chi-grid-node2]     +        },
[08:24:07][chi-grid-node2]     +        {
[08:24:07][chi-grid-node2]     +            "browserName": "internet explorer",
[08:24:07][chi-grid-node2]     +            "maxInstances": 1,
[08:24:07][chi-grid-node2]     +            "version": 11,
[08:24:07][chi-grid-node2]     +            "seleniumProtocol": "WebDriver"
[08:24:07][chi-grid-node2]     +        }
[08:24:07][chi-grid-node2]     +    ],
[08:24:07][chi-grid-node2]     +    "proxy": "org.openqa.grid.selenium.proxy.DefaultRemoteProxy",
[08:24:07][chi-grid-node2]     +    "maxSession": 5,
[08:24:07][chi-grid-node2]     +    "port": 5555,
[08:24:07][chi-grid-node2]     +    "register": true,
[08:24:07][chi-grid-node2]     +    "registerCycle": 5000,
[08:24:07][chi-grid-node2]     +    "hub": "http://chi-grid-hub1.corp.*******.com:4444",
[08:24:07][chi-grid-node2]     +    "nodeStatusCheckTimeout": 5000,
[08:24:07][chi-grid-node2]     +    "nodePolling": 5000,
[08:24:07][chi-grid-node2]     +    "role": "node",
[08:24:07][chi-grid-node2]     +    "unregisterIfStillDownAfter": 60000,
[08:24:07][chi-grid-node2]     +    "downPollingLimit": 2,
[08:24:07][chi-grid-node2]     +    "debug": false,
[08:24:07][chi-grid-node2]     +    "servlets": [],
[08:24:07][chi-grid-node2]     +    "withoutServlets": [],
[08:24:07][chi-grid-node2]     +    "custom": {}
[08:24:07][chi-grid-node2]      }
[08:24:07][chi-grid-node2]   * registry_key[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] action create[2019-08-13T08:24:06-07:00] INFO: Processing registry_key[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon] action create (chef-selenium-grid::node line 134)
[08:24:07][chi-grid-node2]

After some more testing it seems that giving the in house template resource is not stopping the flip flop of config. Fresh out of ideas on why this is happening.

Hi,
Whether or not you are using the same name for the resource, if you are controlling a file in the wrapper cookbook that the community cookbook is also controlling, there will always be flipping from one resource state to another, and all the attached notifications will go off. I think your only option here is to port your configuration file values into the node attributes that the community cookbook expects:

Which I think are at least node['selenium']['node']['capabilities'] and node['selenium']['node']['hub']. I don't use this cookbook myself, but it doesn't appear to have a way to override the template.

Alternatively, you could "unroll" the selenium_node resource in your wrapper cookbook, skipping the part that does the config file: https://github.com/dhoer/chef-selenium/blob/master/providers/node.rb#L40-L50

Thank you for the response, so you are saying even though after the completion of the community cookbook recipe, if I modify the same file in the wrapping cookbook that that there is no guarantee the resulting file will be in the state that the is reported in the logs (the final template log on line 194)?

I had noticed there was a way to configure the file by setting attributes that the community cookbook uses. Just have other things on my plate currently and was looking for a quick fix.

I too would expect that its final state should be what is last reported in the logs, and as you figured out, having identical resource names could mess this up. With separate names, it will still flip but I'd think the final log entry would show the correct state at the moment. Ultimately though, to answer your question, I think controlling the same file with two resources is an undefined behaviour and so there's not really any guarantee about what will happen and how it is reflected in the logs. It could take some serious debugging to find out what's actually happening, unless someone who has grappled with this before has any insight...

1 Like