You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In mgmt, resources can have "traits". This means they get an extra function with a specific signature attached to it. What if we added a "transformer" trait, which was a special thing that returned the translation DSL for that resource? That way, when we add/change resources, it will always be in sync? The only difference is that at runtime, the puppet side would have to request that stuff at runtime. Would that work?
Eg:
We'd add:
func (obj *PkgRes) PuppetTransformer() (string, error) {
return ```
PuppetX::CatalogTranslation::Type.new :package do
emit :pkg
spawn :name do
@resource[:name]
end
rename :ensure, :state do |value|
case value
when :installed, :present
:installed
when :purged, :absent
:uninstalled
else
translation_failure "uses an ensure value that currently cannot be translated for mgmt (defaulting to 'installed')", value
:installed
end
end
end
)
Or similar. Perhaps there's even a more logical or better API.
TBD
The text was updated successfully, but these errors were encountered:
...and then I can mgmt translate-from-puppet package or ... file and it prints the DSL?
I'm not sure at the moment...the Puppet module relies on autoloading magic from Puppet proper. However, this is not to say that we could not replace that with a scheme like you describe.
I'd rather like it, it would sure make it easier to keep the "what version of mgmt works with which version of the translator" matrix in check 🙈
Here's a thought:
In mgmt, resources can have "traits". This means they get an extra function with a specific signature attached to it. What if we added a "transformer" trait, which was a special thing that returned the translation DSL for that resource? That way, when we add/change resources, it will always be in sync? The only difference is that at runtime, the puppet side would have to request that stuff at runtime. Would that work?
Eg:
We'd add:
)
The text was updated successfully, but these errors were encountered: