Skip to content
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

Fix search() for currently provisioned node #4

Merged
merged 1 commit into from Jun 26, 2015
Merged

Fix search() for currently provisioned node #4

merged 1 commit into from Jun 26, 2015

Conversation

ustuehler
Copy link
Contributor

In order for Chef's search function to find the node which is currently being
provisioned, the .json file that describes it must be part of the sandbox that
gets transferred. Thus #create_node method must be called before #super in
the Kitchen::Provisioner::Nodes#create_sandbox method since Kitchen::Provisioner
::Chef::CommonSandbox#create_sandbox calls prepare(:nodes) which just copies
the current content of test/integration/nodes.

In order for Chef's search function to find the node which is currently being
provisioned, the .json file that describes it must be part of the sandbox that
gets transferred.  Thus #create_node method must be called *before* #super in
the Kitchen::Provisioner::Nodes#create_sandbox method since Kitchen::Provisioner
::Chef::CommonSandbox#create_sandbox calls `prepare(:nodes)` which just copies
the *current* content of `test/integration/nodes`.
@mwrock
Copy link
Owner

mwrock commented Jun 20, 2015

Thanks for the contribution! However, I'm not seeing the problem. super creates the sandbox and initially populates it but does not copy it. That happens later. Also, if your pr is applied, reconverging a suite after the initial converge raises a premisions error.

When you say "currently provisioned node" do you mean the node itself that is being provisioned and NOT neighboring nodes? I definitely see its own node file in /tmp/kitchen/nodes with the current code base. I'm using test-kitchen 1.4.1.

@ustuehler
Copy link
Contributor Author

Thanks for your review. I'm also using Test Kitchen 1.4.1. super creates the sandbox, that's right, but it does so by copying whatever is in the test/integration/nodes directory when calling prepare(:nodes):

https://github.com/test-kitchen/test-kitchen/blob/72632ed74fcf945a8cbaf8e817496f118a8056e8/lib/kitchen/provisioner/chef/common_sandbox.rb#L232

So when super returns, the nodes directory in the sandbox is considered "fully prepared". Any file created in test/integration/nodes after that will not be included in the sandbox.

@ustuehler
Copy link
Contributor Author

Also, if your pr is applied, reconverging a suite after the initial converge raises a premisions error.

I wasn't aware of that, but I will look into it.

@mwrock
Copy link
Owner

mwrock commented Jun 25, 2015

Ah right of coarse. For some reason that error is not reproducing. Will try again on the machine where I was getting the error.

@mwrock mwrock merged commit 8c64cbd into mwrock:master Jun 26, 2015
@mwrock
Copy link
Owner

mwrock commented Jun 26, 2015

sorry this took so long. This is released to rubygems in 0.3.2. Thanks!!

@mwrock mwrock added the bug label Mar 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants