-
Notifications
You must be signed in to change notification settings - Fork 91
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
node[:fqdn] is blank for knife ec2 bootstrap #30
Comments
Hi! Do you have RHEL6 on your node or on your workstation? Sorry if that's a silly question. |
Not a silly question at all! RHEL6 is the OS on the node. ami-fe393ebb on EC2 to be more specific. |
Ok, thanks! Could you - obviously omitting sensitive data - paste your run list, and the exact error output (where the run fails)? The cookbooks in between could reset some attributes - either in the recipes, or in the attribute files. Nexus works with Ubuntu and CentOS, so RHEL should theoretically be fine here. So yeah, lots of moving parts. :) |
Thank you! I'll do another chef run and get the log posted here. |
I think the issue might be the value of node[:fqdn] during compilation phase vs. execution phase. I have a related thread going on the chef mailing list. The last response is an opscode employee saying I shouldn't use this hostname cookbook. I'm still not sure if that's what I should do but I thought you should be aware of it. |
@fletchowns I'd be curious to see if you have the problem by using https://github.com/xhost-cookbooks/system where the hostname recipe uses an LWRP to set the hostname/domain name via node attributes. |
@flaccid I ran into the same issue with the system cookbook (after scratching my head for awhile running into xhost-cookbooks/system#6) |
I'm either a complete n00b missing something or there is an issue supermarket server-side, xhost-cookbooks/system#6 (comment). Emailed Chef, I want to fix up xhost-cookbooks/system#6 too so we can move on. |
@fletchowns can you re-test system cookbook for this issue (xhost-cookbooks/system#6 was resolved). |
@flaccid I didn't see any changes to xhost-cookbooks/system related to ensure the fqdn is set at compile time instead of converge time, so I don't think the test would yield any different results. See this post in the chef mailing list (it was in response to me saying I tried the system cookbook and it also had the same issue). |
@fletchowns this issue actually goes way back, see https://tickets.opscode.com/browse/OHAI-389?focusedCommentId=48141&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-48141. Let me test it out with the nexus cookbook, perhaps there is still some kind of race condition. |
Looks like the nexus cookbook requires chef server and databags because of https://github.com/RiotGames/nexus-cookbook/blob/master/recipes/app_server_proxy.rb#L47. As a result testing in vagrant/chef-solo I get 'can't convert Array into String' so can't really test quickly. I did notice using this cookbook did some ohai stuff:
In the system cookbook I don't reload ohai at all, because in OHAI-389 we discovered 'its not what you think it is'. Only this is what is required (example):
Perhaps take the issue upstream with that cookbook. In my testing I found that system::hostname works ok.
What I don't know is if if setting it in a provider like I do in the system cookbook is still prior to things like template parsing/rendering. But either what nexus cookbook does with ohai/reload is the problem or templates are rendered too early with the initial value before updating node.automatic_attrs is likely the root cause - this cookbook does it all within a recipe not a provider also. |
Hi @flaccid, thank you so much with helping out @fletchowns with this issue. I'm very sorry for not responding in a more timely manner. Is there anything left here I can do to help? |
@xamebax See the previous comments - basically test the system cookbook to see if it has the same issue. It doesn't do anything with ohai, but need to see if using node['fqdn'] in a template gets the new hostname. |
@flaccid I'm also seeing a few issues with the system cookbook, filed an issue for you over in that repo. @xamebax I setup a repo so you can reproduce the issue I experienced: https://github.com/fletchowns/hostname-playground/tree/hostname-cookbook After a
And then after a subsequent
I would have expected the fqdn here to be 'chef.mycorp.com' for everything, but it's just using 'chef'. The results start to get even more interesting when you spin up an EC2 instance with
The AWS stuff is on a separate branch: https://github.com/fletchowns/hostname-playground/tree/hostname-aws The packer definition for the AMI that was used is also included in the repo. |
Basically, need to lazy load (xhost-cookbooks/system#7 (comment)). When referring to node['fqdn'] in recipe code to return the new hostname, I think this cookbook lacks updating the automatic_attrs, see https://github.com/xhost-cookbooks/system/blob/master/providers/hostname.rb#L34. You'll notice that I don't reload ohai either. |
OS is RHEL6. This hostname cookbook is the first recipe in my chef run. I have
set_fqdn = "*.mydomain.com"
in my attributes and I'm trying to do aknife ec2 server create --node-name nexus
and the run fails because the the nexus cookbook (https://github.com/RiotGames/nexus-cookbook) uses node[:fqdn] in the nginx config. The config becomes malformed as a result, nginx fails to start, and the run fails.From the output of the hostname portion, it looks like everything should work fine.
hostname -f
after the failed run returns the correct value (mynode.mydomain.com). What would cause node[:fqdn] to be blank on the bootstrap run?The text was updated successfully, but these errors were encountered: