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

Trouble searching the node #23

Closed
kalapakim opened this issue May 24, 2016 · 2 comments
Closed

Trouble searching the node #23

kalapakim opened this issue May 24, 2016 · 2 comments

Comments

@kalapakim
Copy link

kalapakim commented May 24, 2016

Here is the search I'm applying:

sql_ip = -> { search(:node, "id:primarysql*") }

And I try to put:

puts "IP Address: #{sql_ip.call[0]['ipaddress']}"

This is the node that I am searching against

{
  "id": "primarysql-Windows",
  "chef_environment": "_default",
  "automatic": {
    "ipaddress": "10.12.235.71",
    "platform": "windows",
    "fqdn": "MTPCTSCID012.consilio.com",
    "recipes": [
      "relativity-scaled-automation::setup_sql"
    ]
  },
  "normal": {
  },
  "run_list": [
    "recipe[relativity-scaled-automation::setup_sql]"
  ]
}

What is returned is

IP Address: ["fe80::a816:9ab7:f164:108e%12", "10.0.2.15"]

which is wrong all together...wthat IP address is not correct?

so I try a different search...

sqlID = []
search(:node, "id:primarysql*").each do |server|
  sqlID.push(server['ipaddress'])
end
puts "FQDN: #{sqlID}"

and this is what is returned...

FQDN: [["fe80::a816:9ab7:f164:108e%12", "10.0.2.15"], "10.12.235.71"]

the second item in the list is correct, but what is the first item? where is that coming from?

I searched my project and there is no such information

@mwrock
Copy link
Owner

mwrock commented May 26, 2016

could you post your .kitchen.yml or a gist of it. One thing to check is on the node that is issuing the chef search, look in its %temp%\kitchen\nodes directory. That holds the json data that chef_zero is using to conduct the search.

If the node that is performing the search is looking for itself. In other words, if you are performing the search on the primarysql-* box, my guess is that you are using Virtualbox and this is reporting back the ohai data for its default network interfaces. This is usually not compatible with nodes actually wishing to use the IPAddress to connect to the box. You can fix this by eiting the ohai data and also ensuring yo uare using a private_network. I have blogged on this exact topic at http://www.hurryupandwait.io/blog/multi-node-test-kitchen-tests-and-working-with-vagrant-nat-addressing-with-virtualbox.

Now the second search result you mention above is surprising. It sounds like its finding 2 nodes for the id id:primarysql* I'd be curious to know if it in fact has 2 node json files for the same node.

@mwrock
Copy link
Owner

mwrock commented Dec 1, 2016

closing due to inactivity

@mwrock mwrock closed this as completed Dec 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants