Project

General

Profile

Actions

Bug #27

closed

foreman_url doesn't contain port in kickstart.rhtml

Added by Matt Moran over 14 years ago. Updated about 8 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Unattended installations
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Running under webbrick. The kickstart file that the client receives does not contain the port number for <%= foreman_url %>. Grabbing the kickstart file via the spoof method does contain the port number.

Can be recreated by adding echo "<%= foreman_url %>" in the kickstart file.

Actions #1

Updated by Ohad Levy over 14 years ago

This doesn't make a lot of sense to me, as this is generated automatically by rails, and there is no difference between spoof or normal requests for unattended files.

in my normal testing it didn't show up, can you provide some more information about your setup?

Thanks

Actions #2

Updated by Matt Moran over 14 years ago

I noticed that when the server was finishing kickstart, there was no output in the foreman saying the server was built. But when the server came up I was able to manually execute the wget command and see the "is built!" comment in the foreman output. So I decided to echo out the foreman_url in the kickstart script and comment out reboot. I also took out the -q option for the wget, and build again.

This is when I noticed that wget was getting a 404, and that foreman_url was outputting http://foreman/unattended... instead of http://foreman:3000/unattended

I'm running Ruby 1.8.5, rack (1.0.0), rails (2.3.4)

Let me know if you want me to do any other testing.

Actions #3

Updated by Ohad Levy over 14 years ago

I cant think of a reason why this would happen, additionally, if it happens, its a pure rails bug :(

I've searched the rails bug-list, and it I couldn't find any information about it.

If you are planning to have the report and facts importer running over http, i would strongly recommend against webrick anyway. (depends on your load).

I'm assuming its not a one time problem? and you are able to reproduce it...

btw: did you had to make any modifications to the kickstart template?

Actions #4

Updated by Matt Moran over 14 years ago

Yep i'm planning to run under passenger, I just like to run webbrick for debugging.

Yep reproducible every time. I changed the kickstart template to cat in our own repo, remove the updating from EL repo, and changed the foremal_url to a hardcoded with port 3000. I'll change it back to foreman_url when running under passenger.

Actions #5

Updated by Moty Lavi over 14 years ago

Hi,

I'm encountering same issue .....

Actions #6

Updated by Ohad Levy over 14 years ago

Moty Lavi wrote:

Hi,

I'm encountering same issue .....

with webrick?

this looks like a rails bug, would you mind repeating the test with passenger?

Actions #7

Updated by Moty Lavi over 14 years ago

I have puppet running through passenger , foreman is running through mongrel

Actions #8

Updated by Ohad Levy over 14 years ago

Moty Lavi wrote:

I have puppet running through passenger , foreman is running through mongrel

could you try using passenger and let me know if the problem still exists?

I would use passenger to all of my ruby based applications

Actions #9

Updated by Ohad Levy over 14 years ago

  • Status changed from New to Need more information
  • Assignee deleted (Ohad Levy)

I've tried it here locally, and I get the correct URL...

not really sure of how to debug this..

Actions #10

Updated by Matt Moran over 14 years ago

Ohad Levy wrote:

I've tried it here locally, and I get the correct URL...

not really sure of how to debug this..

Ohad have you only tested under passenger, can you test under webrick?

Actions #11

Updated by Ohad Levy over 14 years ago

Matt Moran wrote:

Ohad Levy wrote:

I've tried it here locally, and I get the correct URL...

not really sure of how to debug this..

Ohad have you only tested under passenger, can you test under webrick?

I did test with webrick, I've installed the latest version and did a wget http://foreman:3000/unattended/kickstart

it provided the URL with port 3000.

I find it very strange that both of you see this error while I cant reproduce it....

Actions #12

Updated by Matt Moran over 14 years ago

I'll test again today.

Actions #13

Updated by Frank Sweetser over 14 years ago

I ran into this myself, and found the problem by examining tcpdumps. When wget retrieves a URL, it includes the port in the host HTTP header, like so:

GET /unattended/kickstart HTTP/1.0
Host: testpuppet.wpi.edu:8141

When anaconda retrieves the same URL, however, it strips the port off:

GET /unattended/kickstart HTTP/1.0

Host: testpuppet.wpi.edu

The request.port method seems to returns whatever was in the headers, so I don't know of any simple workaround, but I'll post it if I find one.

Actions #14

Updated by Ohad Levy about 14 years ago

  • Status changed from Need more information to Pending
Actions #15

Updated by Corey Osman over 12 years ago

I just finished an unattended install and looked at my anaconda script (kickstart file) in /root and noticed the wget url looks perfectly fine. The port number (3001 in my case) was appended. However, the build script somehow never phoned homed to finish the build.

Actions #16

Updated by Keiran Sweet about 12 years ago

I've also hit this bug, and its strange to say the least.

It seems Anaconda is stripping the port value out of this string prior to passing it to wget (or other HTTP client, i've tried a few).

As a workaround, I dont use foreman_url in my kickstart script for this one component, and explicitly define the host,port & url and it seems to work fine.

ie,
  1. Foreman / Anaconda Bug : http://theforeman.org/issues/27 - Don't use foreman_url here for now.
    /usr/bin/wget -q -O /dev/null http://puppetmaster:3000/unattended/built

Diagnosing further, I looked at the kickstart file presented via spoof and via wgetting it from the client and they are right, the values provided to the client during kickstart is correct, namely foreman_url , however, if I log these values from %post i see the following:

From my provisioning template:

  1. Lets print some debugging information also:
    FOREMANSTRING="<%= foreman_url %>"
    echo "The foreman string is: ${FOREMANSTRING}"

From my logfile during kickstart:
+ FOREMANSTRING=http://puppetmaster/unattended/built
+ echo 'The foreman string is: http://puppetmaster/unattended/built'

My environment is:
OS: Red Hat Enterprise Linux Server release 5.7 (Tikanga)
Foreman: 0.4.2 on RHEL5 + Ruby Enterprise 1.8.7 + Passenger

Ruby Gems:
  • LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.1.1, 3.0.10)
actionpack (3.1.1, 3.0.10)
activemodel (3.1.1, 3.0.10)
activerecord (3.0.10)
activeresource (3.1.1, 3.0.10)
activesupport (3.1.1, 3.0.10)
arel (2.2.1, 2.0.10)
builder (3.0.0, 2.1.2)
bundler (1.0.21)
coderay (0.9.8)
daemon_controller (0.2.6)
erubis (2.7.0, 2.6.6)
fastthread (1.0.7)
hike (1.2.1)
i18n (0.6.0, 0.5.0)
json (1.6.1)
mail (2.3.0, 2.2.19)
method_source (0.6.7)
mime-types (1.17.2)
multi_json (1.0.3)
mysql (2.8.1)
net-ldap (0.2.2)
net-ping (1.5.2)
passenger (3.0.9)
polyglot (0.3.3)
pry (0.9.7.4)
pry-doc (0.3.0)
rack (1.3.5, 1.2.4)
rack-cache (1.1)
rack-mount (0.8.3, 0.6.14)
rack-protection (1.1.4)
rack-ssl (1.3.2)
rack-test (0.6.1, 0.5.7)
rails (3.0.10)
railties (3.1.1, 3.0.10)
rake (0.9.2.2)
rdoc (3.11)
rest-client (1.6.7)
ruby-augeas (0.4.1)
ruby-ldap (0.9.11)
ruby-shadow (2.1.2)
ruby_parser (2.3.1)
sexp_processor (3.0.10)
sinatra (1.3.1)
slop (2.1.0)
sprockets (2.0.3)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
tzinfo (0.3.31)
yard (0.7.4)

I'm happy to work with anyone who knows Anaconda/Python well enough to dig a little deeper and see if we can ditch this long standing issue, just get in touch.

K

Actions #17

Updated by Benjamin Papillon almost 12 years ago

Very strange bug.
  • Did you try single quoting the URL?
  • Did you open a bug to Red Hat?

I checked quickly on fedora bug tracking and didnt see any relevant bug :/
I'll try to reproduce the bug with the rhel5 in ly environment

Actions #18

Updated by David Kaylor over 11 years ago

I am testing Foreman 1.0 with Nginx and Passenger and ran into this problem. The spoofed kickstart looks fine, but the wget command that is ultimately executed does not contain the port. I used a trick I picked up from Cobbler to log the commands (putting 'set -x -v; exec 1>/root/ks-post.log 2>&' at the beginning of the %post section). The system I built is a RHEL 5.8 system.

My spoofed kickstart contains the following:
wget -q -O /dev/null --no-check-certificate 'http://puppetlab:8000/unattended/built'

My ks-post.log contains the following:
wget -q -O /dev/null --no-check-certificate 'http://puppetlab/unattended/built'

I am going to take a look at bugzilla.redhat.com to see if I can find anything.

Actions #19

Updated by David Kaylor over 11 years ago

I am not sure this is entirely an Anaconda bug. I copied the contents of the spoofed kickstart file to a static file served up by nginx and changed the ks url in the host's pxe file. This time the port was included and everything worked correctly.

From ks-post.log:
wget -q -O /dev/null --no-check-certificate http://puppetlab:8000/unattended/built

I forgot to point out in my last update that I tested single quotes to no avail. This time, I left them off since they do not seem to help.

Actions #20

Updated by David Kaylor over 11 years ago

I moved on to testing a RHEL 6.3 build and cannot reproduce the problem. It seems that Foreman and certain versions of Anaconda are required in combination to cause this problem.

Actions #21

Updated by Ohad Levy over 11 years ago

does this means its no longer reproduceable with 6.3? (e.g. some version of anaconda fixed it)?

if it is, it would be nice to document from which version it starts working and finally close this issue :)

Actions #22

Updated by David Kaylor over 11 years ago

Yes. I tried again just to be sure. With 6.3, the port remains in the url and everything works fine. I took another look at Red Hat's bugzilla but could not find anything relevant.

I was also thinking about why a static kickstart file works with 5.8, but the one provided by Foreman does not. The only thing I could come up with is the content type. With Foreman, it is text/plain; with the static file, it is application/octet-stream.

Actions #23

Updated by Ky Zh over 11 years ago

I tried with RHEL 6.3, and the ks-post.log does contain hostname and port: "+echo http://puppet:3000/unattended/built"
I don't have any other RHEL than 6.3 to try to track the issue down.
Obviously there is quite a bit of non public redhat BZ that could contain clues to what is the difference.
Would it be helpful to open a ticket with RH to get the anaconda side looked into from support?

Actions #24

Updated by Greg Sutcliffe about 8 years ago

  • Description updated (diff)
  • Status changed from Pending to Resolved

To the best of my testing, this should no longer be an issue. For some time now we've had a separate `:unattended_url` setting which can take a port, and that port is correctly displayed in the templates.

As such, I'm closing this old bug - if you're still affected by this, please do re-open and provide as much data as you can.

Actions

Also available in: Atom PDF