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

call_function and metadata.json: call a function from a different module, very strange behavior

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 4.2.1
    • Fix Version/s: PUP 4.3.2
    • Component/s: Language
    • Labels:
      None
    • Environment:

      Ubuntu 14.04.3 LTS and puppet version 4.2.1

    • Template:
    • Story Points:
      2
    • Sprint:
      Language 2015-12-30, Language 2016-01-13, Language 2016-01-27
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Functions in a module (A) could not be called from other modules that in meta data expressed the dependency on module A using a dash to separate user and module name. A work around is to change the separator to '/'.

      Description

      Hi,

      All my code is in the attached file. It's very minimal to reproduce the problem. There are few files:

      ~# tree production/
      production/
      |-- manifests/
      |   `-- site.pp
      |-- modules/
      |   |-- moda/
      |   |   `-- lib/
      |   |       `-- puppet/
      |   |           `-- functions/
      |   |               `-- moda/
      |   |                   `-- foo.rb
      |   `-- modb/
      |       |-- lib/
      |       |   `-- puppet/
      |       |       `-- functions/
      |       |           `-- modb/
      |       |               `-- bar.rb
      |       |-- manifests/
      |       |   `-- init.pp
      |       `-- metadata.json
      `-- environment.conf
      

      In the site.pp I just include the modb puppet class. And in the modb class I use a custom function :modb::bar() which calls another function from the moda module. I have this error:

      root@puppet4:~# puppet agent --test
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Function Call, Function modb::bar(): cannot call function '::moda::foo' - not found at /etc/puppetlabs/code/environments/production/modules/modb/manifests/init.pp:4:32 on node puppet4.athome.priv
      Warning: Not using cache on failed catalog
      Error: Could not retrieve catalog; skipping run
      

      And the very very curious behavior: if I just remove the metadata.json of the modb module (no other operation), the puppet run works well!

      root@puppet4:~# rm /etc/puppetlabs/code/environments/production/modules/modb/metadata.json 
      root@puppet4:~# puppet agent --test
      Info: Retrieving pluginfacts
      Info: Retrieving plugin
      Info: Caching catalog for puppet4.athome.priv
      Info: Applying configuration version '1441677483'
      Notice: foo
      Notice: /Stage[main]/Modb/Notify[Test1]/message: defined 'message' as 'foo'
      Notice: bar
      Notice: /Stage[main]/Modb/Notify[Test2]/message: defined 'message' as 'bar'
      Notice: Applied catalog in 0.04 seconds
      

      Regards.
      Fran├žois Lafont

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  flaf Francois Lafont
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: