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.
Разобрался с этим -если вы хотите импортировать функции для модуля в том же пространстве, все, что вам нужно сделать, это включить модуль в зависимости
в файл metadata.json
для импортируемого модуля (ModuleB в моем вопросе выше). Использование манифеста
в их документации сбивает с толку - правильнее было бы включить его в метаданные
.
Таким образом, узел зависимости в файле metadata.json
будет чем-то вроде
"dependencies": [
{ "name":"puppetlabs/apt","version_requirement":"6.0.0" },
{ "name": "mycompany/moduleb", "version_requirement": "> 0.0.1" }
]
с moduleb
, содержащим импортируемые функции. Это, вероятно, означает, что вы не можете правильно использовать Кузницу Марионеток, но если вы столкнетесь с этой проблемой, вы, вероятно, не сильно потеряете там.