Failed to execute puppetrun: 500 Internal Server Error uppercase hostnames

Hi,

I have Foreman -> mcollective -> ‘Run Puppet’ working. Apart from the hosts
that have uppercase hostnames. My environment has a mixture of CentOS 5 & 6
systems.

CentOS 6, Foreman 1.2 & Puppet 3.2.2. on the Foreman/Puppetmaster.

The hosts with uppercase names as well as the hosts with lowercase names
will work with ‘mco puppet runonce <hostname>’

It looks like the proxy needs the hostname as returned by hostname -f on
the host in question.

As my test for this curl -k -d “nodes=<lowercasehostname>” *
https://fqdn:8443/puppet/run* <https://fqdn:8443/puppet/run> will fail if
hostname -f returns uppercase. But it will work if I use hostname -f

On my test systems (that fail) the hostname is in uppercase but the domain
name is in lowercase.

Have I missed something?
Regards, Mike.

An update,

I have noticed that in Foreman it stores the hostname & fqdn in the case of
the remote host.

This may be a time to NOT force the hostname to lower case. No you need to
do a real fix :slight_smile:

As I noted in my last post the mco command will work regardless of the case
of the hostname.

Also if I change the host name to lowercase (I use setup) facter will
report the change.

Next run puppet agent --test the facts in Foreman will be reported in
lowercase.

Then ‘Run Puppet’ from Foreman will work.

I need a fix for this as I have production systems that I cannot change the
host names even to lowercase.

Also I believe that Windows hosts will report their name in all uppercase.

Regards, Mike.

··· On Friday, August 23, 2013 2:13:41 PM UTC-4, Michael Hurn wrote: > > Hi, > > I have Foreman -> mcollective -> ‘Run Puppet’ working. Apart from the > hosts that have uppercase hostnames. My environment has a mixture of CentOS > 5 & 6 systems. > > CentOS 6, Foreman 1.2 & Puppet 3.2.2. on the Foreman/Puppetmaster. > > The hosts with uppercase names as well as the hosts with lowercase names > will work with ‘mco puppet runonce ’ > > > > It looks like the proxy needs the hostname as returned by `hostname -f` on > the host in question. > > As my test for this curl -k -d “nodes=” * > https://fqdn:8443/puppet/run* will fail if > `hostname -f` returns uppercase. But it will work if I use `hostname -f` > > On my test systems (that fail) the hostname is in uppercase but the domain > name is in lowercase. > > Have I missed something? > Regards, Mike. >

Hi Ohad,

By definition host names can be any / mixed case. I 100% agree of the
practice of turning the hostname to lower case for all the internal working
code.

In my case I believe the problem is how Foreman/foreman-proxy is working
with mcollective.

To justify my theory I have two tests:

  1. Run the mcollective command line: ‘mco puppet runonce <hostname>’

Finding: The command will work regardless of the case of the hostname as
reported by hostname -f.

  1. Run the following ‘curl -k -d “nodes=<hostname>”
    https://fqdn:8443/puppet/run’

Finding: This command only works when the <hostname> matches the value
reported by hostname -f.

So if hostname -f returns FOREMANTEST.example.com test 2 will fail with
foremantest.example.com’.

Regards, Mike.

P.s.

I have also had problems with Puppet certificates and certificate file
names needing to be in lowercase.

This was not with Puppet but with the Foreman Installer when it comes to
writing the foreman.conf file. The certificate file name is written in the
hostname -f case and NOT converted to lowercase. As the hostname of my
test system had an uppercase name the installation failed. When I re-named
the host to lowercase I was able to install Foreman with no problems.

··· On Friday, August 23, 2013 2:13:41 PM UTC-4, Michael Hurn wrote: > > Hi, > > I have Foreman -> mcollective -> ‘Run Puppet’ working. Apart from the > hosts that have uppercase hostnames. My environment has a mixture of CentOS > 5 & 6 systems. > > CentOS 6, Foreman 1.2 & Puppet 3.2.2. on the Foreman/Puppetmaster. > > The hosts with uppercase names as well as the hosts with lowercase names > will work with ‘mco puppet runonce ’ > > > > It looks like the proxy needs the hostname as returned by `hostname -f` on > the host in question. > > As my test for this curl -k -d “nodes=” * > https://fqdn:8443/puppet/run* will fail if > `hostname -f` returns uppercase. But it will work if I use `hostname -f` > > On my test systems (that fail) the hostname is in uppercase but the domain > name is in lowercase. > > Have I missed something? > Regards, Mike. >

I have a new test :wink:

From the proxy log I see:

W, [2013-08-26T12:59:28.590536 #12634] WARN – : Non-null exit code when
executing '/usr/bin/sudo/usr/bin/mcopuppetrunonce-Iforemantest.example.com'

E, [2013-08-26T12:59:28.591599 #12634] ERROR – : Failed puppet run: Check
Log files

Is this a ‘-I’ option I see? Yes so let’s do ‘test 3’

  1. Run the mcollective command line: ‘mco puppet runonce -I <hostname>’

Finding: The command ONLY works when the case of the hostname is as
reported by hostname -f.

In my tests it may be better to replace hostname -f with facter | grep fqdn

Regards, Mike.

··· On Friday, August 23, 2013 2:13:41 PM UTC-4, Michael Hurn wrote: > > Hi, > > I have Foreman -> mcollective -> ‘Run Puppet’ working. Apart from the > hosts that have uppercase hostnames. My environment has a mixture of CentOS > 5 & 6 systems. > > CentOS 6, Foreman 1.2 & Puppet 3.2.2. on the Foreman/Puppetmaster. > > The hosts with uppercase names as well as the hosts with lowercase names > will work with ‘mco puppet runonce ’ > > > > It looks like the proxy needs the hostname as returned by `hostname -f` on > the host in question. > > As my test for this curl -k -d “nodes=” * > https://fqdn:8443/puppet/run* will fail if > `hostname -f` returns uppercase. But it will work if I use `hostname -f` > > On my test systems (that fail) the hostname is in uppercase but the domain > name is in lowercase. > > Have I missed something? > Regards, Mike. >

I need to do some more testing but you may like to see my work a round /
fix :wink:

cd /usr/share/foreman-proxy/lib/proxy/puppet
diff mcollective.rb mcollective.rb.20130826
15c15
< shell_command(cmd + ["puppet", "runonce"] + shell_escaped_nodes)

··· --- > shell_command(cmd + ["puppet", "runonce", "-I"] + shell_escaped_nodes) Regards, Mike.

On Friday, August 23, 2013 2:13:41 PM UTC-4, Michael Hurn wrote:

Hi,

I have Foreman -> mcollective -> ‘Run Puppet’ working. Apart from the
hosts that have uppercase hostnames. My environment has a mixture of CentOS
5 & 6 systems.

CentOS 6, Foreman 1.2 & Puppet 3.2.2. on the Foreman/Puppetmaster.

The hosts with uppercase names as well as the hosts with lowercase names
will work with ‘mco puppet runonce ’

It looks like the proxy needs the hostname as returned by hostname -f on
the host in question.

As my test for this curl -k -d “nodes=” *
https://fqdn:8443/puppet/run* https://fqdn:8443/puppet/run will fail if
hostname -f returns uppercase. But it will work if I use hostname -f

On my test systems (that fail) the hostname is in uppercase but the domain
name is in lowercase.

Have I missed something?
Regards, Mike.

> An update,
>
> **** **
>
> I have noticed that in Foreman it stores the hostname & fqdn in the case
> of the remote host.
>
> ** **
>
> This may be a time to NOT force the hostname to lower case. No you need to
> do a real fix :slight_smile:
>
> As I noted in my last post the mco command will work regardless of the
> case of the hostname.
>
> ** **
>
> Also if I change the host name to lowercase (I use setup) facter will
> report the change.
>
> ** **
>
> Next run puppet agent --test the facts in Foreman will be reported in
> lowercase.
>
> Then ‘Run Puppet’ from Foreman will work.
>
> ** **
>
> I need a fix for this as I have production systems that I cannot change
> the host names even to lowercase.
>
> Also I believe that Windows hosts will report their name in all uppercase.
>

this is a vague memory, but afair, puppet certificates can't be upper
cased, and we decided as a best practice to ensure lower case for the
system we provision.

Ohad

··· On Sat, Aug 24, 2013 at 2:46 AM, Michael Hurn wrote:

Regards, Mike.

On Friday, August 23, 2013 2:13:41 PM UTC-4, Michael Hurn wrote:

Hi,

I have Foreman -> mcollective -> ‘Run Puppet’ working. Apart from the
hosts that have uppercase hostnames. My environment has a mixture of CentOS
5 & 6 systems.

CentOS 6, Foreman 1.2 & Puppet 3.2.2. on the Foreman/Puppetmaster.

The hosts with uppercase names as well as the hosts with lowercase names
will work with ‘mco puppet runonce ’

It looks like the proxy needs the hostname as returned by hostname -f
on the host in question.

As my test for this curl -k -d “nodes=” *
https://fqdn:8443/puppet/run* https://fqdn:8443/puppet/run will fail
if hostname -f returns uppercase. But it will work if I use hostname -f

On my test systems (that fail) the hostname is in uppercase but the
domain name is in lowercase.

Have I missed something?
Regards, Mike.


You received this message because you are subscribed to the Google Groups
"Foreman users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to foreman-users+unsubscribe@googlegroups.com.
To post to this group, send email to foreman-users@googlegroups.com.
Visit this group at http://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/groups/opt_out.