Repository: fedora-infra/bodhi

Issue:
Add a log statement to masher when reusing cached updateinfo, and change generating statement to info
Basically, in https://github.com/fedora-infra/bodhi/blob/2.2.0/bodhi/server/metadata.py#L79-L81 change

```
    self._load_cached_updateinfo()
else:
    log.debug("Generating new updateinfo.xml")
```

to

```
    log.info('Restoring cached updateinfo.xml')
    self._load_cached_updateinfo()
else:
    log.info("Generating new updateinfo.xml")
```



Discussion:

Resolving patch:
diff --git a/bodhi/server/consumers/masher.py b/bodhi/server/consumers/masher.py
--- a/bodhi/server/consumers/masher.py
+++ b/bodhi/server/consumers/masher.py
@@ -218,6 +218,7 @@ def organize_updates(self, session, body):
                     self.log.info('%s request revoked' % update.title)
                     continue
                 update.locked = True
+                update.date_locked = datetime.utcnow()
                 repo = releases[update.release.name][update.request.value]
                 repo.append(update)
             else:
@@ -275,9 +276,6 @@ def results(self):
         #        src=src, dest=dest, nvr=nvr)
 
     def work(self):
-        # Update datetime for locking on update
-        self.locked_date_for_update()
-
         self.koji = buildsys.get_session()
         self.release = self.db.query(Release)\
                               .filter_by(name=self.release).one()
@@ -405,23 +403,9 @@ def unlock_updates(self):
         self.log.debug('Unlocking updates')
         for update in self.updates:
             update.locked = False
+            update.date_locked = None
         self.db.flush()
 
-    def locked_date_for_update(self):
-        """ Return the date & time when an update has been locked """
-        for update in self.updates:
-            # Return datetime when an update is locked and datetime is
-            # not yet assigned to the column date_locked
-            if update.locked and not update.date_locked:
-                update.date_locked = datetime.utcnow()
-                self.db.commit()
-                self.db.refresh(update)
-                return update.date_locked
-            # Reset the column date_locked to None when an update gets unlocked
-            elif not update.locked and update.date_locked:
-                update.date_locked = None
-                self.db.commit()
-
     def check_all_karma_thresholds(self):
         """
         If we just pushed testing updates see if any of them now meet either of
diff --git a/bodhi/server/metadata.py b/bodhi/server/metadata.py
--- a/bodhi/server/metadata.py
+++ b/bodhi/server/metadata.py
@@ -76,9 +76,10 @@ def __init__(self, release, request, db, path):
         self.cached_repodata = os.path.join(self.repo, '..', self.tag +
                                             '.repocache', 'repodata/')
         if os.path.isdir(self.cached_repodata):
+            log.info('Loading cached updateinfo.xml')
             self._load_cached_updateinfo()
         else:
-            log.debug("Generating new updateinfo.xml")
+            log.info("Generating new updateinfo.xml")
             self.uinfo = cr.UpdateInfo()
             for update in self.updates:
                 if update.alias:
@@ -278,7 +279,7 @@ def add_update(self, update):
 
     def insert_updateinfo(self):
         fd, name = tempfile.mkstemp()
-        os.write(fd, self.uinfo.xml_dump())
+        os.write(fd, self.uinfo.xml_dump().encode('utf-8'))
         os.close(fd)
         self.modifyrepo(name)
         os.unlink(name)
diff --git a/bodhi/server/services/updates.py b/bodhi/server/services/updates.py
--- a/bodhi/server/services/updates.py
+++ b/bodhi/server/services/updates.py
@@ -93,9 +93,9 @@ def get_update_for_editing(request):
     """Return a single update from an id, title, or alias for the edit form"""
     return dict(
         update=request.validated['update'],
-        types=reversed(bodhi.models.UpdateType.values()),
-        severities=sorted(bodhi.models.UpdateSeverity.values(), key=bodhi.server.util.sort_severity),
-        suggestions=reversed(bodhi.models.UpdateSuggestion.values()),
+        types=reversed(bodhi.server.models.UpdateType.values()),
+        severities=sorted(bodhi.server.models.UpdateSeverity.values(), key=bodhi.server.util.sort_severity),
+        suggestions=reversed(bodhi.server.models.UpdateSuggestion.values()),
     )
 
 


Test patch: