Bad error reporting on config permissions error

Bug #1535839 reported by clayg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
In Progress
Medium
Bing Hu

Bug Description

I'm sure somewhere in the get_config code in utils we use ConfigParser's .read method to read a list of config files, and it is maybe silently passing over files that it doesn't have permission to read.

But the end result is very surprising:

vagrant@saio:~$ swift-init object start -c 1
WARNING: Unable to modify file descriptor limit. Running as non-root?
WARNING: Unable to modify max process limit. Running as non-root?
Starting object-server...(/etc/swift/object-server/1.conf.d)
bind_port wasn't properly set in the config file. It must be explicitly set to a valid port number.

vagrant@saio:~$ ls -alhF /etc/swift/object-server/1.conf.d/20_settings.conf
-rw------- 1 root root 133 Jan 14 02:33 /etc/swift/object-server/1.conf.d/20_settings.conf

Bing Hu (hubingsh)
Changed in swift:
assignee: nobody → Bing Hu (hubingsh)
Revision history for this message
Bing Hu (hubingsh) wrote :

I checked the code, found that:
there are two kinds of configurations: single config file(xx.conf) and config files under config dir(xx.conf.d).

swift can report permission error when can't read single config file
Error trying to load config from /etc/swift/object-server/2.conf: [Errno 13] Permission denied: '/etc/swift/object-server/2.conf'

but it will not report permission error when can't read files under config dir.

my ideal is to print warning log when can't read files under config dir, so that we can locate the error.

li@swift:/etc/swift/object-server/1.conf.d$ swift-init object start -c 1
WARNING: Unable to modify file descriptor limit. Running as non-root?
Warning: Read permission denied: /etc/swift/object-server/1.conf.d/bind.conf

Starting object-server...(/etc/swift/object-server/1.conf.d)
bind_port wasn't properly set in the config file. It must be explicitly set to a valid port number.

Revision history for this message
clayg (clay-gerrard) wrote :

Warning would be *tons* better - WFM!

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

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

Changed in swift:
status: New → In Progress
clayg (clay-gerrard)
Changed in swift:
importance: Low → Medium
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.