Project

General

Profile

Actions

Bug #5856

closed

Cannot import environments, classes even with foreman 1.5.0

Added by Dis McCarthy almost 10 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Urgent
Assignee:
Category:
Puppet
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Superficially similar to #5792, but we are running Foreman and proxy at 1.5.0.

Clicking 'import classes from puppetmaster' or 'import environments from puppetmaster' results in the 406 error, and the foreman proxy logs show:

I, [2014-05-21T11:41:30.462997 #20033]  INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
I, [2014-05-21T11:41:30.590418 #20033]  INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
I, [2014-05-21T11:41:30.720226 #20033]  INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
I, [2014-05-21T11:41:30.785593 #20033]  INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
E, [2014-05-21T11:41:30.892108 #20033] ERROR -- : Failed to show puppet classes: no 'environments' in {:root_environment=>#<Puppet::Node::Environment:0x7f4427990d28 @config_version=nil, @name=:"*root*", @manifest="/etc/foreman-proxy", @modulepath=[], @watching=true>, :current_environment=>#<Puppet::Node::Environment:0x7f4427990d28 @config_version=nil, @name=:"*root*", @manifest="/etc/foreman-proxy", @modulepath=[], @watching=true>} at top of []

# rpm -qa \*foreman\*
foreman-compute-1.5.0-1.el6.noarch
foreman-proxy-1.5.0-1.el6.noarch
foreman-release-1.5.0-1.el6.noarch
foreman-postgresql-1.5.0-1.el6.noarch
rubygem-foreman_api-0.1.11-1.el6.noarch
foreman-selinux-1.5.0-1.el6.noarch
foreman-vmware-1.5.0-1.el6.noarch
foreman-installer-1.5.0-1.el6.noarch
rubygem-hammer_cli_foreman-0.1.0-1.el6.noarch
foreman-1.5.0-1.el6.noarch
# rpm -qa \*puppet\*
puppet-3.6.0-1.el6.noarch
mcollective-puppet-common-1.7.2-1.el6.noarch
mcollective-puppet-client-1.7.2-1.el6.noarch
puppetlabs-release-6-10.noarch
mcollective-puppet-agent-1.7.2-1.el6.noarch
puppetdb-2.0.0-1.el6.noarch
puppet-server-3.6.0-1.el6.noarch
puppetdb-terminus-2.0.0-1.el6.noarch
ruby193-puppet-3.1.1-6.el6.noarch

Files

puppet.conf puppet.conf 2.32 KB Ollie Lawson, 06/05/2014 09:57 AM
puppet.conf puppet.conf 2.32 KB Ollie Lawson, 06/05/2014 09:57 AM

Related issues 1 (0 open1 closed)

Has duplicate Smart Proxy - Bug #5867: Cannot Import Puppet EnvioronmentsDuplicate05/22/2014Actions
Actions #1

Updated by Dominic Cleal almost 10 years ago

  • Project changed from Foreman to Smart Proxy
  • Category changed from Importers to Puppet
Actions #2

Updated by Dominic Cleal almost 10 years ago

Could you attach your puppet.conf? I think this might happen if you don't have explicit environment sections.

Actions #3

Updated by Dis McCarthy almost 10 years ago

It was installed originally with a puppet-apply based installer but is maintained manually.

### File managed with puppet ###
## Module:           'puppet'
## Template source:  'MODULES/puppet/templates/puppet.conf.erb'

[main]
    # The Puppet log directory.
    # The default value is '$vardir/log'.
    logdir = /var/log/puppet

    # Where Puppet PID files are kept.
    # The default value is '$vardir/run'.
    rundir = /var/run/puppet

    # Where SSL certificates are kept.
    # The default value is '$confdir/ssl'.
    ssldir = $vardir/ssl

    # Allow services in the 'puppet' group to access key (Foreman + proxy)
    privatekeydir = $ssldir/private_keys { group = service }
    hostprivkey = $privatekeydir/$certname.pem { mode = 640 }

    # Puppet 3.0.x requires this in both [main] and [master] - harmless on agents
    autosign       = $confdir/autosign.conf { mode = 664 }

[agent]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion.  Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt

    # Where puppetd caches the local configuration.  An
    # extension indicating the cache format is added automatically.
    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig
    report      = true
    pluginsync  = true
    masterport  = 8140
    #environment = production
    certname    = hostname.here
    server      = hostname.here
    listen      = false
    splay       = false
    runinterval = 1800
    noop        = false
    show_diff   = true
    modulepath     = /etc/puppet/environments/$environment/modules:/etc/puppet/environments/common:/usr/share/puppet/modules
    environment=nonop

### Next part of the file is managed by a different template ###
## Module:           'puppet'
## Template source:  'MODULES/puppet/templates/server/puppet.conf.erb'

[master]
    autosign       = $confdir/autosign.conf { mode = 664 }
    reports        = foreman
    external_nodes = /etc/puppet/node.rb
    node_terminus  = exec
    ca             = true
    ssldir         = /var/lib/puppet/ssl
    storeconfigs = true
    storeconfigs_backend = puppetdb

[development]
    modulepath     = /etc/puppet/environments/development/modules:/etc/puppet/environments/common:/etc/puppet/environments/baseline-master:/usr/share/puppet/modules
    config_version = 
[test]
    modulepath     = /etc/puppet/environments/test/modules:/etc/puppet/environments/common:/etc/puppet/environments/baseline-master:/usr/share/puppet/modules
    config_version = 
#[production]
#    modulepath     = /etc/puppet/environments/production/modules:/etc/puppet/environments/common:/usr/share/puppet/modules
#    config_version = 
[nonop]
    modulepath     = /etc/puppet/environments/nonop/modules:/etc/puppet/environments/common:/etc/puppet/environments/baseline:/usr/share/puppet/modules
    config_version = 
[operational]
    modulepath     = /etc/puppet/environments/operational/modules:/etc/puppet/environments/common:/etc/puppet/environments/baseline:/usr/share/puppet/modules
    config_version = 

[frozen]
    modulepath     = /etc/puppet/environments/frozen/modules
    config_version = 
Actions #4

Updated by Xesc Arbona almost 10 years ago

Hi,

I've run into the same issue, and solve it by downgrading puppet to version 3.5.1.

curl -k -H "Content-Type:application/json" -H "Accept:application/json" http://localhost:8443/puppet/environments
["acceptance","development"]

curl -k -H "Content-Type:application/json" -H "Accept:application/json" http://localhost:8443/puppet/environments/acceptance/classes
Failed to show puppet classes: no 'environments' in {:current_

apt-get install puppet=3.5.1-1puppetlabs1 puppet-common=3.5.1-1puppetlabs1 puppetmaster=3.5.1-1puppetlabs1 puppetmaster-common=3.5.1-1puppetlabs1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
puppet-el vim-puppet ruby-selinux libselinux-ruby1.8 librrd-ruby1.9.1 librrd-ruby1.8 stompserver ruby-ldap libldap-ruby1.8
The following packages will be DOWNGRADED:
puppet puppet-common puppetmaster puppetmaster-common

/etc/init.d/foreman-proxy restart

curl -k -H "Content-Type:application/json" -H "Accept:application/json" http://localhost:8443/puppet/environments/acceptance/classes
[{"postfix::satellite":{"name":"satellite","module":"postfix","params":{}}},{"postfix":{"name":"postfix","module":null,"params":{"postfix_smtp_listen":"127.0.0.1","root_mail_recipient":"nobody","postfix_use_amavisd":"no","postfix_use_dovecot_lda":"no","postfix_use_schleuder":"no","postfix_use_sympa":"no","postfix_mail_user":"postfix","postfix_mail_origin":"${$::fqdn}"}}},{"p....

Foreman 1.5 does not seem comaptible with Puppet 3.6, see http://theforeman.org/manuals/1.5/index.html#3.1.2PuppetCompatibility

I guess it has to do with directory environments mixed up?

Actions #5

Updated by Dominic Cleal almost 10 years ago

  • Priority changed from Normal to Urgent
  • Target version set to 1.8.2
  • translation missing: en.field_release set to 16
Actions #6

Updated by Dominic Cleal almost 10 years ago

  • Has duplicate Bug #5867: Cannot Import Puppet Envioronments added
Actions #7

Updated by Jon Skarpeteig almost 10 years ago

Using Foreman 1.5.0 and Puppet 3.6.0 on remote node

From foreman-proxy.log

I, [2014-05-22T16:17:41.243564 #30842]  INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
W, [2014-05-22T16:17:41.284902 #30842]  WARN -- : No environments found - falling back to defaults (production - /etc/puppet/modules)
I, [2014-05-22T16:17:41.626662 #30842]  INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
W, [2014-05-22T16:17:41.662242 #30842]  WARN -- : No environments found - falling back to defaults (production - /etc/puppet/modules)
I, [2014-05-22T16:17:41.662626 #30842]  INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
I, [2014-05-22T16:17:41.742015 #30842]  INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
E, [2014-05-22T16:17:41.768046 #30842] ERROR -- : Failed to show puppet classes: no 'environments' in {:current_environment=>#<Puppet::Node::Environment:0x7f797da688f0 @modulepath=[], @watching=true, @name=:"*root*", @config_version=nil, @manifest="/">, :root_environment=>#<Puppet::Node::Environment:0x7f797da688f0 @modulepath=[], @watching=true, @name=:"*root*", @config_version=nil, @manifest="/">} at top of []

From GUI:

Oops, we're sorry but something went wrong

Warning!
ERF12-4115 [ProxyAPI::ProxyException]: Unable to get classes from Puppet for production ([RestClient::NotAcceptable]: 406 Not Acceptable) for proxy http://host.fqdn:8443/puppet

If you feel this is an error with Foreman itself, please open a new issue with Foreman ticketing system, You would probably need to attach the Full trace and relevant log entries.
ProxyAPI::ProxyException
ERF12-4115 [ProxyAPI::ProxyException]: Unable to get classes from Puppet for production ([RestClient::NotAcceptable]: 406 Not Acceptable) for proxy http://host.fqdn:8443/puppet
lib/proxy_api/puppet.rb:27:in `rescue in classes'
lib/proxy_api/puppet.rb:21:in `classes'
app/services/puppet_class_importer.rb:155:in `actual_classes'
app/services/puppet_class_importer.rb:78:in `new_classes_for'
app/services/puppet_class_importer.rb:25:in `block in changes'
app/services/puppet_class_importer.rb:24:in `each'
app/services/puppet_class_importer.rb:24:in `changes'
app/controllers/concerns/foreman/controller/environments.rb:11:in `import_environments'
app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
lib/middleware/catch_json_parse_errors.rb:9:in `call'

Actions #8

Updated by Jon Skarpeteig almost 10 years ago

No way to edit posts?

Actions #9

Updated by Dominic Cleal almost 10 years ago

Jon Skarpeteig wrote:

No way to edit posts?

You should be able to now, you weren't "joined" to the project as a reporter.

Actions #10

Updated by Dominic Cleal almost 10 years ago

  • Status changed from New to Assigned
  • Assignee set to Dominic Cleal

Paul, as a workaround, uncommenting the production environment in your puppet.conf seems to get it working.

Xesc, we don't currently support directory environments if that's what you meant (#4699) and it may throw a confusingly identical error message if you attempt to do this. If you're using ordinary (older style) environments then please attach your puppet.conf.

Jon, could you attach your puppet.conf please?

Actions #11

Updated by Dominic Cleal almost 10 years ago

  • Status changed from Assigned to Ready For Testing

Don't worry about puppet.conf, I got what I needed from the foreman-users list.

If you want to try the patch:

PR: https://github.com/theforeman/smart-proxy/pull/161

Actions #12

Updated by Dis McCarthy almost 10 years ago

That patch worked for us.

Thanks!

Actions #13

Updated by Paul Calabro almost 10 years ago

Thanks! That worked w/o error! :)

Updated by Ollie Lawson almost 10 years ago

I have applied the patch above with Foreman 1.5.0 and Puppet 3.6.1 but the environments still do not import.

Proxy log shows:
I, [2014-06-05T09:51:10.523466 #22641] INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
W, [2014-06-05T09:51:10.624875 #22641] WARN -- : No environments found - falling back to defaults (production - /etc/puppet/modules)
I, [2014-06-05T09:51:10.626139 #22641] INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
I, [2014-06-05T09:51:10.670755 #22641] INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
I, [2014-06-05T09:55:00.603963 #23649] INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
W, [2014-06-05T09:55:00.748032 #23649] WARN -- : No environments found - falling back to defaults (production - /etc/puppet/modules)
I, [2014-06-05T09:55:00.898409 #23649] INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
W, [2014-06-05T09:55:00.943845 #23649] WARN -- : No environments found - falling back to defaults (production - /etc/puppet/modules)
I, [2014-06-05T09:55:00.944576 #23649] INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf
I, [2014-06-05T09:55:01.048171 #23649] INFO -- : Initializing from Puppet config file: /etc/puppet/puppet.conf

Puppet.conf file is attached

Thanks

Ollie

Actions #15

Updated by Dominic Cleal almost 10 years ago

Ollie Lawson wrote:

I have applied the patch above with Foreman 1.5.0 and Puppet 3.6.1 but the environments still do not import.

Your puppet.conf shows you're using directory environments ("environmentpath"), which we don't yet support (#4699). Although they're now deprecated in 3.6, I'd suggest using the old style environments.

Actions #16

Updated by Dominic Cleal almost 10 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions #17

Updated by Bryan Kearney almost 10 years ago

  • Bugzilla link set to https://bugzilla.redhat.com/show_bug.cgi?id=1107678
Actions #18

Updated by Paul Calabro almost 10 years ago

I didn't have to downgrade to an earlier version of Puppet to resolve this issue. I'm on 3.6.2 and I'm working fine.
I just had to use the older style of declaring environments.
Is there some unintentional side-effect that I'm permitting that I'm not aware of?

Actions #19

Updated by Elisiano Petrini almost 10 years ago

Dominic Cleal wrote:

Don't worry about puppet.conf, I got what I needed from the foreman-users list.

If you want to try the patch:

PR: https://github.com/theforeman/smart-proxy/pull/161

Hi All,
I tried to apply this patch but I had no benefit from it.

I'm a bit reluctant to go back to config environments because puppet would start throwing out deprecation warnings.
Is there a solution for this?

Thanks for your help.

Puppet 3.6.2, Foreman 1.5 (with above patch)

Actions #20

Updated by Dominic Cleal almost 10 years ago

As per my above comment(s), directory environments are not supported at the moment and this patch does not provide support. It only fixes an issue with initialising Puppet 3.6.

You'll need to use the older configured environments with deprecation warnings (though the next version of Puppet may provide controls over what deprecation warnings you see). Please follow #4699 for directory environment support.

Actions #21

Updated by Elisiano Petrini almost 10 years ago

Dominic Cleal wrote:

As per my above comment(s), directory environments are not supported at the moment and this patch does not provide support. It only fixes an issue with initialising Puppet 3.6.

You'll need to use the older configured environments with deprecation warnings (though the next version of Puppet may provide controls over what deprecation warnings you see). Please follow #4699 for directory environment support.

Apologies for the mixup.
I guess living with deprecation warnings is better than not having Foreman importing classes :).
Following the other ticket now, thanks for your help.

Best Regards.

Actions

Also available in: Atom PDF