0

Say I have two locally extant modules that don't exist on Forge or in a custom Forge-like repo. These repos will never be installed via command line as they are part of a bigger deployment that cannot use the Forge-like installation commands - they are put there by hand or by repo cloning.

ModuleA defines a function in its functions folder, and is invokable in the scope of ModuleA. All good.

ModuleB tries to invoke the function from ModuleA and fails as due to the module not being installed and findable for the JSON manifest.

Can this limitation be gotten around nicely? Classes can be invoked in this way - I don't want to sacrifice good design for this awkward limitation.

AndrewL
  • 191
  • 4

1 Answers1

0

Figured this one out - if you wish to import functions for a module in the same space all you need to do is include the module in dependencies in the metadata.json file for the module that is importing (ModuleB in my above question). The usage of manifest in their documentation is confusing - including it in the metadata would be more correct.

So a dependency node in the metadata.json file would be something like

  "dependencies": [
    { "name":"puppetlabs/apt","version_requirement":"6.0.0" },
    { "name": "mycompany/moduleb", "version_requirement": "> 0.0.1" }
  ]

with the moduleb containing the importable functions. This probably means that you can't use the Puppet forge correctly, but if you are dealing with this problem you likely aren't losing much there.

AndrewL
  • 191
  • 4