Skip to content

Commit

Permalink
Cobbler-API: Add endpoint for "cobbler mkloaders"
Browse files Browse the repository at this point in the history
  • Loading branch information
00Kadie00 authored and SchoolGuy committed Jul 19, 2024
1 parent 055eaed commit 8f3393c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions projects/cobbler-api/src/lib/cobbler-api.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ describe('CobblerApiService', () => {
mockRequest.flush(methodResponse);
});

it('should execute the background_mkloaders action on the Cobbler Server', () => {
// eslint-disable-next-line max-len
const methodResponse = `<?xml version='1.0'?><methodResponse><params><param><value><string>2022-09-30_203957_Create bootable bootloader images_9c809af4d6f148e49b071fac84f9a664</string></value></param></params></methodResponse>`
const result = "2022-09-30_203957_Create bootable bootloader images_9c809af4d6f148e49b071fac84f9a664"
service.backgroundMkloaders('').subscribe(value => {
expect(value).toEqual(result)
});
const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api');
mockRequest.flush(methodResponse);
});

it('should execute the background_validate_autoinstall_files action on the Cobbler Server',
() => {
// eslint-disable-next-line max-len
Expand Down
15 changes: 15 additions & 0 deletions projects/cobbler-api/src/lib/cobbler-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,21 @@ export class CobblerApiService {
})
);
}
backgroundMkloaders(token: string): Observable<string> {
const mkloadersOptions: XmlRpcStruct = {members: []}
return this.client
.methodCall('background_mkloaders', [mkloadersOptions, token])
.pipe(
map<MethodResponse | MethodFault, string>((data: MethodResponse | MethodFault) => {
if (AngularXmlrpcService.instanceOfMethodResponse(data)) {
return data.value as string;
} else if (AngularXmlrpcService.instanceOfMethodFault(data)) {
throw new Error('Mkloading files on the server in the background failed with code "' + data.faultCode
+ '" and error message "' + data.faultString + '"');
}
})
);
}

background_validate_autoinstall_files(token: string): Observable<string> {
const validateAutoinstallOptions: XmlRpcStruct = {members: []}
Expand Down

0 comments on commit 8f3393c

Please sign in to comment.