Uploaded image for project: 'Red Hat OpenStack Services on OpenShift'
  1. Red Hat OpenStack Services on OpenShift
  2. OSPRH-25757

glance-manage db fails with AttributeError without subcommand

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • 2026.1 (G)
    • None
    • openstack-glance
    • None
    • Low

      Problem Description

      When `glance-manage db` is run without specifying a subcommand (such as `version`, `sync`, `expand`, `contract`, etc.), the command crashes with an unhandled `AttributeError` instead of displaying a helpful usage message.

      The root cause is that the code attempts to access `CONF.command.action` without first checking if it is `None`. When no subcommand is provided, `CONF.command.action` is `None`, causing the `startswith()` method call to fail.

      To Reproduce Steps to reproduce the behavior:

      1. Execute `glance-manage db` without any subcommand:
         ```bash
         $ glance-manage db
         ```

      2. Observe the error output:
         ```
         CRITICAL glance [-] Unhandled error: AttributeError: 'NoneType' object has no attribute 'startswith'
         ERROR glance Traceback (most recent call last):
         ERROR glance File "/usr/local/bin/glance-manage", line 10, in <module>
         ERROR glance sys.exit(main())
         ERROR glance File "/opt/stack/glance/glance/cmd/manage.py", line 558, in main
         ERROR glance if CONF.command.action.startswith('db'):
         ERROR glance AttributeError: 'NoneType' object has no attribute 'startswith'

      Expected behavior

      • When `glance-manage db` is executed without a subcommand, it should:
      • Display a helpful message listing all available database subcommands
      • Exit gracefully with an appropriate exit code (e.g., 2 for usage error)
      • Not raise an unhandled exception

       

              pdeore Pranali Deore
              pdeore Pranali Deore
              rhos-storage-glance
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: