Skip to content

Commit 91a58bc

Browse files
author
Cecile Robert-Michon
committed
Update docker_logcollector.go
1 parent 4dfa272 commit 91a58bc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

test/framework/docker_logcollector.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,25 @@ import (
3434
// DockerLogCollector collect logs from a CAPD workload cluster.
3535
type DockerLogCollector struct{}
3636

37-
// generateContainerName return a container name using the same rule used in CAPD.
37+
// machineContainerName return a container name using the same rule used in CAPD.
3838
// NOTE: if the cluster name is already included in the machine name, the cluster name is not add thus
3939
// avoiding \"sethostname: invalid argument\" errors due to container name too long.
40-
func generateContainerName(cluster, machine string) string {
40+
func machineContainerName(cluster, machine string) string {
4141
if strings.HasPrefix(machine, cluster) {
4242
return machine
4343
}
4444
return fmt.Sprintf("%s-%s", cluster, machine)
4545
}
4646

4747
func (k DockerLogCollector) CollectMachineLog(ctx context.Context, managementClusterClient client.Client, m *clusterv1.Machine, outputPath string) error {
48-
containerName := generateContainerName(m.Spec.ClusterName, m.Name)
48+
containerName := machineContainerName(m.Spec.ClusterName, m.Name)
4949
return k.collectLogsFromNode(outputPath, containerName)
5050
}
5151

5252

5353
func (k DockerLogCollector) CollectMachinePoolLog(ctx context.Context, managementClusterClient client.Client, m *expv1.MachinePool, outputPath string) error {
5454
for _, instance := range m.Status.NodeRefs {
55-
containerName := generateContainerName(m.Spec.ClusterName, instance.Name)
56-
err := k.collectLogsFromNode(filepath.Join(outputPath, instance.Name), containerName)
55+
err := k.collectLogsFromNode(filepath.Join(outputPath, instance.Name), instance.Name)
5756
if err != nil {
5857
return err
5958
}

0 commit comments

Comments
 (0)