What exactly does foreman do when importing puppet environments

Hi,

I am currently debugging an issue where a colleague has committed and
pushed a new puppet class to his local development branch. The branch
is correctly checked out to /etc/puppet/environments/branch01a with
its current head (verified many times) like dozens of other branches
are.

I then, as usual, create an Environment branch01a in foreman and let
it import the classes by clicking in the environment list on the arrow
next to "Classes" and selecting "Import from" in the drop-down.
Foreman works a bit, reports a green window, but the class list
imported is an obsolete one. Classes deleted in branch01a still show
up in the class list, and the new classes defined in branch01a dont
show.

Do I see correctly that Foreman does not look into the local file
system but does instead query the puppet server for a list of its
environment? In the Smart Proxy configuration, I see the URL to Port
8443 of my puppet server, but not the filesystem path. How would I
debug this?

Greetings
Marc

··· -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402 Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421

The behaviour depends on the Puppet version being used and as configured
in the smart proxy's puppet.yml configuration file.

On Puppet 3.x without directory environments, the module path is
determined from puppet.conf and the manifests parsed by the smart proxy.
This may be cached inside the smart proxy based on the mtime of the
files if :use_cache is enabled.

On 3.5-3.8 with directory environments, the module path is determined by
querying the Puppet master or server, and manifests parsed as above.

On 4.x, the Puppet Server resource_types or environment_classes APIs is
queried returning the parsed data. The server may be configured to cache
manifests.

··· On 23/02/17 10:42, Marc Haber wrote: > I then, as usual, create an Environment branch01a in foreman and let > it import the classes by clicking in the environment list on the arrow > next to "Classes" and selecting "Import from" in the drop-down. > Foreman works a bit, reports a green window, but the class list > imported is an obsolete one. Classes deleted in branch01a still show > up in the class list, and the new classes defined in branch01a dont > show. > > Do I see correctly that Foreman does not look into the local file > system but does instead query the puppet server for a list of its > environment?


Dominic Cleal
dominic@cleal.org

Hi Dominic,

thanks for your answer.

> > I then, as usual, create an Environment branch01a in foreman and let
> > it import the classes by clicking in the environment list on the arrow
> > next to "Classes" and selecting "Import from" in the drop-down.
> > Foreman works a bit, reports a green window, but the class list
> > imported is an obsolete one. Classes deleted in branch01a still show
> > up in the class list, and the new classes defined in branch01a dont
> > show.
> >
> > Do I see correctly that Foreman does not look into the local file
> > system but does instead query the puppet server for a list of its
> > environment?
>
> The behaviour depends on the Puppet version being used and as configured
> in the smart proxy's puppet.yml configuration file.

It's puppet 3.8.7 here, with environmentpath set to
/etc/puppet/environments. That looks good.

Ths real issue was a stray "g" in line 1 of the manifest defining the
new class, which led to the entire manifest file being (silently?[1])
ignored. After (finding and) removing the g, everything is fine.

Thanks for helping!

Greetings
Marc

[1] I didn't comb through the really busy production.log in great
detail, but didn't find a meaningful error message. Nothing was given
on the web interface though.

··· On Thu, Feb 23, 2017 at 10:57:07AM +0000, Dominic Cleal wrote: > On 23/02/17 10:42, Marc Haber wrote:

Marc Haber | “I don’t trust Computers. They | Mailadresse im Header
Leimen, Germany | lose things.” Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421

Yes, it probably won't be. It's best currently to validate anything
being deployed before importing.

With Puppet 4.4, the smart proxy is now able to report on manifest
syntax errors (#15095), but Foreman doesn't use this information yet
(#7086, #3900).

··· On 24/02/17 12:25, Marc Haber wrote: > Ths real issue was a stray "g" in line 1 of the manifest defining the > new class, which led to the entire manifest file being (silently?[1]) > ignored. After (finding and) removing the g, everything is fine. > > Thanks for helping! > > Greetings > Marc > > [1] I didn't comb through the really busy production.log in great > detail, but didn't find a meaningful error message. Nothing was given > on the web interface though.


Dominic Cleal
dominic@cleal.org

Working on that :wink: but not yet there. Lesson learned.

Greetings
Marc

··· On Fri, Feb 24, 2017 at 12:33:46PM +0000, Dominic Cleal wrote: > Yes, it probably won't be. It's best currently to validate anything > being deployed before importing.

Marc Haber | “I don’t trust Computers. They | Mailadresse im Header
Leimen, Germany | lose things.” Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421