Skip to content

Commit a4061ff

Browse files
authored
Merge pull request #3916 from norio-nomura/progress-prints-current-boot-session-log
`--progress`: start printing log from the beginning of the current boot session
2 parents 172fe4d + a481b1d commit a4061ff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/hostagent/hostagent.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,13 @@ func (a *HostAgent) watchCloudInitProgress(ctx context.Context) {
892892
args = append(args,
893893
"-p", strconv.Itoa(a.sshLocalPort),
894894
"127.0.0.1",
895-
"sudo", "tail", "-n", "+1", "-f", "/var/log/cloud-init-output.log",
895+
"sh", "-c",
896+
`"sudo tail -n +$(sudo awk '
897+
BEGIN{b=1; e=1}
898+
/^Cloud-init.* finished/{e=NR}
899+
/.*/{if(NR>e){b=e+1}}
900+
END{print b}
901+
' /var/log/cloud-init-output.log) -f /var/log/cloud-init-output.log"`,
896902
)
897903

898904
cmd = exec.CommandContext(ctx, a.sshConfig.Binary(), args...)

0 commit comments

Comments
 (0)