#6 use MIGRATED file to determine repo state
Merged 6 years ago by roshi. Opened 6 years ago by tflink.
fedora-qa/ tflink/uf-monitor feature/MIGRATED-support  into  master

file modified
+1
@@ -3,3 +3,4 @@ 

  PAGURE_URL = "https://upstreamfirst.fedorainfracloud.org/"

  API_URL = PAGURE_URL + "/api/0/"

  STATUSES = [u'UNKNOWN', u'WORKING', u'MIGRATED']

+ DEFAULT_BRANCH = 'master'

file modified
+14 -8
@@ -50,6 +50,18 @@ 

      def update_status(self, status):

          self.status = status

  

+     def update_migrated_status(self):

+         '''check for the presense of a MIGRATED file'''

+         # construct url to "raw" file in pagure's interface

+         migrated_url = config.PAGURE_URL + '{}/raw/{}/f/MIGRATED'.format(self.name, config.DEFAULT_BRANCH)

+ 

+         # try to stat the file

+         migrated_request = requests.get(migrated_url)

+ 

+         if migrated_request.status_code == 200:

+             self.update_status('MIGRATED')

+         else:

+             self.update_status('WORKING')

  

  def get_session():

      '''Return a session object to interact with the database.'''
@@ -118,14 +130,8 @@ 

      if proj:

          proj.pagure_link = '{}{}'.format(config.PAGURE_URL, proj.name)

          proj.contact = str(poc)

-         # Check to see if the project is labeled as migrated and has issues filed

-         if proj.status == u"MIGRATED":

-             proj.get_project_issues()

-         # Set the status to MIGRATED because it has a project created on the forge

-         elif proj.status == u"UNKNOWN":

-             proj.update_status(u"MIGRATED")

-         else:

-             pass

+ 

+         proj.update_migrated_status()

  

          session.add(proj)

          session.commit()

changes the logic of server.py to look for a MIGRATED file in order to determine whether or not a repo has been migrated upstream

rebased onto 0006be8

6 years ago

Pull-Request has been merged by roshi

6 years ago
Metadata