Skip to content

Setting environment via template considered harmful #16

@Ganneff

Description

@Ganneff

Hi,

the module sets the environment to upload the facts to within the variable $fact_upload_params, see

$fact_upload_params = "facts upload --environment ${environment}"

While this is simple, it has an unfortunate (and annoying) side effect. Due to the notify later on:

notify => Exec[$generate_scan_data_exec],

It means that a simple environment change will trigger a full log4jscanner run, as puppet will rewrite the script. Which can take ages and is wasteful.
If one is using environment based setups, and switches often between them, testing a single change in ones puppet can mean a ten minute run of log4jscanner.

Thats less than optimal.

I suggest adjusting to either use a
puppet config print
or, better,
awk -F ': ' '/^environment:/ {print $2}' $(puppet config print lastrunreport)
to get at the value.

The latter would cover setups, where people do not use puppets configfile to set the actual environment a machine runs in, by just taking what the last puppet run used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions