Skip to content

Concat 8.0.0 / Puppet 8.0 - Deferred function calls incompatibility #775

@fetzerms

Description

@fetzerms

Describe the Bug

Concat v8 (and also prior) does not play well with Deferred function calls in Puppet 8. They do not get properly evaluated when using them as a content parameter. I first encountered this issue at voxpupuli/puppet-gitlab_ci_runner#167 - but tracked it down to concat / puppet v8.

Expected Behavior

Concat should be able to properly use Deferred function calls.

Steps to Reproduce

With docker.

Filename: Dockerfile-8

FROM debian:bullseye
RUN apt-get update && apt-get install -y wget
RUN wget https://apt.puppetlabs.com/puppet8-release-bullseye.deb
RUN dpkg -i puppet8-release-bullseye.deb
RUN apt-get update && apt-get install -y puppet-agent
RUN /opt/puppetlabs/bin/puppet module install puppetlabs-concat --version 8.0.1
RUN /opt/puppetlabs/bin/puppet apply -e "concat { '/tmp/file': ensure => present, } concat::fragment { 'tmpfile': target  => '/tmp/file', content => Deferred('md5', ['Hello']), order   => '01'}"

Commands:
docker build -f Dockerfile-8 -t concat8_puppet8 . && docker run -it concat8_puppet8 cat /tmp/file

Output:

[+] Building 13.1s (11/11) FINISHED                                                                                                                                                                                                                                                                                                                                        
 => [internal] load build definition from Dockerfile-8                                                                                                                                                                                                                                                                                                                0.0s
 => => transferring dockerfile: 543B                                                                                                                                                                                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                                                                       0.0s
 => [internal] load metadata for docker.io/library/debian:bullseye                                                                                                                                                                                                                                                                                                    0.5s
 => [1/7] FROM docker.io/library/debian:bullseye@sha256:63d62ae233b588d6b426b7b072d79d1306bfd02a72bff1fc045b8511cc89ee09                                                                                                                                                                                                                                              0.0s
 => CACHED [2/7] RUN apt-get update && apt-get install -y wget                                                                                                                                                                                                                                                                                                        0.0s
 => CACHED [3/7] RUN wget https://apt.puppetlabs.com/puppet8-release-bullseye.deb                                                                                                                                                                                                                                                                                     0.0s
 => CACHED [4/7] RUN dpkg -i puppet8-release-bullseye.deb                                                                                                                                                                                                                                                                                                             0.0s
 => CACHED [5/7] RUN apt-get update && apt-get install -y puppet-agent                                                                                                                                                                                                                                                                                                0.0s
 => [6/7] RUN /opt/puppetlabs/bin/puppet module install puppetlabs-concat --version 8.0.1                                                                                                                                                                                                                                                                             5.7s
 => [7/7] RUN /opt/puppetlabs/bin/puppet apply -e "concat { '/tmp/file': ensure => present, } concat::fragment { 'tmpfile': target  => '/tmp/file', content => Deferred('md5', ['Hello']), order   => '01'}"                                                                                                                                                          5.9s
 => exporting to image                                                                                                                                                                                                                                                                                                                                                1.0s 
 => => exporting layers                                                                                                                                                                                                                                                                                                                                               1.0s 
 => => writing image sha256:0b0da3d09eb189bc665bcdcb5b56b5a6f23945a64201a4c216a6d5a78e5beed8                                                                                                                                                                                                                                                                          0.0s 
 => => naming to docker.io/library/concat8_puppet8                                                                                                                                                                                                                                                                                                                    0.0s 
#<Puppet::Pops::Evaluator::DeferredValue:0x00007fbc00e1c300>

Environment

  • Version: 8.0.0
  • Puppet Agent 8.0 on Debian Bullseye

Additional Context

I tried the same with puppet 7, which yields the correct result:

Dockerfile-7:

FROM debian:bullseye
RUN apt-get update && apt-get install -y wget
RUN wget https://apt.puppetlabs.com/puppet7-release-bullseye.deb
RUN dpkg -i puppet7-release-bullseye.deb
RUN apt-get update && apt-get install -y puppet-agent
RUN /opt/puppetlabs/bin/puppet module install puppetlabs-concat --version 8.0.1
RUN /opt/puppetlabs/bin/puppet apply -e "concat { '/tmp/file': ensure => present, } concat::fragment { 'tmpfile': target  => '/tmp/file', content => Deferred('md5', ['Hello']), order   => '01'}"

docker build -f Dockerfile-7 -t concat8_puppet7 . && docker run -it concat8_puppet7 cat /tmp/file
Output:

[+] Building 0.5s (11/11) FINISHED                                                                                                                                                                                                                                                                                                                                         
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                                                                       0.0s
 => [internal] load build definition from Dockerfile-7                                                                                                                                                                                                                                                                                                                0.0s
 => => transferring dockerfile: 543B                                                                                                                                                                                                                                                                                                                                  0.0s
 => [internal] load metadata for docker.io/library/debian:bullseye                                                                                                                                                                                                                                                                                                    0.5s
 => [1/7] FROM docker.io/library/debian:bullseye@sha256:63d62ae233b588d6b426b7b072d79d1306bfd02a72bff1fc045b8511cc89ee09                                                                                                                                                                                                                                              0.0s
 => CACHED [2/7] RUN apt-get update && apt-get install -y wget                                                                                                                                                                                                                                                                                                        0.0s
 => CACHED [3/7] RUN wget https://apt.puppetlabs.com/puppet7-release-bullseye.deb                                                                                                                                                                                                                                                                                     0.0s
 => CACHED [4/7] RUN dpkg -i puppet7-release-bullseye.deb                                                                                                                                                                                                                                                                                                             0.0s
 => CACHED [5/7] RUN apt-get update && apt-get install -y puppet-agent                                                                                                                                                                                                                                                                                                0.0s
 => CACHED [6/7] RUN /opt/puppetlabs/bin/puppet module install puppetlabs-concat --version 8.0.1                                                                                                                                                                                                                                                                      0.0s
 => CACHED [7/7] RUN /opt/puppetlabs/bin/puppet apply -e "concat { '/tmp/file': ensure => present, } concat::fragment { 'tmpfile': target  => '/tmp/file', content => Deferred('md5', ['Hello']), order   => '01'}"                                                                                                                                                   0.0s
 => exporting to image                                                                                                                                                                                                                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                                                                                                                                                                                                                               0.0s
 => => writing image sha256:7cc5bc2cd4ddf414f17111559facd0b8d8c4a54c923475af4a30812a27c73a6e                                                                                                                                                                                                                                                                          0.0s
 => => naming to docker.io/library/concat8_puppet7                                                                                                                                                                                                                                                                                                                    0.0s
8b1a9953c4611296a827abf8c47804d7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions