diff --git a/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts b/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts index 2869a8b..846c6e5 100644 --- a/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts +++ b/projects/cobbler-api/src/lib/cobbler-api.service.spec.ts @@ -1,8 +1,14 @@ import {TestBed} from '@angular/core/testing'; import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; -import {BackgroundBuildisoOptions, BackgroundImportOptions, BackgroundReplicateOptions} from 'cobbler-api'; -import {Distro} from './custom-types/items'; -import {Event, ExtendedVersion, InstallationStatus} from './custom-types/misc'; +import {Distro, File, Image, Mgmgtclass, Package, Profile, Repo, System} from './custom-types/items'; +import { + BackgroundBuildisoOptions, + BackgroundImportOptions, + BackgroundReplicateOptions, + Event, + ExtendedVersion, + InstallationStatus +} from './custom-types/misc'; import {COBBLER_URL} from './lib.config'; import {AngularXmlrpcService} from 'typescript-xmlrpc'; @@ -339,7 +345,7 @@ describe('CobblerApiService', () => { expect(service).toBeFalsy(); }); - it('should execute the get_distro action on the Cobbler Server', () => { + it('should execute the get_distro action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len const methodResponse = `parentdepth0ctime1721480439.039089mtime1721480439.039089uid12f034d6781946d1af0783e20684cbd4nametestcommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classesmgmt_parametersis_subobject0tree_build_time0.0archx86_64boot_loaders<<inherit>>breedinitrd/root/initrdkernel/root/kernelos_versionredhat_management_key<<inherit>>source_reposremote_boot_kernelremote_grub_kernelremote_boot_initrdremote_grub_initrdks_meta` const result: Distro = { @@ -376,44 +382,361 @@ describe('CobblerApiService', () => { } service.get_distro('', false, false, "").subscribe(value => { expect(value).toEqual(result) + done() }); const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); mockRequest.flush(methodResponse); }); - xit('should execute the get_profile action on the Cobbler Server', () => { - service.get_profile(''); - expect(service).toBeFalsy(); + it('should execute the get_profile action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth1ctime1721480439.3090012mtime1721480439.3090012uid5f01667614244fcd9c7ca7fa59c7def1nametestprofcommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0autoinstall<<inherit>>boot_loaders<<inherit>>dhcp_tagdistrotestenable_ipxe<<inherit>>enable_menu<<inherit>>name_serversname_servers_searchnext_server_v4<<inherit>>next_server_v6<<inherit>>filenameproxy<<inherit>>redhat_management_key<<inherit>>reposserver<<inherit>>menuvirt_auto_boot<<inherit>>virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_typexenpvkickstart<<inherit>>ks_meta<<inherit>>` + const result: Profile = { + name: "testprof", + depth: 1, + mtime: 1721480439.3090012, + is_subobject: false, + boot_loaders: "<>", + autoinstall_meta: "<>", + server: "<>", + distro: "test", + comment: "", + next_server_v4: "<>", + next_server_v6: "<>", + enable_ipxe: "<>", + parent: "", + owners: "<>", + autoinstall: "<>", + uid: "5f01667614244fcd9c7ca7fa59c7def1", + virt_ram: "<>", + boot_files: "<>", + mgmt_parameters: "<>", + name_servers: [], + enable_menu: "<>", + menu: "", + ctime: 1721480439.3090012, + fetchable_files: "<>", + mgmt_classes: "<>", + kernel_options: "<>", + virt_auto_boot: "<>", + kernel_options_post: "<>", + proxy: "<>", + filename: "", + dhcp_tag: "", + redhat_management_key: "<>", + repos: [], + template_files: {}, + virt_type: "xenpv", + virt_cpus: 1, + virt_bridge: "<>", + name_servers_search: [], + virt_path: "", + virt_file_size: "<>", + virt_disk_driver: "raw", + } + service.get_profile('', false, false, "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_system action on the Cobbler Server', () => { - service.get_system(''); - expect(service).toBeFalsy(); + it('should execute the get_system action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth2ctime1721480439.5932038mtime1721480439.5932038uida3320bc9105c44f1b92ab1743d460ed8nametestsyscommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0interfacesdefaultbonding_optsbridge_optscnamesconnected_mode0dhcp_tagdns_nameif_gatewayinterface_masterinterface_typenaip_addressipv6_addressipv6_default_gatewayipv6_mtuipv6_prefixipv6_secondariesipv6_static_routesmac_addressmanagement0mtunetmaskstatic0static_routesvirt_bridge<<inherit>>ipv6_autoconfiguration0repos_enabled0autoinstall<<inherit>>boot_loaders<<inherit>>enable_ipxe<<inherit>>gatewayhostnameimageipv6_default_devicename_serversname_servers_searchnetboot_enabled0next_server_v4<<inherit>>next_server_v6<<inherit>>filename<<inherit>>power_addresspower_idpower_passpower_typepower_userpower_optionspower_identity_fileprofiletestprofproxy<<inherit>>redhat_management_key<<inherit>>server<<inherit>>statusvirt_auto_boot<<inherit>>virt_cpus<<inherit>>virt_disk_driver<<inherit>>virt_file_size<<inherit>>virt_path<<inherit>>virt_pxe_boot0virt_ram<<inherit>>virt_type<<inherit>>serial_device-1serial_baud_rate-1kickstart<<inherit>>ks_meta<<inherit>>` + const result: System = { + ctime: 1721480439.5932038, + mtime: 1721480439.5932038, + name: "testsys", + depth: 2, + comment: "", + owners: "<>", + uid: "a3320bc9105c44f1b92ab1743d460ed8", + autoinstall: "<>", + boot_files: "<>", + boot_loaders: "<>", + parent: "", + is_subobject: false, + autoinstall_meta: "<>", + enable_ipxe: "<>", + fetchable_files: "<>", + filename: "<>", + gateway: "", + hostname: "", + image: "", + ipv6_autoconfiguration: false, + ipv6_default_device: "", + kernel_options: "<>", + kernel_options_post: "<>", + mgmt_classes: "<>", + mgmt_parameters: "<>", + name_servers: [], + name_servers_search: [], + netboot_enabled: false, + next_server_v4: "<>", + next_server_v6: "<>", + power_address: "", + power_id: "", + power_identity_file: "", + power_options: "", + power_pass: "", + power_type: "", + power_user: "", + profile: "testprof", + proxy: "<>", + redhat_management_key: "<>", + repos_enabled: false, + server: "<>", + serial_baud_rate: -1, + serial_device : -1, + status: "", + virt_auto_boot: "<>", + virt_disk_driver: "<>", + virt_path: "<>", + virt_ram: "<>", + virt_type: "<>", + virt_file_size: "<>", + virt_cpus: "<>", + virt_pxe_boot: false, + template_files: {}, + interfaces: { + default: { + bonding_opts: '', + bridge_opts: '', + cnames: [], + connected_mode: false, + dhcp_tag: '', + dns_name: '', + if_gateway: '', + interface_master: '', + interface_type: 'na', + ip_address: '', + ipv6_address: '', + ipv6_default_gateway: '', + ipv6_mtu: '', + ipv6_prefix: '', + ipv6_secondaries: [], + ipv6_static_routes: [], + mac_address: '', + management: false, + mtu: '', + netmask: '', + static: false, + static_routes: [], + virt_bridge: '<>', + } + }, + } + service.get_system('', false, false, "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_repo action on the Cobbler Server', () => { - service.get_repo(''); - expect(service).toBeFalsy(); + it('should execute the get_repo action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth0ctime1721480440.9711354mtime1721480440.9711354uid8b58f9b09a3e4d28965160d97a5de482nametestrepocommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0breednonearchnoneenvironmentyumoptsrsyncoptsmirror_typebaseurlapt_componentsapt_distscreaterepo_flags<<inherit>>keep_updated0mirrormirror_locally0priority0proxy<<inherit>>rpm_listos_versionks_meta` + const result: Repo = { + ctime: 1721480440.9711354, + mtime: 1721480440.9711354, + name: "testrepo", + depth: 0, + comment: "", + owners: "<>", + uid: "8b58f9b09a3e4d28965160d97a5de482", + fetchable_files: {}, + is_subobject: false, + parent: "", + kernel_options: {}, + kernel_options_post: {}, + mgmt_classes: "<>", + mgmt_parameters: {}, + arch: "none", + breed: "none", + apt_components: [], + apt_dists: [], + mirror: "", + rsyncopts: {}, + proxy: "<>", + createrepo_flags: "<>", + environment: {}, + keep_updated: false, + mirror_locally: false, + mirror_type: "baseurl", + priority: 0, + rpm_list: [], + yumopts: {}, + autoinstall_meta: {}, + boot_files: {}, + os_version: "", + template_files: {}, + } + service.get_repo('', false, false, "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_image action on the Cobbler Server', () => { - service.get_image(''); - expect(service).toBeFalsy(); + it('should execute the get_image action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth0ctime1721480441.493743mtime1721480441.493743uid911577c3691b4294acdf017e7f15f4cfnametestimagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0archx86_64autoinstall<<inherit>>breedfileimage_typedirectnetwork_count0os_versionboot_loadersmenuvirt_auto_boot0virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_type<<inherit>>kickstart<<inherit>>ks_meta` + const result: Image = { + ctime: 1721480441.493743, + mtime: 1721480441.493743, + name: "testimage", + depth: 0, + comment: "", + owners: "<>", + uid: "911577c3691b4294acdf017e7f15f4cf", + arch: "x86_64", + breed: "", + file: "", + fetchable_files: {}, + is_subobject: false, + parent: "", + kernel_options: {}, + kernel_options_post: {}, + mgmt_classes: "<>", + mgmt_parameters: {}, + autoinstall: "<>", + image_type: "direct", + network_count: 0, + os_version: "", + virt_auto_boot: false, + virt_bridge: "<>", + virt_cpus: 1, + virt_disk_driver: "raw", + virt_file_size: "<>", + virt_path: "", + virt_ram: "<>", + virt_type: "<>", + menu: "", + autoinstall_meta: {}, + boot_files: {}, + boot_loaders: [], + template_files: {}, + } + service.get_image('', false, false, "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_mgmtclass action on the Cobbler Server', () => { - service.get_mgmtclass(''); - expect(service).toBeFalsy(); + it('should execute the get_mgmtclass action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth0ctime1721480442.0213087mtime1721480442.0213087uid5a4898be6fca4d7884898fa60a64e6dcnametestmgmtclasscommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0is_definition0paramsclass_namefilespackagesks_meta` + const result: Mgmgtclass = { + ctime: 1721480442.0213087, + mtime: 1721480442.0213087, + name: "testmgmtclass", + depth: 0, + comment: "", + owners: "<>", + uid: "5a4898be6fca4d7884898fa60a64e6dc", + fetchable_files: {}, + is_subobject: false, + parent: "", + kernel_options: {}, + kernel_options_post: {}, + mgmt_classes: "<>", + mgmt_parameters: {}, + class_name: "", + files: [], + is_definition: false, + packages: [], + params: {}, + autoinstall_meta: {}, + boot_files: {}, + template_files: {}, + } + service.get_mgmtclass('', false, false, "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_package action on the Cobbler Server', () => { - service.get_package(''); - expect(service).toBeFalsy(); + it('should execute the get_package action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth0ctime1721480441.7595894mtime1721480441.7595894uida6d7ee9851d74f73b9f393f89efd4caenametestpackagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemodeownergrouppathtemplateinstallerversionks_meta` + const result: Package = { + ctime: 1721480441.7595894, + mtime: 1721480441.7595894, + name: "testpackage", + depth: 0, + comment: "", + owners: "<>", + uid: "a6d7ee9851d74f73b9f393f89efd4cae", + action: "create", + installer: "", + version: "", + mode: "", + group: "", + owner: "", + path: "", + template: "", + fetchable_files: {}, + is_subobject: false, + parent: "", + kernel_options: {}, + kernel_options_post: {}, + mgmt_classes: "<>", + mgmt_parameters: {}, + boot_files: {}, + autoinstall_meta: {}, + template_files: {}, + } + service.get_package('', false, false, "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_file action on the Cobbler Server', () => { - service.get_file(''); - expect(service).toBeFalsy(); + it('should execute the get_file action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth0ctime1721480443.0627294mtime1721480443.0627294uid650659dad2694598a14632f4a434c4a9nametestfilecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemode0644ownerrootgrouprootpath/root/testfiletemplate/etc/cobbler/dhcp.templateis_dir0ks_meta` + const result: File = { + ctime: 1721480443.0627294, + mtime: 1721480443.0627294, + name: "testfile", + depth: 0, + comment: "", + owners: "<>", + uid: "650659dad2694598a14632f4a434c4a9", + owner: "root", + action: "create", + group: "root", + is_dir: false, + mode: "0644", + path: "/root/testfile", + template: "/etc/cobbler/dhcp.template", + fetchable_files: {}, + is_subobject: false, + kernel_options: {}, + kernel_options_post: {}, + mgmt_classes: "<>", + mgmt_parameters: {}, + template_files: {}, + autoinstall_meta: {}, + boot_files: {}, + parent: "", + } + service.get_file('', false, false, "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); xit('should execute the get_items action on the Cobbler Server', () => { @@ -421,18 +744,19 @@ describe('CobblerApiService', () => { expect(service).toBeFalsy(); }); - it('should execute the get_item_names action on the Cobbler Server', () => { + it('should execute the get_item_names action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len const methodResponse = `testdistro` const result = ["testdistro"] service.get_item_names('distro').subscribe(value => { expect(value).toEqual(result) + done() }); const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); mockRequest.flush(methodResponse); }); - it('should execute the get_distros action on the Cobbler Server', () => { + it('should execute the get_distros action on the Cobbler Server', (done: DoneFn) => { // eslint-disable-next-line max-len const methodResponse = `parentdepth0ctime1721480439.039089mtime1721480439.039089uid12f034d6781946d1af0783e20684cbd4nametestcommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classesmgmt_parametersis_subobject0tree_build_time0.0archx86_64boot_loaders<<inherit>>breedinitrd/root/initrdkernel/root/kernelos_versionredhat_management_key<<inherit>>source_reposremote_boot_kernelremote_grub_kernelremote_boot_initrdremote_grub_initrdks_meta` const result: Array = [ @@ -471,44 +795,375 @@ describe('CobblerApiService', () => { ] service.get_distros().subscribe(value => { expect(value).toEqual(result) + done() }); const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); mockRequest.flush(methodResponse); }); - xit('should execute the get_profiles action on the Cobbler Server', () => { - service.get_profiles(); - expect(service).toBeFalsy(); + it('should execute the get_profiles action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth1ctime1721480439.3090012mtime1721480439.3090012uid5f01667614244fcd9c7ca7fa59c7def1nametestprofcommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0autoinstall<<inherit>>boot_loaders<<inherit>>dhcp_tagdistrotestenable_ipxe<<inherit>>enable_menu<<inherit>>name_serversname_servers_searchnext_server_v4<<inherit>>next_server_v6<<inherit>>filenameproxy<<inherit>>redhat_management_key<<inherit>>reposserver<<inherit>>menuvirt_auto_boot<<inherit>>virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_typexenpvkickstart<<inherit>>ks_meta<<inherit>>` + const result: Array = [ + { + name: "testprof", + depth: 1, + mtime: 1721480439.3090012, + is_subobject: false, + boot_loaders: "<>", + autoinstall_meta: "<>", + server: "<>", + distro: "test", + comment: "", + next_server_v4: "<>", + next_server_v6: "<>", + enable_ipxe: "<>", + parent: "", + owners: "<>", + autoinstall: "<>", + uid: "5f01667614244fcd9c7ca7fa59c7def1", + virt_ram: "<>", + boot_files: "<>", + mgmt_parameters: "<>", + name_servers: [], + enable_menu: "<>", + menu: "", + ctime: 1721480439.3090012, + fetchable_files: "<>", + mgmt_classes: "<>", + kernel_options: "<>", + virt_auto_boot: "<>", + kernel_options_post: "<>", + proxy: "<>", + filename: "", + dhcp_tag: "", + redhat_management_key: "<>", + repos: [], + template_files: {}, + virt_type: "xenpv", + virt_cpus: 1, + virt_bridge: "<>", + name_servers_search: [], + virt_path: "", + virt_file_size: "<>", + virt_disk_driver: "raw", + } + ] + service.get_profiles().subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_systems action on the Cobbler Server', () => { - service.get_systems(); - expect(service).toBeFalsy(); + it('should execute the get_systems action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth2ctime1721480439.5932038mtime1721480439.5932038uida3320bc9105c44f1b92ab1743d460ed8nametestsyscommentkernel_options<<inherit>>kernel_options_post<<inherit>>autoinstall_meta<<inherit>>fetchable_files<<inherit>>boot_files<<inherit>>template_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parameters<<inherit>>is_subobject0interfacesdefaultbonding_optsbridge_optscnamesconnected_mode0dhcp_tagdns_nameif_gatewayinterface_masterinterface_typenaip_addressipv6_addressipv6_default_gatewayipv6_mtuipv6_prefixipv6_secondariesipv6_static_routesmac_addressmanagement0mtunetmaskstatic0static_routesvirt_bridge<<inherit>>ipv6_autoconfiguration0repos_enabled0autoinstall<<inherit>>boot_loaders<<inherit>>enable_ipxe<<inherit>>gatewayhostnameimageipv6_default_devicename_serversname_servers_searchnetboot_enabled0next_server_v4<<inherit>>next_server_v6<<inherit>>filename<<inherit>>power_addresspower_idpower_passpower_typepower_userpower_optionspower_identity_fileprofiletestprofproxy<<inherit>>redhat_management_key<<inherit>>server<<inherit>>statusvirt_auto_boot<<inherit>>virt_cpus<<inherit>>virt_disk_driver<<inherit>>virt_file_size<<inherit>>virt_path<<inherit>>virt_pxe_boot0virt_ram<<inherit>>virt_type<<inherit>>serial_device-1serial_baud_rate-1kickstart<<inherit>>ks_meta<<inherit>>` + const result: Array = [ + { + ctime: 1721480439.5932038, + mtime: 1721480439.5932038, + name: "testsys", + depth: 2, + comment: "", + owners: "<>", + uid: "a3320bc9105c44f1b92ab1743d460ed8", + autoinstall: "<>", + boot_files: "<>", + boot_loaders: "<>", + parent: "", + is_subobject: false, + autoinstall_meta: "<>", + enable_ipxe: "<>", + fetchable_files: "<>", + filename: "<>", + gateway: "", + hostname: "", + image: "", + ipv6_autoconfiguration: false, + ipv6_default_device: "", + kernel_options: "<>", + kernel_options_post: "<>", + mgmt_classes: "<>", + mgmt_parameters: "<>", + name_servers: [], + name_servers_search: [], + netboot_enabled: false, + next_server_v4: "<>", + next_server_v6: "<>", + power_address: "", + power_id: "", + power_identity_file: "", + power_options: "", + power_pass: "", + power_type: "", + power_user: "", + profile: "testprof", + proxy: "<>", + redhat_management_key: "<>", + repos_enabled: false, + server: "<>", + serial_baud_rate: -1, + serial_device: -1, + status: "", + virt_auto_boot: "<>", + virt_disk_driver: "<>", + virt_path: "<>", + virt_ram: "<>", + virt_type: "<>", + virt_file_size: "<>", + virt_cpus: "<>", + virt_pxe_boot: false, + template_files: {}, + interfaces: { + default: { + bonding_opts: '', + bridge_opts: '', + cnames: [], + connected_mode: false, + dhcp_tag: '', + dns_name: '', + if_gateway: '', + interface_master: '', + interface_type: 'na', + ip_address: '', + ipv6_address: '', + ipv6_default_gateway: '', + ipv6_mtu: '', + ipv6_prefix: '', + ipv6_secondaries: [], + ipv6_static_routes: [], + mac_address: '', + management: false, + mtu: '', + netmask: '', + static: false, + static_routes: [], + virt_bridge: '<>', + } + } + } + ] + service.get_systems().subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_repos action on the Cobbler Server', () => { - service.get_repos(); - expect(service).toBeFalsy(); + it('should execute the get_repos action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth0ctime1721480440.9711354mtime1721480440.9711354uid8b58f9b09a3e4d28965160d97a5de482nametestrepocommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0breednonearchnoneenvironmentyumoptsrsyncoptsmirror_typebaseurlapt_componentsapt_distscreaterepo_flags<<inherit>>keep_updated0mirrormirror_locally0priority0proxy<<inherit>>rpm_listos_versionks_meta` + const result: Array = [ + { + ctime: 1721480440.9711354, + mtime: 1721480440.9711354, + name: "testrepo", + depth: 0, + comment: "", + owners: "<>", + uid: "8b58f9b09a3e4d28965160d97a5de482", + fetchable_files: {}, + is_subobject: false, + parent: "", + kernel_options: {}, + kernel_options_post: {}, + mgmt_classes: "<>", + mgmt_parameters: {}, + arch: "none", + breed: "none", + apt_components: [], + apt_dists: [], + mirror: "", + rsyncopts: {}, + proxy: "<>", + createrepo_flags: "<>", + environment: {}, + keep_updated: false, + mirror_locally: false, + mirror_type: "baseurl", + priority: 0, + rpm_list: [], + yumopts: {}, + autoinstall_meta: {}, + boot_files: {}, + os_version: "", + template_files: {}, + } + ] + service.get_repos().subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_images action on the Cobbler Server', () => { - service.get_images(); - expect(service).toBeFalsy(); + it('should execute the get_images action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth0ctime1721480441.493743mtime1721480441.493743uid911577c3691b4294acdf017e7f15f4cfnametestimagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0archx86_64autoinstall<<inherit>>breedfileimage_typedirectnetwork_count0os_versionboot_loadersmenuvirt_auto_boot0virt_bridge<<inherit>>virt_cpus1virt_disk_driverrawvirt_file_size<<inherit>>virt_pathvirt_ram<<inherit>>virt_type<<inherit>>kickstart<<inherit>>ks_meta` + const result: Array = [ + { + ctime: 1721480441.493743, + mtime: 1721480441.493743, + name: "testimage", + depth: 0, + comment: "", + owners: "<>", + uid: "911577c3691b4294acdf017e7f15f4cf", + arch: "x86_64", + breed: "", + file: "", + fetchable_files: {}, + is_subobject: false, + parent: "", + kernel_options: {}, + kernel_options_post: {}, + mgmt_classes: "<>", + mgmt_parameters: {}, + autoinstall: "<>", + image_type: "direct", + network_count: 0, + os_version: "", + virt_auto_boot: false, + virt_bridge: "<>", + virt_cpus: 1, + virt_disk_driver: "raw", + virt_file_size: "<>", + virt_path: "", + virt_ram: "<>", + virt_type: "<>", + menu: "", + autoinstall_meta: {}, + boot_files: {}, + boot_loaders: [], + template_files: {}, + } + ] + service.get_images().subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_mgmtclasses action on the Cobbler Server', () => { - service.get_mgmtclasses(); - expect(service).toBeFalsy(); + it('should execute the get_mgmtclasses action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth0ctime1721480442.0213087mtime1721480442.0213087uid5a4898be6fca4d7884898fa60a64e6dcnametestmgmtclasscommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0is_definition0paramsclass_namefilespackagesks_meta` + const result: Array = [ + { + ctime: 1721480442.0213087, + mtime: 1721480442.0213087, + name: "testmgmtclass", + depth: 0, + comment: "", + owners: "<>", + uid: "5a4898be6fca4d7884898fa60a64e6dc", + fetchable_files: {}, + is_subobject: false, + parent: "", + kernel_options: {}, + kernel_options_post: {}, + mgmt_classes: "<>", + mgmt_parameters: {}, + class_name: "", + files: [], + is_definition: false, + packages: [], + params: {}, + autoinstall_meta: {}, + boot_files: {}, + template_files: {}, + } + ] + service.get_mgmtclasses().subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_packages action on the Cobbler Server', () => { - service.get_packages(); - expect(service).toBeFalsy(); + it('should execute the get_packages action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth0ctime1721480441.7595894mtime1721480441.7595894uida6d7ee9851d74f73b9f393f89efd4caenametestpackagecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemodeownergrouppathtemplateinstallerversionks_meta` + const result: Array = [ + { + ctime: 1721480441.7595894, + mtime: 1721480441.7595894, + name: "testpackage", + depth: 0, + comment: "", + owners: "<>", + uid: "a6d7ee9851d74f73b9f393f89efd4cae", + action: "create", + installer: "", + version: "", + mode: "", + group: "", + owner: "", + path: "", + template: "", + fetchable_files: {}, + is_subobject: false, + parent: "", + kernel_options: {}, + kernel_options_post: {}, + mgmt_classes: "<>", + mgmt_parameters: {}, + boot_files: {}, + autoinstall_meta: {}, + template_files: {}, + } + ] + service.get_packages().subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_files action on the Cobbler Server', () => { - service.get_files(); - expect(service).toBeFalsy(); + it('should execute the get_files action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `parentdepth0ctime1721480443.0627294mtime1721480443.0627294uid650659dad2694598a14632f4a434c4a9nametestfilecommentkernel_optionskernel_options_postautoinstall_metafetchable_filesboot_filestemplate_filesowners<<inherit>>mgmt_classes<<inherit>>mgmt_parametersis_subobject0actioncreatemode0644ownerrootgrouprootpath/root/testfiletemplate/etc/cobbler/dhcp.templateis_dir0ks_meta` + const result: Array = [ + { + ctime: 1721480443.0627294, + mtime: 1721480443.0627294, + name: "testfile", + depth: 0, + comment: "", + owners: "<>", + uid: "650659dad2694598a14632f4a434c4a9", + owner: "root", + action: "create", + group: "root", + is_dir: false, + mode: "0644", + path: "/root/testfile", + template: "/etc/cobbler/dhcp.template", + fetchable_files: {}, + is_subobject: false, + kernel_options: {}, + kernel_options_post: {}, + mgmt_classes: "<>", + mgmt_parameters: {}, + template_files: {}, + autoinstall_meta: {}, + boot_files: {}, + parent: "", + } + ] + service.get_files().subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); xit('should execute the find_items action on the Cobbler Server', () => { @@ -571,44 +1226,100 @@ describe('CobblerApiService', () => { expect(service).toBeFalsy(); }); - xit('should execute the get_distro_handle action on the Cobbler Server', () => { - service.get_distro_handle('', ''); - expect(service).toBeFalsy(); + it('should execute the get_distro_handle action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `distro::test` + const result = "distro::test" + service.get_distro_handle("", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_profile_handle action on the Cobbler Server', () => { - service.get_profile_handle('', ''); - expect(service).toBeFalsy(); + it('should execute the get_profile_handle action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `profile::testprof` + const result = "profile::testprof" + service.get_profile_handle("", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_system_handle action on the Cobbler Server', () => { - service.get_system_handle('', ''); - expect(service).toBeFalsy(); + it('should execute the get_system_handle action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `distro::testdistro` + const result = "distro::testdistro" + service.get_system_handle("", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_repo_handle action on the Cobbler Server', () => { - service.get_repo_handle('', ''); - expect(service).toBeFalsy(); + it('should execute the get_repo_handle action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `repo::testrepo` + const result = "repo::testrepo" + service.get_repo_handle("", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_image_handle action on the Cobbler Server', () => { - service.get_image_handle('', ''); - expect(service).toBeFalsy(); + it('should execute the get_image_handle action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `image::testimage` + const result = "image::testimage" + service.get_image_handle("", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_mgmtclass_handle action on the Cobbler Server', () => { - service.get_mgmtclass_handle('', ''); - expect(service).toBeFalsy(); + it('should execute the get_mgmtclass_handle action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `mgmtclass::testmgmtclass` + const result = "mgmtclass::testmgmtclass" + service.get_mgmtclass_handle("", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_package_handle action on the Cobbler Server', () => { - service.get_package_handle('', ''); - expect(service).toBeFalsy(); + it('should execute the get_package_handle action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `package::testpackage` + const result = "package::testpackage" + service.get_package_handle("", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_file_handle action on the Cobbler Server', () => { - service.get_file_handle('', ''); - expect(service).toBeFalsy(); + it('should execute the get_file_handle action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `file::testfile` + const result = "file::testfile" + service.get_file_handle("", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); xit('should execute the remove_item action on the Cobbler Server', () => { @@ -616,44 +1327,100 @@ describe('CobblerApiService', () => { expect(service).toBeFalsy(); }); - xit('should execute the remove_distro action on the Cobbler Server', () => { - service.remove_distro('', '', true); - expect(service).toBeFalsy(); + it('should execute the remove_distro action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.remove_distro("", "", false).subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the remove_profile action on the Cobbler Server', () => { - service.remove_profile('', '', true); - expect(service).toBeFalsy(); + it('should execute the remove_profile action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.remove_profile("", "", false).subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the remove_system action on the Cobbler Server', () => { - service.remove_system('', '', true); - expect(service).toBeFalsy(); + it('should execute the remove_system action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.remove_system("", "", false).subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the remove_repo action on the Cobbler Server', () => { - service.remove_repo('', '', true); - expect(service).toBeFalsy(); + it('should execute the remove_repo action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.remove_repo("", "", false).subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the remove_image action on the Cobbler Server', () => { - service.remove_image('', '', true); - expect(service).toBeFalsy(); + it('should execute the remove_image action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.remove_image("", "", false).subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the remove_mgmtclass action on the Cobbler Server', () => { - service.remove_mgmtclass('', '', true); - expect(service).toBeFalsy(); + it('should execute the remove_mgmtclass action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.remove_mgmtclass("", "", false).subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the remove_package action on the Cobbler Server', () => { - service.remove_package('', '', true); - expect(service).toBeFalsy(); + it('should execute the remove_package action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.remove_package("", "", false).subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the remove_file action on the Cobbler Server', () => { - service.remove_file('', '', true); - expect(service).toBeFalsy(); + it('should execute the remove_file action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.remove_file("", "", false).subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); xit('should execute the copy_item action on the Cobbler Server', () => { @@ -661,44 +1428,100 @@ describe('CobblerApiService', () => { expect(service).toBeFalsy(); }); - xit('should execute the copy_distro action on the Cobbler Server', () => { - service.copy_distro('', '', ''); - expect(service).toBeFalsy(); + it('should execute the copy_distro action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.copy_distro("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the copy_profile action on the Cobbler Server', () => { - service.copy_profile('', '', ''); - expect(service).toBeFalsy(); + it('should execute the copy_profile action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.copy_profile("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the copy_system action on the Cobbler Server', () => { - service.copy_system('', '', ''); - expect(service).toBeFalsy(); + it('should execute the copy_system action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.copy_system("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the copy_repo action on the Cobbler Server', () => { - service.copy_repo('', '', ''); - expect(service).toBeFalsy(); + it('should execute the copy_repo action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.copy_repo("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the copy_image action on the Cobbler Server', () => { - service.copy_image('', '', ''); - expect(service).toBeFalsy(); + it('should execute the copy_image action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.copy_image("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the copy_mgmtclass action on the Cobbler Server', () => { - service.copy_mgmtclass('', '', ''); - expect(service).toBeFalsy(); + it('should execute the copy_mgmtclass action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.copy_mgmtclass("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the copy_package action on the Cobbler Server', () => { - service.copy_package('', '', ''); - expect(service).toBeFalsy(); + it('should execute the copy_package action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.copy_package("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the copy_file action on the Cobbler Server', () => { - service.copy_file('', '', ''); - expect(service).toBeFalsy(); + it('should execute the copy_file action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.copy_file("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); xit('should execute the rename_item action on the Cobbler Server', () => { @@ -706,44 +1529,100 @@ describe('CobblerApiService', () => { expect(service).toBeFalsy(); }); - xit('should execute the rename_distro action on the Cobbler Server', () => { - service.rename_distro('', '', ''); - expect(service).toBeFalsy(); + it('should execute the rename_distro action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.rename_distro("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the rename_profile action on the Cobbler Server', () => { - service.rename_profile('', '', ''); - expect(service).toBeFalsy(); + it('should execute the rename_profile action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.rename_profile("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the rename_system action on the Cobbler Server', () => { - service.rename_system('', '', ''); - expect(service).toBeFalsy(); + it('should execute the rename_system action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.rename_system("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the rename_repo action on the Cobbler Server', () => { - service.rename_repo('', '', ''); - expect(service).toBeFalsy(); + it('should execute the rename_repo action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.rename_repo("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the rename_image action on the Cobbler Server', () => { - service.rename_image('', '', ''); - expect(service).toBeFalsy(); + it('should execute the rename_image action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.rename_image("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the rename_mgmtclass action on the Cobbler Server', () => { - service.rename_mgmtclass('', '', ''); - expect(service).toBeFalsy(); + it('should execute the rename_mgmtclass action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.rename_mgmtclass("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the rename_package action on the Cobbler Server', () => { - service.rename_package('', '', ''); - expect(service).toBeFalsy(); + it('should execute the rename_package action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.rename_package("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the rename_file action on the Cobbler Server', () => { - service.rename_file('', '', ''); - expect(service).toBeFalsy(); + it('should execute the rename_file action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true + service.rename_file("", "", "").subscribe(value => { + expect(value).toEqual(result) + done() + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); xit('should execute the new_item action on the Cobbler Server', () => { @@ -902,14 +1781,28 @@ describe('CobblerApiService', () => { expect(service).toBeFalsy(); }); - xit('should execute the get_autoinstall_templates action on the Cobbler Server', () => { - service.get_autoinstall_templates(''); - expect(service).toBeFalsy(); + it('should execute the get_autoinstall_templates action on the Cobbler Server', () => { + // eslint-disable-next-line max-len + const methodResponse = `default.ksesxi4-ks.cfgesxi5-ks.cfglegacy.kspowerkvm.kspxerescue.kssample.kssample.seedsample_autoyast.xmlsample_esxi4.kssample_esxi5.kssample_esxi6.kssample_esxi7.kssample_legacy.kssample_old.seedwin.ks` + // eslint-disable-next-line max-len + const result = ["default.ks", "esxi4-ks.cfg", "esxi5-ks.cfg", "legacy.ks", "powerkvm.ks", "pxerescue.ks", "sample.ks", "sample.seed", "sample_autoyast.xml", "sample_esxi4.ks", "sample_esxi5.ks", "sample_esxi6.ks", "sample_esxi7.ks", "sample_legacy.ks", "sample_old.seed", "win.ks"] + service.get_autoinstall_templates("").subscribe(value => { + expect(value).toEqual(result) + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the get_autoinstall_snippets action on the Cobbler Server', () => { - service.get_autoinstall_snippets(''); - expect(service).toBeFalsy(); + it('should execute the get_autoinstall_snippets action on the Cobbler Server', () => { + // eslint-disable-next-line max-len + const methodResponse = `addons.xmlautoinstall_doneautoinstall_startcobbler_registerdownload_config_filesdownload_config_files_debhosts.xmlkdump.xmlkeep_cfengine_keyskeep_fileskeep_rhn_keyskeep_rudder_keyskeep_rudder_uuidkeep_ssh_host_keyskoan_environmentlate_apt_repo_configlog_ks_postlog_ks_post_nochrootlog_ks_premain_partition_selectnetwork_confignetwork_config_esxnetwork_config_esxinetworking.xmlpartition_selectpost_anamonpost_install_kernel_optionspost_install_network_configpost_install_network_config_debpost_koan_add_reinstall_entrypost_run_debpre_anamonpre_install_network_configpre_partition_selectpreseed_apt_repo_configproxy.xmlpuppet_install_if_enabledpuppet_register_if_enabledredhat_registerrestore_boot_devicesave_boot_devicesuse_scriptwrapper.xml` + // eslint-disable-next-line max-len + const result = ['addons.xml', 'autoinstall_done', 'autoinstall_start', 'cobbler_register', 'download_config_files', 'download_config_files_deb', 'hosts.xml', 'kdump.xml', 'keep_cfengine_keys', 'keep_files', 'keep_rhn_keys', 'keep_rudder_keys', 'keep_rudder_uuid', 'keep_ssh_host_keys', 'koan_environment', 'late_apt_repo_config', 'log_ks_post', 'log_ks_post_nochroot', 'log_ks_pre', 'main_partition_select', 'network_config', 'network_config_esx', 'network_config_esxi', 'networking.xml', 'partition_select', 'post_anamon', 'post_install_kernel_options', 'post_install_network_config', 'post_install_network_config_deb', 'post_koan_add_reinstall_entry', 'post_run_deb', 'pre_anamon', 'pre_install_network_config', 'pre_partition_select', 'preseed_apt_repo_config', 'proxy.xml', 'puppet_install_if_enabled', 'puppet_register_if_enabled', 'redhat_register', 'restore_boot_device', 'save_boot_device', 'suse_scriptwrapper.xml'] + service.get_autoinstall_snippets("").subscribe(value => { + expect(value).toEqual(result) + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); xit('should execute the is_autoinstall_in_use action on the Cobbler Server', () => { @@ -1274,34 +2167,82 @@ describe('CobblerApiService', () => { mockRequest.flush(methodResponse); }); - xit('should execute the read_autoinstall_template action on the Cobbler Server', () => { - service.read_autoinstall_template('', ''); - expect(service).toBeFalsy(); + it('should execute the read_autoinstall_template action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `sample content` + const result = "sample content"; + service.read_autoinstall_template('', '').subscribe( + value => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the write_autoinstall_template action on the Cobbler Server', () => { - service.write_autoinstall_template('', '', ''); - expect(service).toBeFalsy(); + it('should execute the write_autoinstall_template action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true; + service.write_autoinstall_template('', '', '').subscribe( + value => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the remove_autoinstall_template action on the Cobbler Server', () => { - service.remove_autoinstall_template('', ''); - expect(service).toBeFalsy(); + it('should execute the remove_autoinstall_template action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true; + service.remove_autoinstall_template('', '').subscribe( + value => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the read_autoinstall_snippet action on the Cobbler Server', () => { - service.read_autoinstall_snippet('', ''); - expect(service).toBeFalsy(); + it('should execute the read_autoinstall_snippet action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `sample content` + const result = "sample content"; + service.read_autoinstall_snippet('', '',).subscribe( + value => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the write_autoinstall_snippet action on the Cobbler Server', () => { - service.write_autoinstall_snippet('', '', ''); - expect(service).toBeFalsy(); + it('should execute the write_autoinstall_snippet action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true; + service.write_autoinstall_snippet('', '', '').subscribe( + value => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); - xit('should execute the remove_autoinstall_snippet action on the Cobbler Server', () => { - service.remove_autoinstall_snippet('', ''); - expect(service).toBeFalsy(); + it('should execute the remove_autoinstall_snippet action on the Cobbler Server', (done: DoneFn) => { + // eslint-disable-next-line max-len + const methodResponse = `1` + const result = true; + service.remove_autoinstall_snippet('', '').subscribe( + value => { + expect(value).toEqual(result); + done(); + }); + const mockRequest = httpTestingController.expectOne('http://localhost/cobbler_api'); + mockRequest.flush(methodResponse); }); xit('should execute the get_config_data action on the Cobbler Server', () => { diff --git a/projects/cobbler-api/src/lib/cobbler-api.service.ts b/projects/cobbler-api/src/lib/cobbler-api.service.ts index 479f76e..ef30cbd 100644 --- a/projects/cobbler-api/src/lib/cobbler-api.service.ts +++ b/projects/cobbler-api/src/lib/cobbler-api.service.ts @@ -457,7 +457,7 @@ export class CobblerApiService { private rebuildItem(xmlrpcStruct: XmlRpcStruct): object { const result = {} xmlrpcStruct.members.forEach(value => { - if (value.name === "ks_meta") { + if (value.name === "ks_meta" || value.name === "kickstart") { // Skip legacy keys return; } @@ -510,14 +510,17 @@ export class CobblerApiService { ); } - get_profile(name: string, flatten: boolean = false): Observable { + get_profile(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { return this.client - .methodCall('get_profile', [name, flatten]) + .methodCall('get_profile', [name, flatten, resolved, token]) .pipe( map((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Profile; + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error("Expected XML-RPC Struct not something else!") + } + const result = this.rebuildItem(data.value) + return result as Profile; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the requested profile failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -526,14 +529,17 @@ export class CobblerApiService { ); } - get_system(name: string, flatten: boolean = false): Observable { + get_system(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { return this.client - .methodCall('get_system', [name, flatten]) + .methodCall('get_system', [name, flatten, resolved, token]) .pipe( map((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as System; + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error("Expected XML-RPC Struct not something else!") + } + const result = this.rebuildItem(data.value) + return result as System; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the requested system failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -542,14 +548,17 @@ export class CobblerApiService { ); } - get_repo(name: string, flatten: boolean = false): Observable { + get_repo(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { return this.client - .methodCall('get_repo', [name, flatten]) + .methodCall('get_repo', [name, flatten, resolved, token]) .pipe( map((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Repo; + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error("Expected XML-RPC Struct not something else!") + } + const result = this.rebuildItem(data.value) + return result as Repo; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the requested repository failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -558,14 +567,17 @@ export class CobblerApiService { ); } - get_image(name: string, flatten: boolean = false): Observable { + get_image(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { return this.client - .methodCall('get_repo', [name, flatten]) + .methodCall('get_repo', [name, flatten, resolved, token]) .pipe( map((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Image; + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error("Expected XML-RPC Struct not something else!") + } + const result = this.rebuildItem(data.value) + return result as Image; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the requested image failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -574,14 +586,22 @@ export class CobblerApiService { ); } - get_mgmtclass(name: string, flatten: boolean = false): Observable { + get_mgmtclass( + name: string, + flatten: boolean = false, + resolved: boolean = false, + token: string + ): Observable { return this.client - .methodCall('get_repo', [name, flatten]) + .methodCall('get_repo', [name, flatten, resolved, token]) .pipe( map((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Mgmgtclass; + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error("Expected XML-RPC Struct not something else!") + } + const result = this.rebuildItem(data.value) + return result as Mgmgtclass; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the requested management class failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -590,14 +610,17 @@ export class CobblerApiService { ); } - get_package(name: string, flatten: boolean = false): Observable { + get_package(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { return this.client - .methodCall('get_repo', [name, flatten]) + .methodCall('get_repo', [name, flatten, resolved, token]) .pipe( map((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Package; + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error("Expected XML-RPC Struct not something else!") + } + const result = this.rebuildItem(data.value) + return result as Package; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the requested package failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -606,14 +629,17 @@ export class CobblerApiService { ); } - get_file(name: string, flatten: boolean = false): Observable { + get_file(name: string, flatten: boolean = false, resolved: boolean = false, token: string): Observable { return this.client - .methodCall('get_repo', [name, flatten]) + .methodCall('get_repo', [name, flatten, resolved, token]) .pipe( map((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as File; + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(data.value)) { + throw new Error("Expected XML-RPC Struct not something else!") + } + const result = this.rebuildItem(data.value) + return result as File; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the requested file failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -690,8 +716,17 @@ export class CobblerApiService { .pipe( map>((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; + if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { + throw new Error("Expected XML-RPC Array!") + } + const result = [] + data.value.data.forEach(value => { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { + throw new Error("Expected XML-RPC Struct!") + } + result.push(this.rebuildItem(value)) + }) + return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting all profiles failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -706,8 +741,17 @@ export class CobblerApiService { .pipe( map>((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; + if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { + throw new Error("Expected XML-RPC Array!") + } + const result = [] + data.value.data.forEach(value => { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { + throw new Error("Expected XML-RPC Struct!") + } + result.push(this.rebuildItem(value)) + }) + return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the systems failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -722,8 +766,17 @@ export class CobblerApiService { .pipe( map>((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; + if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { + throw new Error("Expected XML-RPC Array!") + } + const result = [] + data.value.data.forEach(value => { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { + throw new Error("Expected XML-RPC Struct!") + } + result.push(this.rebuildItem(value)) + }) + return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the repositories failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -738,8 +791,17 @@ export class CobblerApiService { .pipe( map>((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; + if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { + throw new Error("Expected XML-RPC Array!") + } + const result = [] + data.value.data.forEach(value => { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { + throw new Error("Expected XML-RPC Struct!") + } + result.push(this.rebuildItem(value)) + }) + return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the images failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -754,8 +816,17 @@ export class CobblerApiService { .pipe( map>((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; + if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { + throw new Error("Expected XML-RPC Array!") + } + const result = [] + data.value.data.forEach(value => { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { + throw new Error("Expected XML-RPC Struct!") + } + result.push(this.rebuildItem(value)) + }) + return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the management classes failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -770,8 +841,17 @@ export class CobblerApiService { .pipe( map>((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; + if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { + throw new Error("Expected XML-RPC Array!") + } + const result = [] + data.value.data.forEach(value => { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { + throw new Error("Expected XML-RPC Struct!") + } + result.push(this.rebuildItem(value)) + }) + return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the packages failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -786,8 +866,17 @@ export class CobblerApiService { .pipe( map>((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - // FIXME: Make the cast without the unknown possible - return data.value as unknown as Array; + if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { + throw new Error("Expected XML-RPC Array!") + } + const result = [] + data.value.data.forEach(value => { + if (!AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { + throw new Error("Expected XML-RPC Struct!") + } + result.push(this.rebuildItem(value)) + }) + return result as Array; } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the files failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -1983,13 +2072,16 @@ export class CobblerApiService { ); } - get_autoinstall_templates(token: string): Observable> { + get_autoinstall_templates(token: string): Observable> { return this.client .methodCall('get_autoinstall_templates', [token]) .pipe( map>((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as unknown as Array; + if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { + throw new Error("Exepcted XML-RPC Array!") + } + return this.convertXmlRpcArrayToTypeScriptArray(data.value); } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the requested auto-installation templates failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -1998,13 +2090,16 @@ export class CobblerApiService { ); } - get_autoinstall_snippets(token: string): Observable> { + get_autoinstall_snippets(token: string): Observable> { return this.client .methodCall('get_autoinstall_templates', [token]) .pipe( map>((data: MethodResponse | MethodFault) => { if (AngularXmlrpcService.instanceOfMethodResponse(data)) { - return data.value as unknown as Array; + if (!AngularXmlrpcService.instanceOfXmlRpcArray(data.value)) { + throw new Error("Expected XML-RPC Array!") + } + return this.convertXmlRpcArrayToTypeScriptArray(data.value); } else if (AngularXmlrpcService.instanceOfMethodFault(data)) { throw new Error('Getting the requested auto-installation snippets failed with code "' + data.faultCode + '" and error message "' + data.faultString + '"'); @@ -2141,6 +2236,9 @@ export class CobblerApiService { value = this.convertXmlRpcArrayToTypeScriptArray(member.value); } else if (AngularXmlrpcService.instanceOfXmlRpcStruct(member.value)) { value = this.convertXmlRpcStructToTypeScriptObject(member.value); + } else if (member.value === "<<inherit>>") { + // FIXME: Maybe we need to XML encode this as other strings potentially also could need encoding + value = "<>" } else { value = member.value; } @@ -2156,6 +2254,9 @@ export class CobblerApiService { resultArray.push(this.convertXmlRpcArrayToTypeScriptArray(value)); } else if (AngularXmlrpcService.instanceOfXmlRpcStruct(value)) { resultArray.push(this.convertXmlRpcStructToTypeScriptObject(value)); + } else if (value === "<<inherit>>") { + // FIXME: Maybe we need to XML encode this as other strings potentially also could need encoding + resultArray.push("<>") } else { resultArray.push(value); } diff --git a/projects/cobbler-api/src/lib/custom-types/items.ts b/projects/cobbler-api/src/lib/custom-types/items.ts index 107667f..2c9fbdc 100644 --- a/projects/cobbler-api/src/lib/custom-types/items.ts +++ b/projects/cobbler-api/src/lib/custom-types/items.ts @@ -11,22 +11,22 @@ export interface Distro extends Item { tree_build_time: number; arch: string; autoinstall_meta: object; - boot_files: object; + boot_files: string | object; boot_loaders: string | Array; breed: string; comment: string; parent: string; - fetchable_files: object; + fetchable_files: string | object; initrd: string; kernel: string; remote_boot_initrd: string; remote_boot_kernel: string; remote_grub_initrd: string; remote_grub_kernel: string; - kernel_options: object; - kernel_options_post: object; - mgmt_classes: Array; - mgmt_parameters: object; + kernel_options: string | object; + kernel_options_post: string | object; + mgmt_classes: string | Array; + mgmt_parameters: object | string; name: string; os_version: string; owners: string | Array; @@ -35,66 +35,100 @@ export interface Distro extends Item { } export interface Profile extends Item { + is_subobject: boolean; + boot_loaders: string | Array; autoinstall: string; - autoinstall_meta: object; - boot_files: Array; + autoinstall_meta: string | object; + boot_files: string | Array; comment: string; dhcp_tag: string; distro: string; - enable_gpxe: boolean; - enable_menu: boolean; - fetchable_files: object; - kernel_options: object; - kernel_options_post: object; - mgmt_classes: Array; - mgmt_parameters: string; + enable_ipxe: string | boolean; + enable_menu: string | boolean; + menu: string, + fetchable_files: string | object; + kernel_options: string | object; + kernel_options_post: string | object; + mgmt_classes: string | Array; + mgmt_parameters: object | string; name: string; name_servers: Array; name_servers_search: Array; - next_server: string; + next_server_v4: string; + next_server_v6: string; filename: string; - owners: Array; + owners: string | Array; parent: string; proxy: string; redhat_management_key: string; repos: Array; server: string; template_files: object; - virt_auto_boot: boolean; + virt_auto_boot: string | boolean; virt_bridge: string; - virt_cpus: number; + virt_cpus: string | number; virt_disk_driver: string; - virt_file_size: number; + virt_file_size: string | number; virt_path: string; - virt_ram: number; + virt_ram: string | number; virt_type: string; } +export interface NetworkInterface { + bonding_opts: string; + bridge_opts: string; + cnames: Array; + connected_mode: false, + dhcp_tag: string; + dns_name: string; + if_gateway: string; + interface_master: string; + interface_type: string; + ip_address: string; + ipv6_address: string; + ipv6_default_gateway: string; + ipv6_mtu: string; + ipv6_prefix: string; + ipv6_secondaries: Array; + ipv6_static_routes: Array; + mac_address: string; + management: boolean; + mtu: string; + netmask: string; + static: boolean; + static_routes: Array; + virt_bridge: string; +} + export interface System extends Item { ipv6_autoconfiguration: boolean; repos_enabled: false; autoinstall: string; - autoinstall_meta: object; - boot_files: Array; - boot_loader: string; + interfaces: { [k: string]: NetworkInterface }; + autoinstall_meta: string | object; + boot_files: string | Array; + boot_loaders: string | Array; comment: string; - enable_ipxe: boolean; - fetchable_files: object; + parent: string; + is_subobject: boolean; + enable_ipxe: string | boolean; + fetchable_files: string | object; gateway: string; hostname: string; image: string; ipv6_default_device: string; - kernel_options: object; - kernel_options_post: object; - mgmt_classes: Array; - mgmt_parameters: string; + kernel_options: string | object; + kernel_options_post: string | object; + mgmt_classes: string | Array; + mgmt_parameters: object | string; name: string; name_servers: Array; name_servers_search: Array; netboot_enabled: boolean; - next_server: string; + next_server_v4: string; + next_server_v6: string; filename: string; - owners: Array; + owners: string | Array; power_address: string; power_id: string; power_pass: string; @@ -108,33 +142,45 @@ export interface System extends Item { server: string; status: string; template_files: object; - virt_auto_boot: boolean; - virt_cpus: number; + virt_auto_boot: string | boolean; + virt_cpus: string | number; virt_disk_driver: string; - virt_file_size: number; + virt_file_size: string | number; virt_path: string; virt_pxe_boot: boolean; - virt_ram: number; + virt_ram: string | number; virt_type: string; serial_device: number; serial_baud_rate: number; } export interface Repo extends Item { + // Base Item attributes (we actually don't want them) + kernel_options: string | object; + kernel_options_post: string | object; + mgmt_classes: string | Array; + mgmt_parameters: object | string; + is_subobject: boolean; + fetchable_files: string | object; + autoinstall_meta: object; + boot_files: string | object; + template_files: object; + os_version: string; + // Real attributes parent: string; apt_components: Array; apt_dists: Array; arch: string; breed: string; comment: string; - createrepo_flags: object; + createrepo_flags: string | object; environment: object; keep_updated: boolean; mirror: string; mirror_type: string; mirror_locally: boolean; name: string; - owners: Array; + owners: string | Array; priority: number; proxy: string; rpm_list: Array; @@ -143,6 +189,18 @@ export interface Repo extends Item { } export interface File extends Item { + // Base Item attributes (we actually don't want them) + kernel_options: string | object; + kernel_options_post: string | object; + mgmt_classes: string | Array; + mgmt_parameters: object | string; + is_subobject: boolean; + fetchable_files: string | object; + parent: string; + autoinstall_meta: object; + boot_files: string | object; + template_files: object; + // Real attributes action: string; comment: string; group: string; @@ -150,12 +208,25 @@ export interface File extends Item { mode: string; name: string; owner: string; - owners: Array; + owners: string | Array; path: string; template: string; } export interface Image extends Item { + // Base Item attributes (we actually don't want them) + kernel_options: string | object; + kernel_options_post: string | object; + mgmt_classes: string | Array; + mgmt_parameters: object | string; + is_subobject: boolean; + fetchable_files: string | object; + autoinstall_meta: string | object; + boot_files: string | object; + template_files: object; + boot_loaders: string | Array; + menu: string; + // Real attributes parent: string; arch: string; autoinstall: string; @@ -166,33 +237,62 @@ export interface Image extends Item { name: string; network_count: number; os_version: string; - owners: Array; - virt_auto_boot: boolean; + owners: string | Array; + virt_auto_boot: string | boolean; virt_bridge: string; - virt_cpus: number; + virt_cpus: string | number; virt_disk_driver: string; - virt_file_size: number; + virt_file_size: string | number; virt_path: string; - virt_ram: number; + virt_ram: string | number; virt_type: string; } export interface Mgmgtclass extends Item { + // Base Item attributes (we actually don't want them) + parent: string; + kernel_options: string | object; + kernel_options_post: string | object; + mgmt_classes: string | Array; + mgmt_parameters: object | string; + is_subobject: boolean; + fetchable_files: string | object; + autoinstall_meta: object; + boot_files: string | object; + template_files: object; + // Real attributes is_definition: boolean; class_name: string; comment: string; files: Array; name: string; - owners: Array; + owners: string | Array; packages: Array; params: object; } export interface Package extends Item { + // Base Item attributes (we actually don't want them) + parent: string; + kernel_options: string | object; + kernel_options_post: string | object; + mgmt_classes: string | Array; + mgmt_parameters: object | string; + is_subobject: boolean; + fetchable_files: string | object; + autoinstall_meta: object; + boot_files: string | object; + template_files: object; + // Real attributes + mode: string; + owner: string; + group: string; + path: string; + template: string; action: string; comment: string; installer: string; name: string; - owners: Array; + owners: string | Array; version: string; }