Skip to content

Commit 071b9ba

Browse files
ppitonakadrianriobo
authored andcommitted
fix: call script expand-root-disk.sh conditionally
Commit 394b17e ("fix(rhel): grow disk size to external volume size", Feb 24) introduced a bug. In the cloud-config-base template at line 17, write_files: is unconditional, but all the entries underneath it are conditional. When none of the conditions are true (no ExpandRootDisk, no ActionsRunnerSnippet, no CirrusSnippet, no GitLabSnippet), the generated YAML becomes: write_files: This makes write_files equal to null in YAML, and cloud-init's cc_write_files module crashes with 'NoneType' object is not iterable when it tries to iterate over the entries. Additionally, the template also unconditionally runs /usr/local/bin/expand-root-disk.sh in runcmd, which would also fail on AWS since the script is never written. Signed-off-by: Pavol Pitonak <ppitonak@redhat.com>
1 parent 394b17e commit 071b9ba

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pkg/target/host/rhel/cloud-config-base

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ growpart:
88
devices: ["/"]
99
ignore_growroot_disabled: false
1010
runcmd:
11-
- /usr/local/bin/expand-root-disk.sh
11+
{{ if .ExpandRootDisk }} - /usr/local/bin/expand-root-disk.sh{{ end }}
1212
- while fuser /var/lib/rpm/.rpm.lock > /dev/null 2>&1 ; do sleep 1 ; done
1313
- dnf install -y podman
1414
{{ if .ActionsRunnerSnippet }} - sudo -u {{ .Username }} bash -c /opt/install-ghrunner.sh{{ end }}
1515
{{ if .CirrusSnippet }} - /opt/setup-cirrus-service.sh{{ end }}
1616
{{ if .GitLabSnippet }} - sudo -u {{ .Username }} bash -c /opt/install-glrunner.sh{{ end }}
17+
{{- if or .ExpandRootDisk .ActionsRunnerSnippet .CirrusSnippet .GitLabSnippet }}
1718
write_files:
1819
{{- if .ExpandRootDisk }}
1920
- path: /usr/local/bin/expand-root-disk.sh
@@ -40,3 +41,4 @@ write_files:
4041
path: /opt/install-glrunner.sh
4142
permissions: '0755'
4243
{{ end }}
44+
{{- end }}

0 commit comments

Comments
 (0)