Project

General

Profile

Actions

Bug #5772

closed

What is the URL discover_host is really supposed to POST the facts to?

Added by Konstantin Orekhov almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Not exactly a bug, but maybe it is at least in terms of the documentation.

This paragraph of discover README (https://github.com/theforeman/foreman_discovery#grace-note-testing) says that facts are being posted to {foreman-host}/fact_values/create?type=Host::Discovered (presumably over HTTP). However, the discover_host script mentioned in the same section uses "{foreman-host}/discovers" URL to upload the facts to - https://github.com/theforeman/foreman_discovery/blob/develop/extra/discover_host#L59

What makes things even worse is none of 2 above URLs actually work for me (running Foreman 1.4.2 under passenger w/ruby193 SCL on RHEL 6.4).

Example from access.log:

{foreman-host} - - [16/May/2014:16:46:06 0700] "POST /discovers HTTP/1.1" 400 92 "" "-" {foreman-host} - - [16/May/2014:16:48:02 0700] "POST /fact_values/create?type=Host::Discovered HTTP/1.1" 404 728 "" "-"

But discover_host script does not seems to recognize the fact that operation failed, so it just hangs there forever.

Your advice is greatly appreciated.
Thanks!


Related issues 1 (0 open1 closed)

Related to Smart Proxy - Bug #5907: ip auto-suggestion broken after dhcp changesClosedGreg Sutcliffe05/23/2014Actions
Actions #1

Updated by Lukas Zapletal almost 10 years ago

  • Category set to Discovery plugin
  • Difficulty set to easy

Hello,

in Foreman (and Discovery) we are currently in process of migrating from V1 to V2 API. There are still pending changes to this topic in the nightly version and we expect one more refactoring: https://github.com/theforeman/foreman_discovery/pull/70

Foreman 1.5 supports both versions and Discovery 1.3 (not released yet) will only support V2 (V1 has never been there, but there is still the UI API). The discovery image (0.5) supports V2 and UI API (it tries with V2 first, then goes with leagacy UI API).

Okay, I am really sorry to write that ^^^ :-) It's super confusing, so in short:

Actions #2

Updated by Konstantin Orekhov almost 10 years ago

  • Category deleted (Discovery plugin)
  • Difficulty deleted (easy)

Hi, Lukas!

Thanks for your pointers both here and here https://groups.google.com/forum/#!topic/foreman-users/y3pwKmtYXYA

I've combined all the hints you provided (the current documentation on discovery is very confusing) and was able to get some things to work. However, oVirt-based image could not properly bring up DHCP on my 10gige NICs for some reason. After I started dhclient manually things got better (at least discover-host.rb was able to upload the facts to Foreman), but there's still very strange happening as I see that DHCP IP is being released and updated over and over again and never stays the same after 5 minutes or so (my DHCP lease timeout), so the IP of the bootif keeps changing and that obviously prevents me from continuing with provisioning piece.

So what I'm doing now is moving discovery/proxy to our internal discovery OS so it can send the facts to Foreman instead and here's the question I have for you. I see that you use foreman-proxy-1.6.0-0.develop.201405090958git442e2bd.el6.noarch in your oVirt-based image, but my discovery OS is Ubuntu-12.04-based (Casper), so what version of smart proxy would you recommend I use on it?

Thanks!

Actions #3

Updated by Konstantin Orekhov almost 10 years ago

One more thing. I installed foreman-proxy 1.5.0-1 on that discovery OS of mine and able to discover the hosts now, however I noticed that not all the facts being uploaded (or maybe just not shown?) when I look at the discovered host entries in my Foreman.

/tmp/proxy_cache has all the custom facts I wanted to upload, but not all of them are not in Foreman. Any filtering going on somewhere?

Thanks!

Actions #4

Updated by Konstantin Orekhov almost 10 years ago

Never mind. The missing facts that are not showing up are the ones that require root privileges (like serialnumber for example, which requires root for dmidecode), but since proxy is running as foreman-proxy, this didn't work.

Actions #5

Updated by Lukas Zapletal almost 10 years ago

  • Status changed from New to Closed

Hello,

documentation is something that we work on (there is a pending pull request).

Would you mind investigating more what is going on with our image? Do you use Fedora or CentOS based image? Can you provide me logs from the DHCP server?

Our current 0.5 RC3 image does use Foreman Proxy 1.5 stable version, you might had older build that was a scratch build. Try this one: http://downloads.theforeman.org/discovery/releases/0.5/

The root/dmidecode issue was recently fixed in RC3 version

Ok I am closing the bug, documentation will be updated soon. If you have some spare time to work on the DHCP issue, I'd love to investigate this and fix this, but I am unable to reproduce this. Feel free to open another ticket with more info (DHCP logs, list of running processes, exact discovery version and platform). I will try to reproduce. Thanks!

Actions #6

Updated by Lukas Zapletal almost 10 years ago

  • Related to Bug #5907: ip auto-suggestion broken after dhcp changes added
Actions #7

Updated by Lukas Zapletal almost 10 years ago

With the DHCP error, I think you are hitting this one: http://projects.theforeman.org/issues/5907

We have a fix, would you mind to re-test with new discovery image once we build it?

Actions #8

Updated by Konstantin Orekhov almost 10 years ago

Lukas Zapletal wrote:

With the DHCP error, I think you are hitting this one: http://projects.theforeman.org/issues/5907

We have a fix, would you mind to re-test with new discovery image once we build it?

When do you think you'll build that new image and how would I know about that?
I'll definitely look into that and see if the issues are gone.

One more question though. I can't find an API to access/manipulate auto-discovered hosts. I can provision them through WebUI, but really interested in API. Is it just not documented yet? If so, can you please let me know the details as I really could use it right now...

Thanks!

Actions #9

Updated by Greg Sutcliffe almost 10 years ago

Konstantin, you may find this link helpful :)

https://groups.google.com/forum/#!topic/foreman-announce/4m8pwEg-_eU

Feedback is definitely welcome :)

Actions #10

Updated by Konstantin Orekhov almost 10 years ago

Hmm, would that RC3 discovery plug-in work on Foreman 1.4.2 though? That announcement talks about Foreman Core 1.5, so probably can't help me here it seems :(
Or maybe I completely confused by the terminology and product names again? Here's what I have right now.

  1. rpm -qa | grep foreman
    foreman-compute-1.4.2-1.el6.noarch
    foreman-mysql2-1.4.2-1.el6.noarch
    foreman-1.4.2-1.el6.noarch
    rubygem-hammer_cli_foreman-0.0.18-1.el6.noarch
    foreman-proxy-1.4.2-1.el6.noarch
    ruby193-rubygem-foreman_discovery-1.2.0-1.el6.noarch
    foreman-console-1.4.2-1.el6.noarch
    foreman-libvirt-1.4.2-1.el6.noarch
    rubygem-foreman_api-0.1.11-1.el6.noarch
    foreman-installer-1.4.2-1.el6.noarch

I have a bunch of hosts listed under "All Hosts -> Discovered", which I'd like to provision through API though. If there's no way to do that in 1.2.0 version of Foreman Discovery, that's fine, I just need to know.

Thanks!

Actions #11

Updated by Greg Sutcliffe almost 10 years ago

Hi Konstantin,

Sorry for the delay, somehow this got misfiltered :(

You are correct that Discovery 1.3 is only compatible with Foreman 1.5 - sadly Discovery hooks tightly into Foreman and usually needs updating with each new release.

While there is no official API with Foreman 1.4 / Discovery 1.2, you could try something like:

PUT /discovers/14

where 14 is the ID of a discovered host, and send a body as per the usual Hosts API. It's just a guess though, I wouldn't spend too long on it, as it may not work.

Actions

Also available in: Atom PDF