| |
@@ -19,6 +19,7 @@
|
| |
|
| |
Base = declarative_base()
|
| |
|
| |
+
|
| |
class Project(Base):
|
| |
|
| |
__tablename__ = 'projects'
|
| |
@@ -28,19 +29,19 @@
|
| |
status = Column(String)
|
| |
pagure_link = Column(String)
|
| |
contact = Column(String)
|
| |
-
|
| |
+
|
| |
def get_project_issues(self):
|
| |
'''Update self.status to WORKING if there are issues attached to it.'''
|
| |
|
| |
issues_url = config.API_URL + "{}/issues".format(self.name)
|
| |
issues = requests.get(issues_url)
|
| |
-
|
| |
+
|
| |
if issues.status_code == 404:
|
| |
logging.debug("Issues not found for: {}".format(self.name))
|
| |
return None
|
| |
-
|
| |
+
|
| |
issues = json.loads(issues.text)
|
| |
-
|
| |
+
|
| |
if issues['total_issues'] is not 0:
|
| |
self.update_status("WORKING")
|
| |
else:
|
| |
@@ -49,6 +50,7 @@
|
| |
def update_status(self, status):
|
| |
self.status = status
|
| |
|
| |
+
|
| |
def get_session():
|
| |
'''Return a session object to interact with the database.'''
|
| |
|
| |
@@ -56,19 +58,20 @@
|
| |
Session.configure(bind=engine)
|
| |
|
| |
return Session()
|
| |
-
|
| |
+
|
| |
+
|
| |
def setup_database():
|
| |
'''Do the initial setup of the database. This should be run once.'''
|
| |
Base.metadata.create_all(engine)
|
| |
session = get_session()
|
| |
-
|
| |
+
|
| |
logging.info("Reading in the package list...\n")
|
| |
with open('UpstreamFirstPackageList.csv', 'r') as rawlist:
|
| |
packages = rawlist.readlines()
|
| |
|
| |
# Remove the header row
|
| |
packages = packages[1:]
|
| |
-
|
| |
+
|
| |
logging.info("There are {} packages initially\n".format(len(packages)))
|
| |
for package in clean_list(packages):
|
| |
package = hawkey.split_nevra(package)
|
| |
@@ -77,17 +80,19 @@
|
| |
|
| |
session.commit()
|
| |
session.close()
|
| |
-
|
| |
+
|
| |
+
|
| |
def clean_list(package_list):
|
| |
'''Clean out the packages that won't be getting tests for Fedora.'''
|
| |
clean = []
|
| |
for package in package_list:
|
| |
pname, comment = package.split(',')
|
| |
-
|
| |
+
|
| |
if "N/A" not in comment:
|
| |
clean.append(pname)
|
| |
return clean
|
| |
|
| |
+
|
| |
def parse_fork(project):
|
| |
'''Split out the information from a fork so we can update the status of the correct
|
| |
project.
|
| |
@@ -96,6 +101,7 @@
|
| |
|
| |
return project.split('/')[2]
|
| |
|
| |
+
|
| |
def update_project(project=None, poc=None, session=None):
|
| |
'''Query the database for an existing entry, if it exists, update it.
|
| |
If it doesn't exist, ignore it (since the database is pre-seeded with
|
| |
@@ -117,18 +123,19 @@
|
| |
proj.update_status(u"MIGRATED")
|
| |
else:
|
| |
pass
|
| |
-
|
| |
+
|
| |
session.add(proj)
|
| |
session.commit()
|
| |
session.close()
|
| |
|
| |
+
|
| |
def main():
|
| |
'''Pull the data from the remote source, compare all items to what we have
|
| |
in the database and update anything that needs updated.
|
| |
'''
|
| |
|
| |
session = get_session()
|
| |
-
|
| |
+
|
| |
upstream_tests = requests.get(config.API_URL + "projects")
|
| |
upstream_tests = json.loads(upstream_tests.text)['projects']
|
| |
|
| |
@@ -149,13 +156,13 @@
|
| |
|
| |
session.commit()
|
| |
session.close()
|
| |
-
|
| |
+
|
| |
|
| |
if __name__ == '__main__':
|
| |
|
| |
parser = argparse.ArgumentParser(description='Script to update the local uf-monitor database.')
|
| |
parser.add_argument('--create', help='Initialize the database', action='store_true')
|
| |
-
|
| |
+
|
| |
engine = create_engine(config.DATASTORE, echo=False)
|
| |
|
| |
args = parser.parse_args()
|
| |
Some functionally inconsequential changes, mostly bringing this inline with other qa packages.