-
Notifications
You must be signed in to change notification settings - Fork 682
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom resource not available, undefined local variable or method gordon_config
#232
Comments
@aiwilliams Where do you place the rb file of the resource? |
@chris-rock I've placed it in the |
👍 I get this also. Given:
Running with:
and
|
I will add an example that demonstrates the use of custom resources within the next days |
@chris-rock, thanks! I still get the above behavior on |
This PR add a lot of documentation about profiles and adds an example with It does not cover your use case that loads the |
@erichs @aiwilliams : Thank you for reporting this! As @chris-rock suggested, we can handle it very well in a test profile, i.e.:
See the updated readme: https://github.com/chef/inspec/blob/profile-structure/docs/profiles.rst Would that solve your problem? I'm slightly hesitant to allowing resource definitions at any position in the code, as it may make debugging the code harder in the long run (e.g. if profiles are inherited). If profiles solve this problem for you, we could go that route instead. If not, could you share why, or what you don't like about it? |
I'd like to add to @arlimus that I do not like my implementation of #274 Although its working, it comes with a lot of problems, that make it challenging to change the code in future. I would also prefer to remove the old way of extensions and support resource extensions via compliance profiles. They have a clear structure and allow us to introduce a clear separation of concerns. |
@arlimus @chris-rock, FWIW a directory structure convention for custom resources makes sense to me. 👍 |
I also prefer to go with #252 |
@arlimus @chris-rock I have no strong preference! I was just following instructions, which I did not understand to mean that I should put the file in a particular place. Thanks for working out a solution. |
@aiwilliams @erichs Thanks for the feedback. Then we decide against #274 and vote for #252. Would be great if you could try our the PR and provide some feedback to the current implementation of compliance profiles. |
@chris-rock: using the code @a9ab812, and given the contents of
when executing:
Then I get:
|
@erichs try to use the following cat <<EOF > /etc/gordon/config.yaml
version: '1.0'
EOF |
Ah, thanks! @chris-rock, this appears to work fine. |
I agree that the default output of the |
I think I might be misunderstanding something in the new documentation. I have a project like this:
I find I'm still confused. I suppose I would expect that I might need to create:
Perhaps I'm confusing "resources", "controls", "profiles", "specs"? Hopefully my confusion can help clarify for some folks! |
@aiwilliams Thanks for bringing up this question. That means our documentation is not in a state that it should be. Short answer to your question: Place I try to cover the wording. I will add this to the documentation as well.
|
Thanks @chris-rock, that is helpful. I think I was confused because my goal was to create a reusable resource, yet a discussion developed around reusable profiles. I just went back to master to review the documentation and it no longer discusses custom resources. I think I can close this Issue and assume there are forthcoming changes that will modify https://github.com/chef/inspec/blob/master/docs/readme.rst so that it is clear how one might develop and utilize custom resources in |
I've followed the setup instructions... gem install, simple file with example GordonConfig. Through debugging I see that the resource is listed in the registry. However, I am seeing:
The text was updated successfully, but these errors were encountered: