def setNodeForNetworkBoot(self, session: Session, dbNode: Node) -> None: \ # pylint: disable=unused-argument # Update node status to "Expired" and boot from network dbNode.state = state.NODE_STATE_EXPIRED dbNode.bootFrom = 0 self.deletePuppetNodeCert(dbNode.name)
def activateIdleNode(self, node: Node, softwareProfileName: str, softwareProfileChanged: bool): # pylint: disable=no-self-use if softwareProfileChanged: softwareprofile = \ SoftwareProfilesDbHandler().getSoftwareProfile( self.session, softwareProfileName) # Mark node for network boot if software profile changed node.bootFrom = 0 else: softwareprofile = None self._bhm.writePXEFile( self.session, node, localboot=not softwareProfileChanged, softwareprofile=softwareprofile )
def primeDb(session: Session, settings: Dict[str, Any]): """ Prime database with initial data """ # Create node entry for installer node = Node(name=settings['fqdn']) node.state = state.NODE_STATE_INSTALLED node.lockedState = 'HardLocked' node.lastUpdate = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) node.bootFrom = 1 node.isIdle = False # Create Installer Software Profile node.softwareprofile = SoftwareProfile( name=settings['installer_software_profile'], description='Installer software profile', type='installer', minNodes=1, maxNodes=1, lockedState='HardLocked', ) node.softwareprofile.os = OperatingSystem( name=settings['osInfo'].getName(), version=settings['osInfo'].getVersion(), arch=settings['osInfo'].getArch()) node.softwareprofile.os.family = OperatingSystemFamily( name=settings['osInfo'].getOsFamilyInfo().getName(), version=settings['osInfo'].getOsFamilyInfo().getVersion(), arch=settings['osInfo'].getOsFamilyInfo().getArch()) # Create Installer Hardware Profile node.hardwareprofile = HardwareProfile( name=settings['installer_hardware_profile']) node.hardwareprofile.description = 'Installer hardware profile' node.hardwareprofile.nameFormat = 'installer' node.hardwareprofile.installType = 'package' node.hardwareprofile.setLocation = 'local' node.hardwareprofile.mappedsoftwareprofiles.append(node.softwareprofile) session.add(node)