On 23/03/16 11:24, Martin Alfke wrote:

On 22 Mar 2016, at 22:53, Carthik Sharma <cart...@puppetlabs.com> wrote:

To answer the question in the subject, you're correct, as documented here for 
Puppet 3.8

https://docs.puppetlabs.com/puppet/3.8/reference/environments_classic.html#allowed-names

Is this only for Puppet 3.8 or is this also valid for Puppet 4.x?


Only versions < 4 has those restriction.

From 4.0.0 the name "environment" should not be used as the actual name of an environment.

- henrik





On Tue, Mar 22, 2016 at 1:41 AM, 'Robert Heinzmann' via Puppet Users 
<puppet-users@googlegroups.com> wrote:
Hello,

I'm using PuppetServer 1.1.3 and want to use directory environments (I can not 
update to puppet 4 because of http://projects.theforeman.org/issues/8447, 
Foreman is used for reporting and facts only (CMDB like)).

The main puppet repo has 2 branches:
        • master (production)
        • development (test&dev)
I use r10k to manage the environments under /etc/puppet/environments

--- o<----
:sources:
   example:
     basedir: /etc/puppet/environments
     prefix: false
     remote: <GIT_URL>
--- o<----

The following master setup has worked for both "master" and "development"

---- o<  ----
# file /etc/puppet/puppet.conf
[master]

     # insecure not via server_facts ...
     environment = ...
     # PuppetDB Enabled
     storeconfigs = true
     storeconfigs_backend = ...
     reports = ...

     # Hiera Config File
     hiera_config = ...
     default_manifest = /etc/puppet/environments/$environment/manifests/site.pp
     manifestdir = /etc/puppet/environments/$environment/manifests
     manifest = /etc/puppet/environments/$environment/manifests/site.pp
     modulepath = 
/etc/puppet/modules:/etc/puppet/environments/$environment/modules:/etc/puppet/environments/$environment/forge:/etc/puppet/environments/$environment/3rdparty
     # ENC Enabled
     node_terminus = exec
     external_nodes = ...
     ## see 
https://docs.puppetlabs.com/puppet/latest/reference/lang_facts_and_builtin_vars.html#serverfacts-variable
     trusted_server_facts = true
     trusted_node_data = true
     ## Make sure master uses another directory so master can be agent of 
someone else
     ssldir = ...
     certname = ...
     server = ...

     ## Add extra DNS Names
     dns_alt_names = ...
---- o<  ----

Now I want to switch to directory environments changed configuration as follows:

Puppet master config is as follows:

---- o<  ----
# file /etc/puppet/puppet.conf
[master]

     environment = ...
     # PuppetDB Enabled
     storeconfigs = true
     storeconfigs_backend = ...
     reports = ...

     # Hiera Config File
     hiera_config = ...
     ## Directory Environments enabled
     default_manifest = /etc/puppet/manifests/site.pp
     environmentpath = /etc/puppet/environments
     environment_timeout = 0
     basemodulepath = /etc/puppet/modules
     disable_per_environment_manifest = false
     # ENC Enabled
     node_terminus = exec
     external_nodes = ...
     ## see 
https://docs.puppetlabs.com/puppet/latest/reference/lang_facts_and_builtin_vars.html#serverfacts-variable
     trusted_server_facts = true
     trusted_node_data = true
     ## Make sure master uses another directory so master can be agent of 
someone else
     ssldir = ...
     certname = ...
     server = ...

     ## Add extra DNS Names
     dns_alt_names = ...
---- o<  ----

The environment.conf is

---- o<  ----
# file /etc/puppet/environments/master/environment.conf and
# file /etc/puppet/environments/development/environment.conf
## See 
https://docs.puppetlabs.com/puppet/latest/reference/config_file_environment.html

# The module path
modulepath = ./modules/:./forge/:./3rdparty/:$basemodulepath

# Manifest
manifest = manifests/site.pp

# current or future (3.8 only)
# parser = current

## Path to custom script
# config_version=

## Timeout for cache
environment_timeout = unlimited
---- o<  ----

This setup works for environment "development" but not "master".

agent shell# puppet agent --onetime --test --environment master => Fail with 404
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Could not find class my_webserver for webserver-test1 on node webserver-test1

agent shell# puppet agent --onetime --test --environment development => OK

If I do "mv /etc/puppet/environments/master /etc/puppet/environments/mytest123" 
and restart the puppetserver mytest123 environment works

agent shell# puppet agent --onetime --test --environment mytest123 => OK

If I do "mv /etc/puppet/environments/mytest123 /etc/puppet/environments/master" 
and restart the puppetserver master environment FAILES again

agent shell# puppet agent --onetime --test --environment master => Fail with 404
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: 
Could not find class my_webserver for webserver-test1 on node webserver-test1

So it is not the repo content but the name of the environment causing the 
problem I guess.

Has someone seen this issue yet ??

Using "prefix: true" on r10k should fix the issue and generate unique 
environment names.

Also renaming all git branches should solve the issue.

However I would like to know if this issue is known and if it still exists on 
Puppet 4.0 ?

Regards,
Robert


--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/cb8cb201-5524-4956-a0f4-36ac5b223c58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAOzFSfEWWz-EJQPnsD1tJFCCbK0NO-JvvQ_6W2RZdKRx9_GsDg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/56F27CA9.8050701%40puppetlabs.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to