Coder Social home page Coder Social logo

Comments (10)

steelcowboy avatar steelcowboy commented on May 2, 2024 1

You can follow along at chef/chef#9885 for the root cause, but the tl;dr is that Chef would silently determine what resource it should be loading, but when that went away it defaulted to using the Windows resource. As such, the reason why you saw nothing on Linux and MacOS was that the Windows resource was sanely returning since it wasn't running on WIndows :)

I think by simply renaming the resource to cpe_chrome_win the collision is gone, it's correctly determining the resource through provides, and this issue should be solved! Please let me know if you're still having problems and we can look into it, otherwise closing this out.

Thank you so much for bringing this to our attention, helping us get rid of this issue in a few other places too!

from it-cpe.

mikedodge04 avatar mikedodge04 commented on May 2, 2024

from it-cpe.

erikng avatar erikng commented on May 2, 2024

from it-cpe.

btm avatar btm commented on May 2, 2024

Chef 16.0.287 (and Chef 16.1.0), current head of this repo (5e0bce5), Windows 10. The cpe_chrome cookbook doesn't appear to have any issues for me.

Having a better example of a reproduction would be helpful.

PS C:\Users\btm\Documents\IT-CPE\itchef> cat .\chrome.json
{
        "cpe_chrome": {
                "mp": {
                        "FileContents": {
                                "first_run_tabs": [
                                        "https://www.facebook.com"
                                ]
                        }
                }
        }
}
PS C:\Users\btm\Documents\IT-CPE\itchef> chef-client -z -o cpe_chrome -j chrome.json
[2020-05-19T20:21:52+00:00] WARN: No config file found or specified on command line. Using command line options instead.
Starting Chef Infra Client, version 16.0.287
[2020-05-19T20:22:06+00:00] WARN: Run List override has been provided.
[2020-05-19T20:22:06+00:00] WARN: Overridden Run List: [recipe[cpe_chrome]]
resolving cookbooks for run list: ["cpe_chrome"]
Synchronizing Cookbooks:
  - cpe_profiles (0.1.0)
  - cpe_chrome (0.1.0)
  - cpe_helpers (0.1.0)
  - fb_helpers (0.1.0)
Installing Cookbook Gems:
Compiling Cookbooks...
Converging 1 resources
Recipe: cpe_chrome::default
  * cpe_chrome[Configure Google Chrome] action config[2020-05-19T20:22:07+00:00] WARN: TotalMemoryLimitMb is not a supported setting

    * registry_key[HKLM\Software\Policies\Google\Chrome\AutoplayWhitelist] action delete_key (up to date)
    * registry_key[HKLM\Software\Policies\Google\Chrome\AutoplayWhitelist] action create (skipped due to not_if)
    * registry_key[HKLM\Software\Policies\Google\Chrome\ExtensionInstallForcelist] action delete_key (up to date)
    * registry_key[HKLM\Software\Policies\Google\Chrome\ExtensionInstallForcelist] action create (skipped due to not_if)
    * registry_key[HKLM\Software\Policies\Google\Chrome\ExtensionInstallBlacklist] action delete_key (up to date)
    * registry_key[HKLM\Software\Policies\Google\Chrome\ExtensionInstallBlacklist] action create (skipped due to not_if)
    * registry_key[HKLM\Software\Policies\Google\Chrome\DefaultPluginsSetting] action delete_key
      - delete key HKLM\Software\Policies\Google\Chrome\DefaultPluginsSetting
    * registry_key[HKLM\Software\Policies\Google\Chrome\DefaultPluginsSetting] action create
      - create key HKLM\Software\Policies\Google\Chrome\DefaultPluginsSetting
      - set value {:name=>"DefaultPluginsSetting", :type=>:dword, :data=>nil}
    * registry_key[HKLM\Software\Policies\Google\Chrome\ExtensionInstallSources] action delete_key (up to date)
    * registry_key[HKLM\Software\Policies\Google\Chrome\ExtensionInstallSources] action create (skipped due to not_if)
    * registry_key[HKLM\Software\Policies\Google\Chrome\PluginsAllowedForUrls] action delete_key (up to date)
    * registry_key[HKLM\Software\Policies\Google\Chrome\PluginsAllowedForUrls] action create (skipped due to not_if)
    * registry_key[HKLM\Software\Policies\Google\Chrome\RelaunchNotification] action delete_key
      - delete key HKLM\Software\Policies\Google\Chrome\RelaunchNotification
    * registry_key[HKLM\Software\Policies\Google\Chrome\RelaunchNotification] action create
      - create key HKLM\Software\Policies\Google\Chrome\RelaunchNotification
      - set value {:name=>"RelaunchNotification", :type=>:dword, :data=>nil}
    * registry_key[HKLM\Software\Policies\Google\Chrome\RelaunchNotificationPeriod] action delete_key
      - delete key HKLM\Software\Policies\Google\Chrome\RelaunchNotificationPeriod
    * registry_key[HKLM\Software\Policies\Google\Chrome\RelaunchNotificationPeriod] action create
      - create key HKLM\Software\Policies\Google\Chrome\RelaunchNotificationPeriod
      - set value {:name=>"RelaunchNotificationPeriod", :type=>:dword, :data=>nil}
    * file[delete-c:\Program Files (x86)\Google\Chrome\Application\master_preferences] action delete (skipped due to only_if)
    * directory[C:\Program Files (x86)\Google] action create (up to date)
    * directory[C:\Program Files (x86)\Google\Chrome] action create (up to date)
    * directory[C:\Program Files (x86)\Google\Chrome\Application] action create (up to date)
    * file[create-c:\Program Files (x86)\Google\Chrome\Application\master_preferences] action create (up to date)

[2020-05-19T20:22:07+00:00] WARN: Skipping final node save because override_runlist was given

Running handlers:
Running handlers complete
Chef Infra Client finished, 7/22 resources updated in 09 seconds

from it-cpe.

erikng avatar erikng commented on May 2, 2024

Sweet, I'll backport this fix as well. Glad you were able to replicate it.

from it-cpe.

btm avatar btm commented on May 2, 2024

@steelcowboy as I mentioned over on this commit, I recommend leaving the resources with the same name, but the linux version needs a provides line added to it.

This makes it easier on the user, you don't have to figure out and remember if it is cpe_chrome_win or cpe_chrome_linux or cpe_chrome or win_cpe_chrome or any other combination. You can have multiple resources with the same name (even on Chef 16) but chef needs the provides line to figure out which one to use.

from it-cpe.

erikng avatar erikng commented on May 2, 2024

from it-cpe.

michel-slm avatar michel-slm commented on May 2, 2024

@steelcowboy as I mentioned over on this commit, I recommend leaving the resources with the same name, but the linux version needs a provides line added to it.

@btm what directory structure would you recommend, if the resources have the same names?

Currently we have

cpe_chrome
|- resources
   |- cpe_chrome_posix.rb (renamed from cpe_chrome.rb)
   |- cpe_chrome_win.rb

with both resources providing cpe_chrome for the proper OSes.

curious what your recommendation is. This works, and it's the Facebook convention so people who use Chef won't get confused, so if there's a more canonical way we should consider doing a full refactor to be consistent.

from it-cpe.

btm avatar btm commented on May 2, 2024

@michel-slm that is fine, but would drop the resource_name lines from the resources.

lamont: if you haven’t set a resource_name yet, chef 16 will wire up a resource_name for the first provides it finds
lamont: (there’s also the fallback default of cookbook_name+resource_file if nothing at all is found)

when you have both a resource_name and provides you're kind of telling chef what the resource is called twice.

from it-cpe.

michel-slm avatar michel-slm commented on May 2, 2024

@btm oh interesting. Is that safe on all Chef versions? On the production side Facebook is still using Chef 13 (and trying to upgrade); on the client side we're on 15/16 but we want to keep our style guide consistent.

from it-cpe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.