Merge lp:~jtv/launchpad/bug-733132 into lp:launchpad
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Jeroen T. Vermeulen | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 12588 | ||||
Proposed branch: | lp:~jtv/launchpad/bug-733132 | ||||
Merge into: | lp:launchpad | ||||
Prerequisite: | lp:~jtv/launchpad/bug-730460-job-class | ||||
Diff against target: |
127 lines (+60/-1) 3 files modified
lib/lp/services/features/flags.py (+4/-0) lib/lp/soyuz/model/distroseriesdifferencejob.py (+6/-0) lib/lp/soyuz/tests/test_distroseriesdifferencejob.py (+50/-1) |
||||
To merge this branch: | bzr merge lp:~jtv/launchpad/bug-733132 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Abel Deuring (community) | code | Approve | |
Review via email: mp+53009@code.launchpad.net |
This proposal supersedes a proposal from 2011-03-11.
Commit message
[r=adeuring][bug=733132] DistroSeriesDif
Description of the change
= Summary =
Add feature flag to control generation of DistroSeriesDif
Branch builds on the as-yet unlanded one that introduced DistroSeriesDif
== Proposed fix ==
The hard part is testing database permissions for the scripts that may create the new jobs, when most of the tests will run with job generation disabled.
That's why you'll see a test that assumes each of the known database roles that may want to do this, and at least tries to create a job. That really just tests INSERT privileges, but I'm assuming that it's a reasonable indicator in practice. I don't want the test to get too slow and complicated, especially since the real question is whether I forgot any database roles, not whether I forgot a privilege.
== Pre-implementation notes ==
The naming and setting of the flag gave us some trouble:
* Its name uses underscores to separate words. An existing related flag used dashes. I informed Julian that the documentation does not allow this, and we'll have to restore consistent naming later.
* According to William, we now test for boolean flags in python by evaluating them as booleans. This means that the empty string is used to signify "false" and any other string (including "false"!) means "true."
== Implementation details ==
I kept the name of the feature flag in a variable. But it's duplicated in flags.py because nobody else seemed to follow that practice there. I suppose it's convenient to be able to grep for the flag name there, though with the dash/underscore problem it is a tradeoff for convenience over safety.
== Tests ==
{{{
./bin/test -vvc lp.soyuz.
}}}
== Demo and Q/A ==
It should still be possible to publish source package releases, with or without the new feature flag set.
= Launchpad lint =
The warnings about security.cfg are nonsensical; I wish we could get rid of them somehow. The other ones strike me as dubious as well, so I didn't try to "fix" them. (I didn't cause them either).
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
database/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/lp/
lib/canonical
./database/
735: Line exceeds 78 characters.
736: Line exceeds 78 characters.
737: Line exceeds 78 characters.
763: Line exceeds 78 characters.
767: Line exceeds 78 characters.
822: Line exceeds 78 characters.
836: Line exceeds 78 characters.
837: Line exceeds 78 characters.
854: Line exceeds 78 characters.
855: Line exceeds 78 characters.
856: Line exceeds 78 characters.
857: Line exceeds 78 characters.
858: Line exceeds 78 characters.
911: Line exceeds 78 characters.
912: Line exceeds 78 characters.
913: Line exceeds 78 characters.
943: Line exceeds 78 characters.
1024: Line exceeds 78 characters.
1034: Line exceeds 78 characters.
1035: Line exceeds 78 characters.
./lib/lp/
430: E301 expected 1 blank line, found 2
471: E301 expected 1 blank line, found 0
./lib/lp/
403: E301 expected 1 blank line, found 2
(14:12:05) adeuring: jtv: the branch looks good. only one detail: FEATURE_FLAG as a variable name does not tell what the feature is about. Could you rename it to something like ENABLE_ DERIVED_ SERIES_ JOBS ? ferencejob. FEATURE_ FLAG FEATURE_ FLAG? ferencejob. ENABLING_ FEATURE_ FLAG, I think that'd be about as clear as it could be. FLAG_ENABLE_ DERIVED_ JOBS? fferencejob" to imply that it's DistroSeriesDif ferenceJob that's being enabled. ferencejob. WHAETEVER is more or less fine, but _inside_ the module something like FEATURE_ FLAG_ENABLE_ MODULE would still make more sense to me
(14:12:36) jtv: adeuring: I'm in two minds about that… doesn't the module it's in do enough to disambiguate it?
(14:12:55) jtv: I could import it into the test as distroseriesdif
(14:13:02) adeuring: jtv: well, we could have two feature flags in this module
(14:13:05) jtv: That way the name is always disambiguated.
(14:13:28) jtv: Ah I see what you mean.
(14:14:41) adeuring: I prefer names which tell what is done over how things are done
(14:15:05) jtv: Okay, then how about ENABLING_
(14:15:24) jtv: Because it is important to my mind that it is the feature flag, not e.g. a boolean that controls the feature.
(14:15:54) jtv: If the test refers to it as distroseriesdif
(14:16:01) adeuring: jtv: what about FEATURE_
(14:16:28) jtv: Gets a bit long, and basically for the purpose of repeating the module name.
(14:16:49) adeuring: without say what is enabled, it looks to me still like a label on an electrial switch just saying "SWITCH" ;)
(14:18:03) jtv: Well that would make sense in the context of a little circuit board when you know what the board is for, just not what outside part should be attached to the particular piece of wire you're looking at.
(14:18:57) adeuring: jtv, ok, so... ENABLE_MODULE? or FLAG_ENALBE_MODULE?
(14:19:18) jtv: It would have to say "flag," but I don't see why it should say "module."
(14:19:58) adeuring: well, I still think that its good to indicate what is enabled
(14:21:31) jtv: Yes, but I'm relying on the "distroseriesdi
(14:22:13) jtv: I don't think it'll confuse anyone, especially since it's not even being exported—it's just the test that refers to it from the outside.
(14:23:42) adeuring: jtv: ok, for the test distroseriesdif
(14:25:47) jtv: OK, I can't say I like it much but you have the advantage of a fresh outside look. I'll use that.