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

Fix Rocky container sed formatting #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN dnf group install -y 'Minimal Install' --allowerasing && \
dnf install -y findutils util-linux \
https://mirror.stream.centos.org/9-stream/AppStream/x86_64/os/Packages/cloud-init-23.4-7.el9.noarch.rpm

RUN sed -i "s/renderers:.*/renderers: ['network-manager']\n activators: ['network-manager']/" /etc/cloud/cloud.cfg
RUN sed -i "s/renderers:.*/{renderers: ['network-manager'], activators: ['network-manager'] }/" /etc/cloud/cloud.cfg

Choose a reason for hiding this comment

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

Can you provide an example of the rendered output with some context?

Copy link
Contributor Author

@Alex-Welsh Alex-Welsh Mar 27, 2024

Choose a reason for hiding this comment

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

What the line is meant to do is edit /etc/cloud/cloud.cfg from something like this

foo:
   network:
      renderers: ['network-manager', 'some-other-options', 'more-options']

to:

foo:
   network:
      renderers: ['network-manager']
      activators: ['network-manager']   

But for some reason it breaks with the above error. My theory was that the solution wasn't working because it has a precise amount of whitespace in the sed command, so if the formatting of the source file is slightly changed it no longer is valid yaml. For example:

foo:
  network:
    renderers: ['network-manager']
      activators: ['network-manager']   

My solution instead edits it like this:

foo:
   network:
      {renderers: ['network-manager'], activators: ['network-manager'] }   

Which is valid yaml that no longer relies on whitespace.

Now all that being sed, I've since discovered that this element is breaking the Rocky 8 builds, and there has been a change to the upstream version here so rather than making similar changes for rocky 8, I was just going to try switching back to that upstream one and dropping this element entirely.

Choose a reason for hiding this comment

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

Now all that being sed

Appreciate this hidden pun.


RUN systemctl unmask console-getty.service dev-hugepages.mount \
getty.target sys-fs-fuse-connections.mount systemd-logind.service \
Expand Down