[Bug 1945661] Re: openstack commands fail with GTK3 error

Rodrigo Barbieri 1945661 at bugs.launchpad.net
Fri Oct 18 15:57:17 UTC 2024


Investigating this issue, I realized something that has not been
mentioned above.

The issue does not happen in "native focal" because, it uses
python3-cliff 3.1.0. The issue was introduced in python3-cliff 3.5.0
which is when it introduces the cmd2 import.

Looking at python3-cliff UCA packages, we see that Wallaby uses
python3-cliff 3.6.0. The issue has been addressed in cmd2 and does not
happen in jammy. Therefore the affected versions are:

focal-wallaby, focal-xena and focal-yoga.

python3-cmd2 has no UCA versions, only "native focal", so it has to be
fixed in 0.8.5, but it needs UCA of wallaby, xena or yoga to be able to
reproduce the issue.

I will update the Test steps accordingly so it is properly reproduced
and then verified.

-- 
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to cmd2 in Ubuntu.
https://bugs.launchpad.net/bugs/1945661

Title:
  openstack commands fail with GTK3 error

Status in cmd2 package in Ubuntu:
  Fix Released
Status in cmd2 source package in Focal:
  Incomplete

Bug description:
  [ Impact ]

   * There is a bug in cmd2 v0.8.5 where an exception is thrown when GTK3
     libraries are not installed. This causes Python applications using
     cmd2 to crash unexpectedly

   * This patch backports a fix from upstream that handles that expection
     gracefully, allowing applications to function properly.

   * The workaround to this was to install GTK3, which is not ideal as the
     Python applications are command line tools, not graphical

  [ Test Plan ]

   * Deploy focal

   * Install an application that has cmd2 as a dependency
     e.g. python3-openstackclient

   * Run command that uses cmd2: `openstack server list`
   
   * In the failing case, we would expect to see an uncaught ValueError exception

   * In the successful case, the command runs as anticipated

  [ Where problems could occur ]

   * This changes the error handling for a library that is used by many
     Python applications. Some of these applications could rely on the
     existing behavior (a ValueError exception being thrown) to detect
     certain configurations and change their behavior accordingly.

   * This would result in those applications failing under certain use
     cases. For example, the configuration in question is a headless
     Linux system without GTK libraries installed.

  [ Original bug description ]

  Openstack release: Wallaby
  OS: Ubuntu 20.04 server edition
  After installation of python3-openstackclient from apt, while setting up user, roles and project, I executed following command:
  openstack domain create --description "An Example Domain" example

  Error:
  Traceback (most recent call last):
    File "/usr/bin/openstack", line 6, in <module>
      from openstackclient.shell import main
    File "/usr/lib/python3/dist-packages/openstackclient/shell.py", line 23, in <module>
      from osc_lib import shell
    File "/usr/lib/python3/dist-packages/osc_lib/shell.py", line 24, in <module>
      from cliff import app
    File "/usr/lib/python3/dist-packages/cliff/app.py", line 22, in <module>
      import cmd2
    File "/usr/lib/python3/dist-packages/cmd2.py", line 585, in <module>
      _ = pyperclip.paste()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 667, in lazy_load_stub_paste
      copy, paste = determine_clipboard()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 558, in determine_clipboard
      return init_gi_clipboard()
    File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line 167, in init_gi_clipboard
      gi.require_version('Gtk', '3.0')
    File "/usr/lib/python3/dist-packages/gi/__init__.py", line 129, in require_version
      raise ValueError('Namespace %s not available' % namespace)

  Had to install GTK3 to make openstack commands work but it is taking
  huge time to get a response to the commands. The wait time after
  firing any openstack cli command is around 30 seconds.

  Anybody faced the issue? What is the fix for it if it exists?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cmd2/+bug/1945661/+subscriptions




More information about the Ubuntu-openstack-bugs mailing list