tripleoclient unittests attempting to run sudo

Bug #1819217 reported by YaZug
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Medium
Alex Schultz

Bug Description

was attempting to run tripleoclient unittests and it got into a situation where it was attempting to run sudo in unittests

==============================
Failed 2 tests - output below:
==============================

tripleoclient.tests.v1.tripleo.test_tripleo_upgrade.TestUpgrade.test_take_action_prompt_invalid_option
------------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/home/tester/python-tripleoclient/tripleoclient/utils.py", line 1455, in run_command'
    b' env=env)'
    b' File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output'
    b' **kwargs).stdout'
    b' File "/usr/lib64/python3.6/subprocess.py", line 438, in run'
    b' output=stdout, stderr=stderr)'
    b"subprocess.CalledProcessError: Command '['sudo', 'ln', '-s', '/usr/bin/ansible-playbook', '/usr/bin/ansible-playbook-3']' returned non-zero exit status 1."
    b''
    b'During handling of the above exception, another exception occurred:'
    b''
    b'Traceback (most recent call last):'
    b' File "/usr/lib/python3.6/site-packages/mock/mock.py", line 1305, in patched'
    b' return func(*args, **keywargs)'
    b' File "/home/tester/python-tripleoclient/tripleoclient/tests/v1/tripleo/test_tripleo_upgrade.py", line 171, in test_take_action_prompt_invalid_option'
    b' self.cmd.take_action, parsed_args)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 485, in assertRaises'
    b' self.assertThat(our_callable, matcher)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 496, in assertThat'
    b' mismatch_error = self._matchHelper(matchee, matcher, message, verbose)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 547, in _matchHelper'
    b' mismatch = matcher.match(matchee)'
    b' File "/usr/lib/python3.6/site-packages/testtools/matchers/_exception.py", line 108, in match'
    b' mismatch = self.exception_matcher.match(exc_info)'
    b' File "/usr/lib/python3.6/site-packages/testtools/matchers/_higherorder.py", line 62, in match'
    b' mismatch = matcher.match(matchee)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 475, in match'
    b' reraise(*matchee)'
    b' File "/usr/lib/python3.6/site-packages/testtools/_compat3x.py", line 16, in reraise'
    b' raise exc_obj.with_traceback(exc_tb)'
    b' File "/usr/lib/python3.6/site-packages/testtools/matchers/_exception.py", line 101, in match'
    b' result = matchee()'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 1049, in __call__'
    b' return self._callable_object(*self._args, **self._kwargs)'
    b' File "/home/tester/python-tripleoclient/tripleoclient/v1/tripleo_upgrade.py", line 35, in take_action'
    b' super(Upgrade, self).take_action(parsed_args)'
    b' File "/home/tester/python-tripleoclient/tripleoclient/v1/tripleo_deploy.py", line 1348, in take_action'
    b' utils.ansible_symlink()'
    b' File "/home/tester/python-tripleoclient/tripleoclient/utils.py", line 1610, in ansible_symlink'
    b" run_command(cmd, name='ansible-playbook-3-symlink')"
    b' File "/home/tester/python-tripleoclient/tripleoclient/utils.py", line 1462, in run_command'
    b' raise RuntimeError(message)'
    b"RuntimeError: ansible-playbook-3-symlink failed: b'\\nWe trust you have received the usual lecture from the local System\\nAdministrator. It usually boils down to these three things:\\n\\n #1) Respect the privacy of others.\\n #2) Think before you type.\\n #3) With great power comes great responsibility.\\n\\nSorry, try again.\\nSorry, try again.\\nsudo: 3 incorrect password attempts\\n'"
    b''

tripleoclient.tests.v1.tripleo.test_tripleo_upgrade.TestUpgrade.test_take_action_prompt_no
------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/home/tester/python-tripleoclient/tripleoclient/utils.py", line 1455, in run_command'
    b' env=env)'
    b' File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output'
    b' **kwargs).stdout'
    b' File "/usr/lib64/python3.6/subprocess.py", line 438, in run'
    b' output=stdout, stderr=stderr)'
    b"subprocess.CalledProcessError: Command '['sudo', 'ln', '-s', '/usr/bin/ansible-playbook', '/usr/bin/ansible-playbook-3']' returned non-zero exit status 1."
    b''
    b'During handling of the above exception, another exception occurred:'
    b''
    b'Traceback (most recent call last):'
    b' File "/usr/lib/python3.6/site-packages/mock/mock.py", line 1305, in patched'
    b' return func(*args, **keywargs)'
    b' File "/home/tester/python-tripleoclient/tripleoclient/tests/v1/tripleo/test_tripleo_upgrade.py", line 147, in test_take_action_prompt_no'
    b' self.cmd.take_action, parsed_args)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 485, in assertRaises'
    b' self.assertThat(our_callable, matcher)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 496, in assertThat'
    b' mismatch_error = self._matchHelper(matchee, matcher, message, verbose)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 547, in _matchHelper'
    b' mismatch = matcher.match(matchee)'
    b' File "/usr/lib/python3.6/site-packages/testtools/matchers/_exception.py", line 108, in match'
    b' mismatch = self.exception_matcher.match(exc_info)'
    b' File "/usr/lib/python3.6/site-packages/testtools/matchers/_higherorder.py", line 62, in match'
    b' mismatch = matcher.match(matchee)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 475, in match'
    b' reraise(*matchee)'
    b' File "/usr/lib/python3.6/site-packages/testtools/_compat3x.py", line 16, in reraise'
    b' raise exc_obj.with_traceback(exc_tb)'
    b' File "/usr/lib/python3.6/site-packages/testtools/matchers/_exception.py", line 101, in match'
    b' result = matchee()'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 1049, in __call__'
    b' return self._callable_object(*self._args, **self._kwargs)'
    b' File "/home/tester/python-tripleoclient/tripleoclient/v1/tripleo_upgrade.py", line 35, in take_action'
    b' super(Upgrade, self).take_action(parsed_args)'
    b' File "/home/tester/python-tripleoclient/tripleoclient/v1/tripleo_deploy.py", line 1348, in take_action'
    b' utils.ansible_symlink()'
    b' File "/home/tester/python-tripleoclient/tripleoclient/utils.py", line 1610, in ansible_symlink'
    b" run_command(cmd, name='ansible-playbook-3-symlink')"
    b' File "/home/tester/python-tripleoclient/tripleoclient/utils.py", line 1462, in run_command'
    b' raise RuntimeError(message)'
    b"RuntimeError: ansible-playbook-3-symlink failed: b'\\nWe trust you have received the usual lecture from the local System\\nAdministrator. It usually boils down to these three things:\\n\\n #1) Respect the privacy of others.\\n #2) Think before you type.\\n #3) With great power comes great responsibility.\\n\\nSorry, try again.\\nSorry, try again.\\nsudo: 3 incorrect password attempts\\n'"
    b''

Revision history for this message
YaZug (jon-schlueter) wrote :
Download full text (6.0 KiB)

on same setup without sudo available it fails with

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b' File "/usr/lib/python3.6/site-packages/mock/mock.py", line 1305, in patched'
    b' return func(*args, **keywargs)'
    b' File "/home/tester/python-tripleoclient/tripleoclient/tests/v1/tripleo/test_tripleo_upgrade.py", line 147, in test_take_action_prompt_no'
    b' self.cmd.take_action, parsed_args)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 485, in assertRaises'
    b' self.assertThat(our_callable, matcher)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 496, in assertThat'
    b' mismatch_error = self._matchHelper(matchee, matcher, message, verbose)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 547, in _matchHelper'
    b' mismatch = matcher.match(matchee)'
    b' File "/usr/lib/python3.6/site-packages/testtools/matchers/_exception.py", line 108, in match'
    b' mismatch = self.exception_matcher.match(exc_info)'
    b' File "/usr/lib/python3.6/site-packages/testtools/matchers/_higherorder.py", line 62, in match'
    b' mismatch = matcher.match(matchee)'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 475, in match'
    b' reraise(*matchee)'
    b' File "/usr/lib/python3.6/site-packages/testtools/_compat3x.py", line 16, in reraise'
    b' raise exc_obj.with_traceback(exc_tb)'
    b' File "/usr/lib/python3.6/site-packages/testtools/matchers/_exception.py", line 101, in match'
    b' result = matchee()'
    b' File "/usr/lib/python3.6/site-packages/testtools/testcase.py", line 1049, in __call__'
    b' return self._callable_object(*self._args, **self._kwargs)'
    b' File "/home/tester/python-tripleoclient/tripleoclient/v1/tripleo_upgrade.py", line 35, in take_action'
    b' super(Upgrade, self).take_action(parsed_args)'
    b' File "/home/tester/python-tripleoclient/tripleoclient/v1/tripleo_deploy.py", line 1348, in take_action'
    b' utils.ansible_symlink()'
    b' File "/home/tester/python-tripleoclient/tripleoclient/utils.py", line 1610, in ansible_symlink'
    b" run_command(cmd, name='ansible-playbook-3-symlink')"
    b' File "/home/tester/python-tripleoclient/tripleoclient/utils.py", line 1455, in run_command'
    b' env=env)'
    b' File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output'
    b' **kwargs).stdout'
    b' File "/usr/lib64/python3.6/subprocess.py", line 423, in run'
    b' with Popen(*popenargs, **kwargs) as process:'
    b' File "/usr/lib64/python3.6/subprocess.py", line 729, in __init__'
    b' restore_signals, start_new_session)'
    b' File "/usr/lib64/python3.6/subprocess.py", line 1364, in _execute_child'
    b' raise child_exception_type(errno_num, err_msg, err_filename)'
    b"FileNotFoundError: [Errno 2] No such file or directory: 'sudo': 'sudo'"
    b''

tripleoclient.tests.v1.tripleo.test_tripleo_upgrade.TestUpgrade.test_take_action_prompt_invalid_option
------------------------------------------------------------------------------------------------------

Captured...

Read more...

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-tripleoclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/642149

Changed in tripleo:
assignee: nobody → YaZug (jon-schlueter)
status: New → In Progress
Changed in tripleo:
milestone: none → stein-3
importance: Undecided → Medium
Changed in tripleo:
assignee: YaZug (jon-schlueter) → Alex Schultz (alex-schultz)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-tripleoclient (master)

Reviewed: https://review.openstack.org/642149
Committed: https://git.openstack.org/cgit/openstack/python-tripleoclient/commit/?id=a7c7955e521367434976402f950e3a213d8d9970
Submitter: Zuul
Branch: master

commit a7c7955e521367434976402f950e3a213d8d9970
Author: Jon Schlueter <email address hidden>
Date: Fri Mar 8 15:49:45 2019 -0500

    Add 2 missing guards for sudo

    in running unittests on box with no sudo and
    ansible 3 symlink missing ran into this issue.

    There were 2 missing mock guards on unittests
    that triggered this edge case

    Change-Id: Ic4869cf8544e96bc38b26923fadc13be7c0970f9
    Closes-Bug: #1819217

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-tripleoclient 11.4.0

This issue was fixed in the openstack/python-tripleoclient 11.4.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.