Hi there,

I've successfully managed to set up a Foreman host, a Puppet control 
repository and r10k on the Foreman host to pull changes from the repo 
whenever they are made (and merged into the main branch). Hence, Puppet 
environments are deployed automatically to the host. This is done by r10k, 
triggered by a webhook, and r10k also has a `postrun` hook configured that 
is supposed to tell Foreman that changes were just pulled and integrated.

What's still missing is to automatic updating / importing of Puppet 
environments in Foreman. Instead of going to *Configure* > *Environments* 
and klicking on the "Import environments from $hostname" button in the 
Foreman UI I want to have this happen automatically whenever changes are 
deployed by r10k -- that's what the `postrun` hook is good for.

The command I run in the hook is:

/usr/sbin/foreman-rake puppet:import:puppet_classes[batch]

According to the Foreman source code this task updates both all 
environments and classes. 
https://github.com/theforeman/foreman/blob/develop/lib/tasks/puppet.rake#L45-L46

Interestingly, despite some output on the console there is no change 
visible in The Foreman. The list of environments remains unchanged (one 
"production" entry only, just as originally installed). The output of the 
command is as follows:

$ sudo /usr/sbin/foreman-rake puppet:import:puppet_classes[batch]'     
Successfully encrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully decrypted field for Setting::Auth oauth_consumer_key
Successfully encrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret
Successfully decrypted field for Setting::Auth oauth_consumer_secret

Any idea what's wrong? Why doesn't this command result in and update in The 
Foreman? Or is there a more suitable command?

Thanks for any hints,
Peter

-- 
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