foreman
foreman copied to clipboard
Fixes #37433 - Set indentation when calling subscription_manager_setup
Adding proper indentation when calling snippet subscription_manager_setup
The problem I'm trying to solve is the final rendered result of cloud_init_default.erb.
subscription_manager_setup.erb is fine.
redhat_register.erb is also fine and generates valid bash script.
However, when rendered, redhat_register.erb result does not have the same indentation. Code that comes from redhat_register.rb have 2 space indentation, but what is generated by the snippet has no indentation at all. That's fine if that result is simply being processed by bash.
The problem is that cloud_init_default.erb (which consumes redhat_register.erb) is supposed to generate a valid yaml as result. With that difference on indentation coming from redhat_register.erb its result is not a valid yaml.
I wouldn't mind if we removed all the indentation from redhat_register.erb. That would do the trick too. What matters is that the rendered result should have the same indentation.
@ekohl , this is how the template looks like when it's rendered without the indentation:
If we indent the internal snippet, it will pass the validation:
@jpasqualetto can you update the snapshots of templates as well?
The rails command is RAILS_ENV=test bundle exec rails snapshots:generate
I messed up while trying to push the snapshots. I rebased my code to run the generate snapshots and pushed it into the issue branch. Trying to fix this mess now.
I added the snapshots and fixed my mess. Let me know if you need anything else.
@ekohl Apparently the indentation breaks templates that have heredoc in them. Created a ticket for it: https://projects.theforeman.org/issues/37741
Given my concern in https://github.com/theforeman/foreman/pull/10153#pullrequestreview-2049931982 I'm leaning to reverting the change. Or are you working on a fix @ShimShtein?