Example #1
0
    def runCommand(self):
        self.parseArgs()

        api = SyncWsApi(username=self.getUsername(),
                        password=self.getPassword(),
                        baseurl=self.getUrl(),
                        verify=self._verify)

        api.scheduleClusterUpdate(updateReason=self.getArgs().reason)
Example #2
0
    def postAddHost(self, session: Session, hardwareProfileName: str,
                    softwareProfileName: Optional[str],
                    addHostSession: str) -> None:
        """
        Perform post add host operations
        """

        self._logger.debug(
            'postAddHost(): hardwareProfileName=[%s]'
            ' softwareProfileName=[%s] addHostSession=[%s]' % (
                hardwareProfileName, softwareProfileName, addHostSession))

        # this query is redundant; in the calling method, we already have
        # a list of Node (db) objects
        from tortuga.node.nodeApi import NodeApi
        nodes = NodeApi().getNodesByAddHostSession(session, addHostSession)

        mgr = KitActionsManager()
        mgr.session = session

        mgr.post_add_host(
            hardwareProfileName,
            softwareProfileName,
            nodes
        )

        # Always go over the web service for this call.
        SyncWsApi().scheduleClusterUpdate(updateReason='Node(s) added')
Example #3
0
    def postAddHost(self, hardwareProfileName, softwareProfileName,
                    addHostSession):
        """Perform post add host operations"""

        self.getLogger().debug(
            'postAddHost(): hardwareProfileName=[%s]'
            ' softwareProfileName=[%s] addHostSession=[%s]' %
            (hardwareProfileName, softwareProfileName, addHostSession))

        mgr = KitActionsManager()

        mgr.post_add_host(hardwareProfileName, softwareProfileName,
                          addHostSession)

        # Always go over the web service for this call.
        SyncWsApi().scheduleClusterUpdate(updateReason='Node(s) added')
Example #4
0
 def _event_tags_changed(self, node_old: Node, node: Node):
     if node_old.tags != node.tags:
         NodeTagsChanged.fire(node_id=str(node.id),
                              node_name=node.name,
                              tags=node.tags,
                              previous_tags=node_old.tags)
         opts = {}
         opts['node'] = {
             'id': str(node.id),
             'tags': node.tags,
             'previous_tags': node_old.tags
         }
         logger.debug(
             'Triggering cluster update with tags parameter: {}'.format(
                 opts))
         SyncWsApi().scheduleClusterUpdate(updateReason='Node tags updated',
                                           opts=opts)
Example #5
0
 def _event_tags_changed(self, swp_old: SoftwareProfile,
                         swp: SoftwareProfile):
     if swp_old.tags != swp.tags:
         SoftwareProfileTagsChanged.fire(softwareprofile_id=str(swp.id),
                                         softwareprofile_name=swp.name,
                                         tags=swp.tags,
                                         previous_tags=swp_old.tags)
         opts = {}
         opts['software_profile'] = {
             'id': str(swp.id),
             'name': swp.name,
             'tags': swp.tags,
             'previous_tags': swp_old.tags
         }
         logger.debug(
             'Triggering cluster update with tags parameter: {}'.format(
                 opts))
         SyncWsApi().scheduleClusterUpdate(
             updateReason='Software profile tags updated', opts=opts)