Please Confirm: Puppet Directory Environments can not be named "master" ?

169 views
Skip to first unread message

Robert Heinzmann

unread,
Mar 22, 2016, 5:38:17 AM3/22/16
to Puppet Users
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 = ...
    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 = ...
    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

# 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 

Carthik Sharma

unread,
Mar 22, 2016, 5:53:42 PM3/22/16
to puppet...@googlegroups.com
To answer the question in the subject, you're correct, as documented here for Puppet 3.8

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

Martin Alfke

unread,
Mar 23, 2016, 6:25:13 AM3/23/16
to puppet...@googlegroups.com

On 22 Mar 2016, at 22:53, Carthik Sharma <car...@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?
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAOzFSfEWWz-EJQPnsD1tJFCCbK0NO-JvvQ_6W2RZdKRx9_GsDg%40mail.gmail.com.

Henrik Lindberg

unread,
Mar 23, 2016, 7:23:32 AM3/23/16
to puppet...@googlegroups.com
On 23/03/16 11:24, Martin Alfke wrote:
>
> On 22 Mar 2016, at 22:53, Carthik Sharma <car...@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
--

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

Martin Alfke

unread,
Mar 23, 2016, 7:38:05 AM3/23/16
to puppet...@googlegroups.com

On 23 Mar 2016, at 12:23, Henrik Lindberg <henrik....@puppetlabs.com> wrote:

> On 23/03/16 11:24, Martin Alfke wrote:
>>
>> On 22 Mar 2016, at 22:53, Carthik Sharma <car...@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.

should not or must not?

-Martin

Henrik Lindberg

unread,
Mar 23, 2016, 8:40:15 AM3/23/16
to puppet...@googlegroups.com
The consequences of using it is not known, so: Must not.

- henrik

> -Martin
Reply all
Reply to author
Forward
0 new messages