#513 Delete empty kerberos class and function with their context
Merged 4 years ago by gnaponie. Opened 4 years ago by apaplaus.
apaplaus/freshmaker removing-krbContext  into  master

@@ -32,7 +32,7 @@ 

  from freshmaker.models import ArtifactBuildState

  from freshmaker.types import EventState

  from freshmaker.models import ArtifactBuild, Event

- from freshmaker.utils import krb_context, get_rebuilt_nvr

+ from freshmaker.utils import get_rebuilt_nvr

  from freshmaker.errors import UnprocessableEntity, ProgrammingError

  from freshmaker.odcsclient import create_odcs_client, FreshmakerODCSClient

  from freshmaker.odcsclient import COMPOSE_STATES
@@ -572,8 +572,7 @@ 

                  'state': COMPOSE_STATES['done'],

              }

  

-         with krb_context():

-             return create_odcs_client().get_compose(compose_id)

+         return create_odcs_client().get_compose(compose_id)

  

      def get_repo_urls(self, build):

          """

file modified
+1 -2
@@ -335,8 +335,7 @@ 

              log.debug('Logging into %s with Kerberos authentication.',

                        service.server)

  

-             with freshmaker.utils.krb_context():

-                 service.krb_login()

+             service.krb_login()

  

              # We are not logged in in dry run mode...

              if not dry_run and not service.logged_in:

file modified
+3 -4
@@ -36,7 +36,7 @@ 

  

  from freshmaker import db, log

  from freshmaker import messaging

- from freshmaker.utils import get_url_for, krb_context

+ from freshmaker.utils import get_url_for

  from freshmaker.types import (ArtifactType, ArtifactBuildState, EventState,

                                RebuildReason)

  from freshmaker.events import (
@@ -707,9 +707,8 @@ 

      @property

      def finished(self):

          from freshmaker.odcsclient import create_odcs_client

-         with krb_context():

-             return 'done' == create_odcs_client().get_compose(

-                 self.odcs_compose_id)['state_name']

+         return 'done' == create_odcs_client().get_compose(

+             self.odcs_compose_id)['state_name']

  

      @classmethod

      def get_lowest_compose_id(cls, session):

file modified
+9 -13
@@ -44,7 +44,6 @@ 

  from freshmaker.kojiservice import koji_service

  from freshmaker.consumer import work_queue_put

  from freshmaker.types import ArtifactBuildState

- from freshmaker.utils import krb_context

  from freshmaker.events import ODCSComposeStateChangeEvent

  

  
@@ -268,10 +267,9 @@ 

              compose_source, 'tag', packages)

  

          if not self.handler.dry_run:

-             with krb_context():

-                 new_compose = create_odcs_client().new_compose(

-                     compose_source, 'tag', packages=packages,

-                     sigkeys=conf.odcs_sigkeys, flags=["no_deps"])

+             new_compose = create_odcs_client().new_compose(

+                 compose_source, 'tag', packages=packages,

+                 sigkeys=conf.odcs_sigkeys, flags=["no_deps"])

          else:

              new_compose = self._fake_odcs_new_compose(

                  compose_source, 'tag', packages=packages)
@@ -296,9 +294,8 @@ 

  

          odcs = create_odcs_client()

          if not self.handler.dry_run:

-             with krb_context():

-                 new_compose = odcs.new_compose(

-                     ' '.join(content_sets), 'pulp')

+             new_compose = odcs.new_compose(

+                 ' '.join(content_sets), 'pulp')

          else:

              new_compose = self._fake_odcs_new_compose(

                  content_sets, 'pulp')
@@ -350,11 +347,10 @@ 

          arches = sorted(image['arches'].split())

  

          if not self.handler.dry_run:

-             with krb_context():

-                 new_compose = create_odcs_client().new_compose(

-                     "", 'build', packages=packages, builds=builds,

-                     arches=arches, sigkeys=conf.odcs_sigkeys,

-                     flags=["no_deps"])

+             new_compose = create_odcs_client().new_compose(

+                 "", 'build', packages=packages, builds=builds,

+                 arches=arches, sigkeys=conf.odcs_sigkeys,

+                 flags=["no_deps"])

          else:

              new_compose = self._fake_odcs_new_compose(

                  "", 'build', packages=packages,

file modified
-12
@@ -116,18 +116,6 @@ 

      return rebuilt_nvr

  

  

- class krbContext(object):

-     def __enter__(self):

-         return self

- 

-     def __exit__(self, exc_type, exc_value, traceback):

-         pass

- 

- 

- def krb_context():

-     return krbContext()

- 

- 

  def load_class(location):

      """ Take a string of the form 'fedmsg.consumers.ircbot:IRCBotConsumer'

      and return the IRCBotConsumer class.

file modified
-9
@@ -82,15 +82,6 @@ 

  

  class FreshmakerTestCase(unittest.TestCase):

  

-     def setUp(self):

-         # We don't have any valid Kerberos context during the tests, so disable

-         # it by default by patching it.

-         self.krb_context_patcher = patch('freshmaker.utils.krbContext')

-         self.krb_context_patcher.start()

- 

-     def tearDown(self):

-         self.krb_context_patcher.stop()

- 

      def get_event_from_msg(self, message):

          event = events.BaseEvent.from_fedmsg(message['body']['topic'], message['body'])

          return event