Exemplo n.º 1
0
def check_or_update_tool_shed_status_for_installed_repository( app, repository ):
    updated = False
    tool_shed_status_dict = suc.get_tool_shed_status_for_installed_repository( app, repository )
    if tool_shed_status_dict:
        ok = True
        if tool_shed_status_dict != repository.tool_shed_status:
            repository.tool_shed_status = tool_shed_status_dict
            app.install_model.context.add( repository )
            app.install_model.context.flush()
            updated = True
    else:
        ok = False
    return ok, updated
Exemplo n.º 2
0
def check_or_update_tool_shed_status_for_installed_repository( app, repository ):
    updated = False
    tool_shed_status_dict = suc.get_tool_shed_status_for_installed_repository( app, repository )
    if tool_shed_status_dict:
        ok = True
        if tool_shed_status_dict != repository.tool_shed_status:
            repository.tool_shed_status = tool_shed_status_dict
            app.install_model.context.add( repository )
            app.install_model.context.flush()
            updated = True
    else:
        ok = False
    return ok, updated
Exemplo n.º 3
0
 def update_repository_record( self, repository, updated_metadata_dict, updated_changeset_revision, updated_ctx_rev ):
     """
     Update a tool_shed_repository database record with new information retrieved from the
     Tool Shed.  This happens when updating an installed repository to a new changeset revision.
     """
     repository.metadata = updated_metadata_dict
     # Update the repository.changeset_revision column in the database.
     repository.changeset_revision = updated_changeset_revision
     repository.ctx_rev = updated_ctx_rev
     # Update the repository.tool_shed_status column in the database.
     tool_shed_status_dict = suc.get_tool_shed_status_for_installed_repository( self.app, repository )
     if tool_shed_status_dict:
         repository.tool_shed_status = tool_shed_status_dict
     else:
         repository.tool_shed_status = None
     self.app.install_model.context.add( repository )
     self.app.install_model.context.flush()
     self.app.install_model.context.refresh( repository )
     return repository
Exemplo n.º 4
0
 def update_repository_record( self, repository, updated_metadata_dict, updated_changeset_revision, updated_ctx_rev ):
     """
     Update a tool_shed_repository database record with new information retrieved from the
     Tool Shed.  This happens when updating an installed repository to a new changeset revision.
     """
     repository.metadata = updated_metadata_dict
     # Update the repository.changeset_revision column in the database.
     repository.changeset_revision = updated_changeset_revision
     repository.ctx_rev = updated_ctx_rev
     # Update the repository.tool_shed_status column in the database.
     tool_shed_status_dict = suc.get_tool_shed_status_for_installed_repository( self.app, repository )
     if tool_shed_status_dict:
         repository.tool_shed_status = tool_shed_status_dict
     else:
         repository.tool_shed_status = None
     self.app.install_model.context.add( repository )
     self.app.install_model.context.flush()
     self.app.install_model.context.refresh( repository )
     return repository
Exemplo n.º 5
0
 def __restarter( self ):
     log.info( 'Update manager restarter starting up...' )
     while self.running:
         # Make a call to the tool shed for each installed repository to get the latest status information in the tool shed for the
         # repository.  This information includes items like newer installable repository revisions, current revision updates, whether
         # the repository revision is the latest installable revision, and whether the repository has been deprecated in the tool shed.
         for repository in self.context.query( self.app.install_model.ToolShedRepository ) \
                                       .filter( self.app.install_model.ToolShedRepository.table.c.deleted == False ):
             tool_shed_status_dict = suc.get_tool_shed_status_for_installed_repository( self.app, repository )
             if tool_shed_status_dict:
                 if tool_shed_status_dict != repository.tool_shed_status:
                     repository.tool_shed_status = tool_shed_status_dict
                     self.context.flush()
             else:
                 # The received tool_shed_status_dict is an empty dictionary, so coerce to None.
                 tool_shed_status_dict = None
                 if tool_shed_status_dict != repository.tool_shed_status:
                     repository.tool_shed_status = tool_shed_status_dict
                     self.context.flush()
         self.sleeper.sleep( self.seconds_to_sleep )
     log.info( 'Update manager restarter shutting down...' )
 def __restarter( self ):
     log.info( 'Update repository manager restarter starting up...' )
     while self.running:
         # Make a call to the Tool Shed for each installed repository to get the latest
         # status information in the Tool Shed for the repository.  This information includes
         # items like newer installable repository revisions, current revision updates, whether
         # the repository revision is the latest installable revision, and whether the repository
         # has been deprecated in the Tool Shed.
         for repository in self.context.query( self.app.install_model.ToolShedRepository ) \
                                       .filter( self.app.install_model.ToolShedRepository.table.c.deleted == false() ):
             tool_shed_status_dict = suc.get_tool_shed_status_for_installed_repository( self.app, repository )
             if tool_shed_status_dict:
                 if tool_shed_status_dict != repository.tool_shed_status:
                     repository.tool_shed_status = tool_shed_status_dict
                     self.context.flush()
             else:
                 # The received tool_shed_status_dict is an empty dictionary, so coerce to None.
                 tool_shed_status_dict = None
                 if tool_shed_status_dict != repository.tool_shed_status:
                     repository.tool_shed_status = tool_shed_status_dict
                     self.context.flush()
         self.sleeper.sleep( self.seconds_to_sleep )
     log.info( 'Update repository manager restarter shutting down...' )