Closed Bug 729159 Opened 12 years ago Closed 12 years ago

services.config.get_section broken for section names with '.'

Categories

(Cloud Services :: Server: Core, defect)

x86_64
Linux
defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: petef, Assigned: rmiller)

References

Details

(Whiteboard: [qa-])

Attachments

(1 file)

In production, we have a sync config like:

[storage]
sqluri = foo
hosts = stage-sync1.services.mozilla.com
        stage-sync2.services.mozilla.com
        [...]


[host:stage-sync1.services.mozilla.com]
storage.sqluri = bar

and when we pass in a Host: header of stage-sync1.services.mozilla.com, we're supposed to get a storage.sqluri of "bar" in the code, but due to a bug, it's always returning "foo".

I tracked this down to services.config.get_section.

                skey = skey.split(self.splitchar)
                if skey[0] != section:
                    continue

In the raw config object (as we iterate through self.items), there is a key 'host:stage-sync1.services.mozilla.com.storage.sqluri'. When get_section('host:stage-sync1.services.mozilla.com') is called, this code gets run and skips all the keys because skey[0] (in this case, 'host:stage-sync1' since it's split on '.') does not equal section ('host:stage-sync1.services.mozilla.com'). We skip these keys, so no config values ever get merged.

I think it may have broken around this commit:
http://hg.mozilla.org/services/server-core/diff/af86645e1cd7/services/config.py

note: this is not broken in production, but broken on newer server-core and preventing loadtest work.
:rmiller, the test RPMs you gave me are working well in stage and seem to have this bug fixed. thanks!
Assignee: nobody → rmiller
Awesome! Change is currently only on the metrics.logging branch, but the changeset that fixed the issue is here: https://hg.mozilla.org/services/server-core/rev/5203f2a8b0e2
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
reopening to push this through formal code review
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Attachment #599370 - Flags: review?(telliott) → review+
merged to default in https://hg.mozilla.org/services/server-core/rev/5e3e5aac4113
Status: REOPENED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → FIXED
Comment on attachment 599370 [details] [diff] [review]
don't assume section name doesn't contain splitchar

this code was rewritten without unit tests, which broke stage, and then was fixed without unit tests. f-, no tests.
Attachment #599370 - Flags: feedback-
Whiteboard: [qa-]
Blocks: 758482
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: