Skip to content

Use Kafo's migration DSL#700

Draft
ekohl wants to merge 1 commit intotheforeman:developfrom
ekohl:use-migration-dsl
Draft

Use Kafo's migration DSL#700
ekohl wants to merge 1 commit intotheforeman:developfrom
ekohl:use-migration-dsl

Conversation

@ekohl
Copy link
Member

@ekohl ekohl commented Jul 21, 2021

This rewrites most Foreman migrations to a new migration DSL. The DSL decouples from the actual answer file structure and is more expressive.

Technically the DSL doesn't exist, but this at least makes sure that it's possible to express everything with the DSL I had in mind. As a reference to theforeman/kafo#337.

This rewrites most Foreman migrations to a new migration DSL. The DSL
decouples from the actual answer file structure and is more expressive.

Technically the DSL doesn't exist, but this at least makes sure that
it's possible to express everything with the DSL I had in mind.
@@ -1,74 +1,10 @@
DELETED = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can be blamed for this. Kafo already removed unknown keys and this was never needed in the first place.

mod_answers['dhcp_gateway'] = nil if mod_answers['dhcp_gateway'] == '192.168.100.1'
migrate_module('foreman_proxy') do |mod|
mod.unset_answer('repo')
mod.unset_answer('dhcp_gateway') if mod['dhcp_gateway'] == '192.168.100.1'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about some more advanced DSL here:

mod.migrate_answer('dhcp_gateway') do |param|
  param.unset_answer if param.value == '192.168.100.1'
end

However, I didn't want to overload things too soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants