client calls bash-completion code from library calls

Bug #1817782 reported by Eric Harney
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-cinderclient
Fix Released
Undecided
Eric Harney
python-manilaclient
New
Undecided
Unassigned

Bug Description

If you modify completion_cache() in base.py to fail with an error, for example adding:
    raise "asdf"
to the top of the method, unit tests such as
    cinderclient.tests.unit.v3.test_volumes.VolumesTest.test_create_volume

will fail. This test is not using the cinderclient shell, only the library. The completion code should not be called at all from library paths, only when using the CLI.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to python-cinderclient (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/639422

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to python-cinderclient (master)

Reviewed: https://review.openstack.org/639422
Committed: https://git.openstack.org/cgit/openstack/python-cinderclient/commit/?id=a39805c6f45baf94c0d14da3ae775ee204a267ee
Submitter: Zuul
Branch: master

commit a39805c6f45baf94c0d14da3ae775ee204a267ee
Author: Eric Harney <email address hidden>
Date: Tue Feb 26 14:13:52 2019 -0500

    Tests: Don't write bash-completion cache files

    Mock out writing of bash-completion cache files
    during unit tests.

    Related-Bug: #1817782

    Change-Id: I944862c30fb4684dd034eba6953e9302d2d22439

Changed in python-cinderclient:
assignee: nobody → Eric Harney (eharney)
status: New → In Progress
Revision history for this message
Eric Harney (eharney) wrote :
summary: - cinderclient appears to call bash-completion code from library calls
+ cinderclient calls bash-completion code from library calls
summary: - cinderclient calls bash-completion code from library calls
+ client calls bash-completion code from library calls
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-cinderclient (master)

Reviewed: https://review.opendev.org/649357
Committed: https://git.openstack.org/cgit/openstack/python-cinderclient/commit/?id=0707191d43396026a6ddd18213b06e1b26d94e9e
Submitter: Zuul
Branch: master

commit 0707191d43396026a6ddd18213b06e1b26d94e9e
Author: Eric Harney <email address hidden>
Date: Tue Apr 2 10:46:52 2019 -0400

    Remove bash-completion calls from base.py

    This should not be here since this is client
    library code, but it isn't needed anyhow since
    this completion is handled from the shell code.

    Closes-Bug: #1817782

    Change-Id: I3e7ddbe4a50a66db8961a71d71592ce708320b0d

Changed in python-cinderclient:
status: In Progress → Fix Released
Revision history for this message
prashkre (prashkre) wrote :

In stein stable branch, UnicodeError is popping out in completion_cache when username has special characters like flügel. We need to cherry pick the fix to stein branch as well.

    self.vol_types = self.cclient.volume_types.list()
  File "/usr/lib/python2.7/site-packages/cinderclient/v3/volume_types.py", line 92, in list
    return self._list("/types%s" % (query_string), "volume_types")
  File "/usr/lib/python2.7/site-packages/cinderclient/base.py", line 98, in _list
    with self.completion_cache('human_id', obj_class, mode="w"):
  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/usr/lib/python2.7/site-packages/cinderclient/base.py", line 276, in completion_cache
    uniqifier = hashlib.md5(username.encode('utf-8') +
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to python-cinderclient (stable/stein)

Related fix proposed to branch: stable/stein
Review: https://review.opendev.org/677915

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-cinderclient 4.3.0

This issue was fixed in the openstack/python-cinderclient 4.3.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to python-cinderclient (stable/stein)

Reviewed: https://review.opendev.org/677915
Committed: https://git.openstack.org/cgit/openstack/python-cinderclient/commit/?id=0eb4fc518ef40faea466b0e23ae73fe74a9fd79d
Submitter: Zuul
Branch: stable/stein

commit 0eb4fc518ef40faea466b0e23ae73fe74a9fd79d
Author: Eric Harney <email address hidden>
Date: Tue Feb 26 14:13:52 2019 -0500

    Tests: Don't write bash-completion cache files

    Mock out writing of bash-completion cache files
    during unit tests.

    Related-Bug: #1817782

    Change-Id: I944862c30fb4684dd034eba6953e9302d2d22439
    (cherry picked from commit a39805c6f45baf94c0d14da3ae775ee204a267ee)

tags: added: in-stable-stein
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-cinderclient (stable/stein)

Fix proposed to branch: stable/stein
Review: https://review.opendev.org/679183

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-cinderclient (stable/stein)

Reviewed: https://review.opendev.org/679183
Committed: https://git.openstack.org/cgit/openstack/python-cinderclient/commit/?id=9c9e797d07f64d4841ecb695d177c5e0c7d8266b
Submitter: Zuul
Branch: stable/stein

commit 9c9e797d07f64d4841ecb695d177c5e0c7d8266b
Author: Eric Harney <email address hidden>
Date: Tue Apr 2 10:46:52 2019 -0400

    Remove bash-completion calls from base.py

    This should not be here since this is client
    library code, but it isn't needed anyhow since
    this completion is handled from the shell code.

    Closes-Bug: #1817782

    Change-Id: I3e7ddbe4a50a66db8961a71d71592ce708320b0d
    (cherry picked from commit 0707191d43396026a6ddd18213b06e1b26d94e9e)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-cinderclient 4.2.2

This issue was fixed in the openstack/python-cinderclient 4.2.2 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.