Hi Greg et al,
I'm afraid I'm stuck again...

I managed to install foreman 1.12-stable from source and got the example 
plugin working after I manually installed the deface gem with "gem install 
deface".

I then realised that I couldn't really start exploring what my plugin 
needed to do without some hosts to work with.

So I ensured that a puppet master and a puppet agent were running on the 
same VM as foreman and were able to communicate.

However, this is where I got a bit confused. How do I get the puppet 
master's hosts to appear in foreman?

At first I thought I just had to add a few lines to the 
/etc/puppet/puppet.conf file referencing the script mentioned in the manual:

https://theforeman.org/manuals/1.12/index.html#3.5.5FactsandtheENC


So I added the following: 

    external_nodes = /etc/puppet/node.rb
    node_terminus  = exec

Downloaded the node.rb script from 
https://raw.githubusercontent.com/theforeman/puppet-foreman/master/files/external_node_v2.rb
 
and placed that at /etc/puppet/node.rb.


# Script usually acts as an ENC for a single host, with the certname 
supplied as argument
#   if 'facts' is true, the YAML facts for the host are uploaded
#   ENC output is printed and cached
#
# If --push-facts is given as the only arg, it uploads facts for all hosts 
and then exits.
# Useful in scenarios where the ENC isn't used.


However, the node.rb script just doesn't seem to communicate with the 
master:

Debug: Executing '/etc/puppet/node.rb theforeman.example.com'
Warning: Unable to fetch my node definition, but the agent run will 
continue:
Warning: Failed to find theforeman.example.com via exec: Execution of 
'/etc/puppet/node.rb theforeman.example.com' returned 1:


When I try running the node.rb command by hand I see it's getting a 400 
error from the master:

[root@theforeman puppet]# which ruby
/opt/rh/rh-ruby23/root/usr/bin/ruby
[root@theforeman puppet]# /etc/puppet/node.rb theforeman.example.com
During the fact upload the server responded with: 400 Bad Request . Error 
is ignored and the execution continues.
No support for plurality singular for POST operations
/etc/puppet/node.rb:378: warning: constant ::TimeoutError is deprecated
Error retrieving node theforeman.example.com: Net::HTTPBadRequest
Check Foreman's /var/log/foreman/production.log for more information.


There's nothing in foreman's log but there is in the puppet master log:

Nov 27 16:02:19 localhost puppet-master[9921]: No support for plurality 
singular for POST operations
Nov 27 16:02:19 localhost puppet-master[9921]: The indirection name must be 
purely alphanumeric, not 'theforeman.example.com'


If I remove the external_nodes and node_terminus lines my puppet agent 
starts happily talking to the puppet master again (I have http_debug true 
set):

[root@theforeman puppet]# puppet agent -t
opening connection to theforeman.example.com...
opened
<- "GET 
/production/node/theforeman.example.com?fail_on_404=true&transaction_uuid=c689a6bb-6539-4371-a841-e9d1c1c8e542
 
HTTP/1.1\r\nHost: theforeman.example.com:8140\r\nAccep
t: pson, yaml, b64_zlib_yaml, raw\r\nAccept-Encoding: identity\r\n\r\n"
-> "HTTP/1.1 200 OK \r\n"
-> "Date: Mon, 28 Nov 2016 00:09:10 GMT\r\n"
-> "Connection: close\r\n"
-> "X-Puppet-Version: 3.8.7\r\n"
-> "Content-Length: 5291\r\n"
-> "Content-Type: text/pson\r\n"
-> "Server: WEBrick/1.3.1 (Ruby/1.8.7/2013-06-27) OpenSSL/1.0.1e\r\n"
-> "\r\n"
reading 5291 bytes...
-> ""
-> 
"{\"data\":{\"name\":\"theforeman.example.com\",\"parameters\":{\"ipaddress_eth1\":\"192.168.35.5\",\"interfaces\":\"eth0,eth1,lo\",\"operatingsystem\":\"RedHat\",\"rubys
itedir\":\"/usr/lib/ruby/site_ruby/1.8\",\"blockdevice_sr0_model\":\"CD-ROM\",\"lsbmajdistrelease\":\"6\",\"system_uptime\":\"hours34seconds125942days1uptime1
 
day\",\"fqdn\"
:\"theforeman.example.com\",\"blockdevices\":\"sda,sr0\",\"kernelmajversion\":\"2.6\",

... *lines omitted for brevity ...*


I then wondered if I needed a smart proxy? I cloned the 1.12-stable version 
and tried running that too but I fear I'm getting hopelessly confused 
between the external node script, the puppet smart proxy and whatever a 
foreman proxy is. My guess is that "foreman proxy" is just another term for 
"smart proxy" and there are a number of smart proxies available. 

All I really want is the absolute simplest 1.12-stable foreman plugin 
development setup with a few test hosts.

I'm happy to try to document the steps needed. I have a vagrant RHEL6 VM as 
my starting point, I have the puppet agent talking to the puppet master on 
that VM, I have foreman 1.12-stable loading my clone of the example foreman 
plugin starter project but I find myself completely confused.

Any words of wisdom, clarification or encouragement much appreciated.

Cheers,

Doug
 

 

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/foreman-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to