Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Kafo's migration DSL #700

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft

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