Giter Site home page Giter Site logo

Comments (6)

cheeseplus avatar cheeseplus commented on August 24, 2024

Pretty sure there isn't anything unexpected here - if the attribute check is moved into the recipe as opposed to the attributes I'm pretty sure you'd get the desired effect. Try that and let us know - at least as I read this there isn't anything wrong so much as the order of operations should simply be changed.

from ohai.

Annih avatar Annih commented on August 24, 2024

Thanks for your suggestion, it surely "works", but this is not the described scenario ... I want to use my attribute in the attribute file. I don't want to move it to the recipe, I want the ohai attributes available in attributes phase, which seems to me normal.
For me, attributes files are here to compute attributes at certain time in the process, I don't want to compute my attributes in recipes, otherwise it breaks the flow, and the cookbook depending on me won't be able to rely on my attributes.

To rephrase my question:

I want to have access to custom ohai plugin's attributes inside attributes file; is there any other way than changing the Ohai::plugin_path using the chef-client cookbook?

from ohai.

iennae avatar iennae commented on August 24, 2024

What do you mean by the "attributes phase"? This cookbook isn't going to change how ohai works. The error you are pasting in here is around test kitchen + ohai.

from ohai.

Annih avatar Annih commented on August 24, 2024

@iennae the example I give you is a repro in kitchen yes.
When I talkk about attribute phase, I'm trying to name the phase when the attributes are compiled.

I'll try to explain in a different way, let's say cookbook B depends on an ohai attribute defined in cookbook A

  1. ohai runs
  2. A attributes are compiled
  3. B attributes are compiled
    ... other stuffs are done
  4. A recipe is included and compiled
  5. B recipe is included and compiled

In this example, the "attribute phase" starts after 1. and ends before 4.
During this phase, because my ohai plugin is not in the plugin_path, it has not been loaded at step 1.
So in step 3. B attributes won't be able to compute a value based on the ohai plugin

Is it clearer this way?

from ohai.

mikemol avatar mikemol commented on August 24, 2024

@Annih, if I understand the docs, you need to specify depends 'attributename' in ohai plugin you want to be able to consume an attribute within.

from ohai.

Annih avatar Annih commented on August 24, 2024

Thanks @mikemol for your answer, but in my case I'm not in a ohai plugin, I'm using the result of a plugin in attributes files.

from ohai.

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.