Comment 6 for bug 1273273

Revision history for this message
sagar pradhan (sagar-pradhan) wrote : Re: if run 'keystone-manage db_sync' without 'sudo', there should be a prompt that tables notcreated

Hi Peter/Dolph,

I investigated the issue further .
Following were my findings
I created a user sags and issued "keystone-manage db_sync" but got the following trace

sags@ubuntu:~$ keystone-manage db_sync
Traceback (most recent call last):
  File "/usr/local/bin/keystone-manage", line 7, in <module>
    execfile(__file__)
  File "/opt/stack/keystone/bin/keystone-manage", line 56, in <module>
    cli.main(argv=sys.argv, config_files=config_files)
  File "/opt/stack/keystone/keystone/cli.py", line 222, in main
    default_config_files=config_files)
  File "/opt/stack/oslo.config/oslo/config/cfg.py", line 1603, in __call__
    raise ConfigFilesNotFoundError(self._namespace.files_not_found)
oslo.config.cfg.ConfigFilesNotFoundError: Failed to read some config files: /etc/keystone/keystone.conf

even for keystone-manage db_version it gives the same output

sags@ubuntu:~$ keystone-manage db_version
in keystone-manage
Traceback (most recent call last):
  File "/usr/local/bin/keystone-manage", line 7, in <module>
    execfile(__file__)
  File "/opt/stack/keystone/bin/keystone-manage", line 56, in <module>
    cli.main(argv=sys.argv, config_files=config_files)
  File "/opt/stack/keystone/keystone/cli.py", line 222, in main
    default_config_files=config_files)
  File "/opt/stack/oslo.config/oslo/config/cfg.py", line 1603, in __call__
    raise ConfigFilesNotFoundError(self._namespace.files_not_found)
 oslo.config.cfg.ConfigFilesNotFoundError: Failed to read some config files: /etc/keystone/keystone.conf

This is case with all the options for keystone-manage . The main reason being unprivileged does not have

access to keystone.conf

I am not sure why Peter did not recieve the above trace.

if we run the same command using "sudo" everything works fine.

sags@ubuntu:~$ sudo keystone-manage db_version
[sudo] password for sags:
37

I think the fix for this problem would be handling the exception

File "/opt/stack/oslo.config/oslo/config/cfg.py", line 1603, in __call__
    raise ConfigFilesNotFoundError(self._namespace.files_not_found)
 oslo.config.cfg.ConfigFilesNotFoundError: Failed to read some config files: /etc/keystone/keystone.conf

in a more user-friendly manner .

Kindly share your views on this .

Regards,
Sagar