Skip to content

Commit 6e588cf

Browse files
Merge pull request #1931 from andfasano/day2-fix-pxe-copy
OCPBUGS-45311: fix oc adm node-image create --pxe command to copy the correct artifacts
2 parents c724dcb + cce3f5d commit 6e588cf

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pkg/cli/admin/nodeimage/create.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,8 @@ func (o *CreateOptions) copyArtifactsFromNodeJoinerPod() error {
380380
RsyncExclude: []string{"*"},
381381
}
382382
if o.GeneratePXEFiles {
383-
rsyncOptions.RsyncInclude = []string{"boot-artifacts/*"}
384-
rsyncOptions.RsyncExclude = []string{}
383+
rsyncOptions.Source.Path = "/assets/boot-artifacts/"
384+
rsyncOptions.RsyncInclude = []string{"*.img", "*.*vmlinuz", "*.ipxe"}
385385
logMessage = "Saving PXE artifacts to %s"
386386
}
387387
rsyncOptions.Strategy = o.copyStrategy(rsyncOptions)

pkg/cli/admin/nodeimage/create_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,23 +143,23 @@ func TestRun(t *testing.T) {
143143
expectedErrorCode int
144144
expectedError string
145145
expectedPod func(t *testing.T, pod *corev1.Pod)
146-
expectedRsyncInclude string
146+
expectedRsyncInclude []string
147147
}{
148148
{
149149
name: "default",
150150
nodesConfig: defaultNodesConfigYaml,
151151
objects: defaultClusterVersionObjectFn,
152152
assetsDir: "/my-working-dir",
153153
generatePXEFiles: false,
154-
expectedRsyncInclude: "*.iso",
154+
expectedRsyncInclude: []string{"*.iso"},
155155
},
156156
{
157157
name: "default pxe",
158158
nodesConfig: defaultNodesConfigYaml,
159159
objects: defaultClusterVersionObjectFn,
160160
assetsDir: "/my-working-dir",
161161
generatePXEFiles: true,
162-
expectedRsyncInclude: "boot-artifacts/*",
162+
expectedRsyncInclude: []string{"*.img", "*.*vmlinuz", "*.ipxe"},
163163
},
164164
{
165165
name: "node-joiner tool failure",
@@ -311,9 +311,9 @@ func TestRun(t *testing.T) {
311311
}
312312
}
313313

314-
if tc.expectedRsyncInclude != "" {
315-
if !slices.Contains(fakeCp.options.RsyncInclude, tc.expectedRsyncInclude) {
316-
t.Errorf("expected RSyncOptions to include %v, but doesn't", tc.expectedRsyncInclude)
314+
for _, ext := range tc.expectedRsyncInclude {
315+
if !slices.Contains(fakeCp.options.RsyncInclude, ext) {
316+
t.Errorf("expected RSyncOptions to include %s, but doesn't", ext)
317317
}
318318
}
319319
})

0 commit comments

Comments
 (0)