← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1537401] [NEW] keystone gate failing test_get_token_id_error_handling

 

Public bug reported:

the test_get_token_id_error_handling test started to fail on jan 23,
2016

traceback from test:
Traceback (most recent call last):
  File "keystone/tests/unit/test_token_provider.py", line 825, in test_get_token_id_error_handling
    token_data)
  File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 422, in assertRaises
    self.assertThat(our_callable, matcher)
  File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 433, in assertThat
    mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
  File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 483, in _matchHelper
    mismatch = matcher.match(matchee)
  File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 108, in match
    mismatch = self.exception_matcher.match(exc_info)
  File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_higherorder.py", line 62, in match
    mismatch = matcher.match(matchee)
  File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 414, in match
    reraise(*matchee)
  File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 101, in match
    result = matchee()
  File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 969, in __call__
    return self._callable_object(*self._args, **self._kwargs)
  File "keystone/token/providers/pki.py", line 49, in _get_token_id
    CONF.signing.keyfile))
  File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/keystoneclient/common/cms.py", line 378, in cms_sign_token
    message_digest=message_digest)
  File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/keystoneclient/common/cms.py", line 359, in cms_sign_data
    process, data, (signing_cert_file_name, signing_key_file_name))
  File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/keystoneclient/common/cms.py", line 100, in _process_communicate_handle_oserror
    output, err = process.communicate(data)
  File "/usr/lib/python2.7/subprocess.py", line 799, in communicate
    return self._communicate(input)
  File "/usr/lib/python2.7/subprocess.py", line 1401, in _communicate
    stdout, stderr = self._communicate_with_poll(input)
  File "/usr/lib/python2.7/subprocess.py", line 1431, in _communicate_with_poll
    poller = select.poll()
AttributeError: 'module' object has no attribute 'poll'


The test is seen below or here: https://github.com/openstack/keystone/blob/master/keystone/tests/unit/test_token_provider.py#L816

    def test_get_token_id_error_handling(self):
        # cause command-line failure
        self.config_fixture.config(group='signing',
                                   keyfile='--please-break-me')

        provider = pki.Provider()
        token_data = {}
        self.assertRaises(exception.UnexpectedError,
                          provider._get_token_id,
                          token_data)

the function that calls subprocess is as follows:
https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/common/cms.py#L96

def _process_communicate_handle_oserror(process, data, files):
    """Wrapper around process.communicate that checks for OSError."""

    try:
        output, err = process.communicate(data)
    except OSError as e:
        if e.errno != errno.EPIPE:
            raise
        # OSError with EPIPE only occurs with old Python 2.7.x versions
        # http://bugs.python.org/issue10963

        # The quick exit is typically caused by the openssl command not being
        # able to read an input file, so check ourselves if can't read a file.
        retcode, err = _check_files_accessible(files)
        if process.stderr:
            msg = process.stderr.read()
            if isinstance(msg, six.binary_type):
                msg = msg.decode('utf-8')
            if err:
                err = (_('Hit OSError in '
                         '_process_communicate_handle_oserror(): '
                         '%(stderr)s\nLikely due to %(file)s: %(error)s') %
                       {'stderr': msg,
                        'file': err[0],
                        'error': err[1]})
            else:
                err = (_('Hit OSError in '
                         '_process_communicate_handle_oserror(): %s') % msg)

        output = ''
    else:
        retcode = process.poll()
        if err is not None:
            if isinstance(err, six.binary_type):
                err = err.decode('utf-8')

    return output, err, retcode

the fail begins when .poll() is executed

the initial call to _process_communicate_handle_oserror is from
cms_verify: https://github.com/openstack/python-
keystoneclient/blob/master/keystoneclient/common/cms.py#L148-L173

** Affects: keystone
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1537401

Title:
  keystone gate failing test_get_token_id_error_handling

Status in OpenStack Identity (keystone):
  New

Bug description:
  the test_get_token_id_error_handling test started to fail on jan 23,
  2016

  traceback from test:
  Traceback (most recent call last):
    File "keystone/tests/unit/test_token_provider.py", line 825, in test_get_token_id_error_handling
      token_data)
    File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 422, in assertRaises
      self.assertThat(our_callable, matcher)
    File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 433, in assertThat
      mismatch_error = self._matchHelper(matchee, matcher, message, verbose)
    File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 483, in _matchHelper
      mismatch = matcher.match(matchee)
    File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 108, in match
      mismatch = self.exception_matcher.match(exc_info)
    File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_higherorder.py", line 62, in match
      mismatch = matcher.match(matchee)
    File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 414, in match
      reraise(*matchee)
    File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/matchers/_exception.py", line 101, in match
      result = matchee()
    File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/testtools/testcase.py", line 969, in __call__
      return self._callable_object(*self._args, **self._kwargs)
    File "keystone/token/providers/pki.py", line 49, in _get_token_id
      CONF.signing.keyfile))
    File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/keystoneclient/common/cms.py", line 378, in cms_sign_token
      message_digest=message_digest)
    File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/keystoneclient/common/cms.py", line 359, in cms_sign_data
      process, data, (signing_cert_file_name, signing_key_file_name))
    File "/home/jenkins/workspace/gate-keystone-python27/.tox/py27/local/lib/python2.7/site-packages/keystoneclient/common/cms.py", line 100, in _process_communicate_handle_oserror
      output, err = process.communicate(data)
    File "/usr/lib/python2.7/subprocess.py", line 799, in communicate
      return self._communicate(input)
    File "/usr/lib/python2.7/subprocess.py", line 1401, in _communicate
      stdout, stderr = self._communicate_with_poll(input)
    File "/usr/lib/python2.7/subprocess.py", line 1431, in _communicate_with_poll
      poller = select.poll()
  AttributeError: 'module' object has no attribute 'poll'

  
  The test is seen below or here: https://github.com/openstack/keystone/blob/master/keystone/tests/unit/test_token_provider.py#L816

      def test_get_token_id_error_handling(self):
          # cause command-line failure
          self.config_fixture.config(group='signing',
                                     keyfile='--please-break-me')

          provider = pki.Provider()
          token_data = {}
          self.assertRaises(exception.UnexpectedError,
                            provider._get_token_id,
                            token_data)

  the function that calls subprocess is as follows:
  https://github.com/openstack/python-keystoneclient/blob/master/keystoneclient/common/cms.py#L96

  def _process_communicate_handle_oserror(process, data, files):
      """Wrapper around process.communicate that checks for OSError."""

      try:
          output, err = process.communicate(data)
      except OSError as e:
          if e.errno != errno.EPIPE:
              raise
          # OSError with EPIPE only occurs with old Python 2.7.x versions
          # http://bugs.python.org/issue10963

          # The quick exit is typically caused by the openssl command not being
          # able to read an input file, so check ourselves if can't read a file.
          retcode, err = _check_files_accessible(files)
          if process.stderr:
              msg = process.stderr.read()
              if isinstance(msg, six.binary_type):
                  msg = msg.decode('utf-8')
              if err:
                  err = (_('Hit OSError in '
                           '_process_communicate_handle_oserror(): '
                           '%(stderr)s\nLikely due to %(file)s: %(error)s') %
                         {'stderr': msg,
                          'file': err[0],
                          'error': err[1]})
              else:
                  err = (_('Hit OSError in '
                           '_process_communicate_handle_oserror(): %s') % msg)

          output = ''
      else:
          retcode = process.poll()
          if err is not None:
              if isinstance(err, six.binary_type):
                  err = err.decode('utf-8')

      return output, err, retcode

  the fail begins when .poll() is executed

  the initial call to _process_communicate_handle_oserror is from
  cms_verify: https://github.com/openstack/python-
  keystoneclient/blob/master/keystoneclient/common/cms.py#L148-L173

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1537401/+subscriptions


Follow ups