Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-1557

Unexpected behavior with the create_resources() command and the exec type

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Do
    • Affects Version/s: PUP 2.7.23
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
      None
    • Environment:

      CentOS 6.5 - x86_64

      Packages:
      puppet-2.7.23-1.el6.noarch
      puppet-server-2.7.23-1.el6.noarch

    • Template:

      Description

      I'm trying to create exec resources from a ENC script.

      ENC script returns the following result:
      classes:
      generic:
      ...
      execs:
      plop1:
      command: /bin/echo command1
      path: [/bin, /usr/bin]
      plop2:
      command: /bin/echo command2
      path: [/bin, /usr/bin]
      ...
      parameters: {}

      In my Class[generic], i call the create_resources() function like this :
      create_resources("exec", $execs)

      When i run puppet agent --test on a node, i've the following error:
      [root@deploy ~]# puppet agent --test
      info: Caching catalog for deploy.virt.betrancourt.net
      info: Applying configuration version '1391165636'
      err: /Stage[main]/Generic/Exec[plop2]/returns: change from notrun to 0 failed: Could not find command 'plop2'
      err: /Stage[main]/Generic/Exec[plop1]/returns: change from notrun to 0 failed: Could not find command 'plop1'
      notice: Finished catalog run in 3.81 seconds
      [root@deploy ~]#

      I created a generic_create_resources() function with same parameters as the original. In my function, i print the "$execs" variable with :
      debug args[1].inspect

      I copied the result:
      {"plop2"=>

      {"command"=>"/bin/echo command2", "path"=>["/bin", "/usr/bin"]}

      , "plop1"=>{"command"=>"/bin/echo command1", "path"=>["/bin", "/usr/bin"]}}

      Finally, i created a test.pp file with the following content:
      [root@deploy ~]# cat test.pp
      $execs = {"plop2"=>

      {"path"=>["/bin", "/usr/bin"], "command"=>"/bin/echo command2"}

      , "plop1"=>{"path"=>["/bin", "/usr/bin"], "command"=>"/bin/echo command1"}}

      class

      { "generic": execs => $execs }

      And i run puppet apply test.pp:
      [root@deploy ~]# puppet apply test.pp
      /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/create_resources.rb:1: warning: multiple values for a block parameter (2 for 1)
      from /usr/lib/ruby/site_ruby/1.8/puppet/parser/scope.rb:464
      notice: /Stage[main]/Generic/Exec[plop2]/returns: executed successfully
      notice: /Stage[main]/Generic/Exec[plop1]/returns: executed successfully
      notice: Finished catalog run in 0.24 seconds

      In this case, exec resources work.

      I attached the puppet master output in debug mode:
      puppet master --debug --verbose --no-daemonize | tee -a /tmp/puppet-master-debug.log

        Attachments

          Activity

            People

            • Assignee:
              kylo Kylo Ginsberg
              Reporter:
              rclsilver Thomas Bétrancourt
              QA Contact:
              Narmadha Perumal
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Zendesk Support