-
Notifications
You must be signed in to change notification settings - Fork 993
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
Fixes #37433 - Set indentation when calling subscription_manager_setup #10153
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd argue the rest of the subman code should be not indented since at the bash level they're not conditional. The Ruby conditionals shouldn't matter for the end result.
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 |
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. |
and add snapshot of templates
ff2e885
to
3812121
Compare
I added the snapshots and fixed my mess. Let me know if you need anything else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Looks pretty neat to me. @ekohl any comments?
@@ -96,7 +96,7 @@ description: | | |||
echo "Starting the subscription-manager registration process" | |||
|
|||
# Set up subscription-manager | |||
<%= snippet("subscription_manager_setup", variables: { subman_setup_scenario: 'provisioning' }).strip -%> | |||
<%= indent(2) { snippet("subscription_manager_setup", variables: { subman_setup_scenario: 'provisioning' }).strip } -%> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, skip1 is necessary so that the first line (# select...) is indented correctly.
@ekohl Apparently the indentation breaks templates that have heredoc in them. Created a ticket for it: |
Given my concern in #10153 (review) I'm leaning to reverting the change. Or are you working on a fix @ShimShtein? |
Adding proper indentation when calling snippet subscription_manager_setup