Bug #1108

environment import not working properly

Added by James Martin almost 2 years ago. Updated 11 months ago.

Status:Closed Start:08/11/2011
Priority:Normal Due date:
Assigned to:- % Done:

0%

Category:-
Target version:-
Backlog:No Difficulity:
Votes: 0

Description

Was trying to import some environments I created in puppet.conf:

    #/etc/puppet.conf

    [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

    [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

    [master]

    external_nodes = /etc/puppet/external_nodes.rb
    node_terminus = exec
    modulepath = /etc/puppet/modules
    manifest = /etc/puppet/manifests/unknown_environment.pp

    [production]
    manifest = /etc/puppet/manifests/site.pp
    modulepath = /etc/puppet/environments/production/modules

    [dev]
    manifest = /etc/puppet/manifests/site.pp
    modulepath = /etc/puppet/environments/dev/modules

    [qa]
    manifest = /etc/puppet/manifests/site.pp
    modulepath = /etc/puppet/environments/qa/modules

    [root@qa-mgmt foreman]# rake puppet:import:puppet_classes RAILS_ENV=production
    (in /usr/share/foreman)
    Evaluating possible changes to your installation
    Scheduled changes to your environment
    Create/update environments
    master : blackboard::common, core::mail, core::services, cpfusion::appserver, cpfusion::common, cpfusion::dbserver, cpfusion::fileserver, cpfusion::logging::local, cpfusion::logging::remote, cpfusion::maintenance, func::client, glassfish, glassfish::logserver, httpd::base, iptables::common, nfs::server, ntp::client, openssh::server, pgbackup::oldclient, pgbackup::snapshot, postgres::cpfusion, postgres::logserver, postgres::server, rsnapshot::client, rsnapshot::server, rsyslog::base, rsyslog::client, rsyslog::server, snmp::client, sudo, users::common, users::cpfadmins, users::cpfdevs, users::glassfish, webmin, yum, zabbix::agent, and zabbix::proxy
    qa :
    dev :
    Delete environments
    production : Remove environment

    Proceed with these modifications? <yes|no> no

As you can see it's trying to overwrite "production" and replace it with "master." Seems odd. Import the environment in the UI doesn't report any error.

History

Updated by Ohad Levy almost 2 years ago

  • Assigned to set to Paul Kelly

Paul, do you have any idea?

Updated by Ohad Levy over 1 year ago

  • Assigned to deleted (Paul Kelly)

I'm guessing this relates to the env of the user, and the fact that foreman was maybe defaulting to a different puppet.conf

can you try forcing it in the config/settings.yml file instead?

Updated by Olivier Le Cam about 1 year ago

Faced same problem this morning. puppetconfig must indeed be defined in settings.yaml:

:puppetconfdir: /etc/puppet/puppet.conf

Other alternative in this patch:

--- a/app/models/environment.rb
+++ b/app/models/environment.rb
@@ -22,7 +22,7 @@ class Environment < ActiveRecord::Base
     unless Rails.env == "test" 
       # reread puppet configuration
       Puppet.clear
-      Puppet[:config] = SETTINGS[:puppetconfdir]
+      Puppet[:config] = SETTINGS[:puppetconfdir] || "/etc/puppet/puppet.conf" 
     end
     Puppet.parse_config # Check that puppet.conf has not been edited since the rack application was started
     conf = Puppet.settings.instance_variable_get(:@values)

Updated by Benjamin Papillon 11 months ago

  • Status changed from New to Closed

The class and environment imports are now handled by smart-proxy.
Inside your smartproxy settings.yml, you should have a line similar to this one :

:puppet_conf: /etc/puppet/puppet.conf

Also available in: Atom PDF