Repository: fedora-infra/bodhi

Issue:
Can't change build in EL6 update
I just wanted to edit all my fedfind updates from fedfind-1.4.2-1.(dist) to fedfind-1.5-1.(dist). I was able to edit the updates for EL7, F21, F22 and F23, but I just can't edit the [update for EL6](https://bodhi.fedoraproject.org/updates/fedfind-1.4.2-1.el6). However I try, it fails with "Unable to create update. Invalid taginfo: "



Discussion:
Found the traceback:

``` python
2015-08-28 00:43:55,127 ERROR [bodhi][Dummy-2] Failed to create update
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/bodhi/services/updates.py", line 340, in new_update
    result, _caveats = Update.edit(request, data)
  File "/usr/lib/python2.7/site-packages/bodhi/models/models.py", line 738, in edit
    koji.tagBuild(up.release.pending_testing_tag, build)
  File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 1556, in __call__
    return self.__func(self.__name,args,opts)
  File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 1918, in _callMethod
    raise err
GenericError: Invalid tagInfo: ''
```

And.... this is a problem with our DB release configuration.  From production `pshell`:

``` python
>>> thing = m.Release.get('EL-6', db)
>>> thing
<Release {'dist_tag': u'dist-6E-epel', 'name': u'EL-6', 'testing_tag': u'dist-6E-epel-testing', 'pending_stable_tag': u'', 'long_name': u'Fedora EPEL 6', 'state': u'current', 'version': u'6', 'override_tag': u'dist-6E-epel-override', 'branch': u'el6', 'id_prefix': u'FEDORA-EPEL', 'pending_testing_tag': u'', 'stable_tag': u'dist-6E-epel', 'candidate_tag': u'dist-6E-epel-testing-candidate'}>
>>> print thing.pending_testing_tag

>>> 
```


Resolving patch:
diff --git a/bodhi/models/models.py b/bodhi/models/models.py
--- a/bodhi/models/models.py
+++ b/bodhi/models/models.py
@@ -725,7 +725,15 @@ def edit(cls, request, data):
                     b = Build(nvr=build, package=package)
                     b.release = up.release
                     db.add(b)
-                koji.tagBuild(up.release.pending_testing_tag, build)
+
+                if up.release.pending_testing_tag:
+                    koji.tagBuild(up.release.pending_testing_tag, build)
+                else:
+                    # EL6 doesn't have these, and that's okay...
+                    # We still warn in case the config gets messed up.
+                    log.warn('%s has no pending_testing_tag for %s' % (
+                        up.release.name, build.nvr))
+
                 up.builds.append(b)
 
         # Determine which builds have been removed
@@ -1074,6 +1082,10 @@ def set_request(self, action, username):
     def add_tag(self, tag):
         """ Add a koji tag to all builds in this update """
         log.debug('Adding tag %s to %s' % (tag, self.title))
+        if not tag:
+            log.warn("Not adding builds of %s to empty tag" % self.title)
+            return []  # An empty iterator in place of koji multicall
+
         koji = buildsys.get_session()
         koji.multicall = True
         for build in self.builds:
@@ -1083,6 +1095,10 @@ def add_tag(self, tag):
     def remove_tag(self, tag, koji=None):
         """ Remove a koji tag from all builds in this update """
         log.debug('Removing tag %s from %s' % (tag, self.title))
+        if not tag:
+            log.warn("Not removing builds of %s from empty tag" % self.title)
+            return []  # An empty iterator in place of koji multicall
+
         return_multicall = not koji
         if not koji:
             koji = buildsys.get_session()


Test patch: