Wizard: handle dos scripts in first boot

Scripts in which lines are terminated by CRLF break the first boot
service, so let's make sure the line termination is correct.
This commit is contained in:
Sanne Raymaekers 2024-11-12 09:52:40 +01:00 committed by Klara Simickova
parent ba9546193e
commit 7b365dcb4d
3 changed files with 38 additions and 2 deletions

View file

@ -9,6 +9,7 @@ import {
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
import {
SCRIPT,
SCRIPT_DOS,
SCRIPT_WITHOUT_SHEBANG,
firstBootCreateBlueprintRequest,
firstBootData,
@ -199,6 +200,37 @@ describe('First boot request generated correctly', () => {
expect(receivedRequest).toEqual(expectedRequest);
});
});
test('dos2unix', async () => {
await renderCreateMode();
await selectGuestImageTarget();
await goToOscapStep();
await selectSimplifiedOscapProfile();
await goFromOscapToFirstBoot();
await openCodeEditor();
await uploadFile(SCRIPT_DOS);
await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
// request created with both OpenSCAP and first boot customization
const expectedRequest = {
...blueprintRequest,
customizations: {
filesystem: [{ min_size: 10737418240, mountpoint: '/' }],
openscap: {
profile_id: 'xccdf_org.ssgproject.content_profile_standard',
},
files: firstBootData,
// services need to contain both serviced included in the OpenSCAP profile
// and the first boot script
services: { enabled: ['crond', 'emacs-service', FIRST_BOOT_SERVICE] },
},
};
await waitFor(() => {
expect(receivedRequest).toEqual(expectedRequest);
});
});
});
describe('First Boot edit mode', () => {