Closed Bug 355837 Opened 19 years ago Closed 19 years ago

Make the webservice able to create bugs

Categories

(Bugzilla :: WebService, enhancement)

2.23
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.0

People

(Reporter: mkanat, Assigned: mkanat)

References

Details

Attachments

(3 files, 4 obsolete files)

One of the most important things people need to be able to do with the WebService interface is make it file a new bug. Now that we have Bugzilla::Bug->create, this should be pretty straightforward.
We've already agreed in meeting that this is part of the minimum required functionality for the WebService interface to be useful, so it's a blocker.
Flags: blocking3.0+
Attached patch v1 (obsolete) — Splinter Review
Okay, here we go. I haven't tested this very much, but it compiles and I can run the function from a perl -we. The documentation and chasing down all the error codes was really what took the longest.
Assignee: general → mkanat
Status: NEW → ASSIGNED
Attachment #241548 - Flags: review?(wurblzap)
Attached patch v2 (obsolete) — Splinter Review
I realized that somebody could use this to file a bug that was "NEW INVALID". (They could set the resolution, technically, even though it's not documented.)
Attachment #241548 - Attachment is obsolete: true
Attachment #241551 - Flags: review?(wurblzap)
Attachment #241548 - Flags: review?(wurblzap)
Attached patch v2.1 (obsolete) — Splinter Review
Oh, we don't want them to be able to set bug_id either, now do we. :-)
Attachment #241551 - Attachment is obsolete: true
Attachment #241554 - Flags: review?(wurblzap)
Attachment #241551 - Flags: review?(wurblzap)
Come to think of it, it probably should also add the bug to its default groups, automatically. But I'd still like a review, just to know if there's anything broken about it (and maybe to get a patch to bz_webservice_demo or something that could show us that it works).
Blocks: 355839
(In reply to comment #5) > Come to think of it, it probably should also add the bug to its default groups, > automatically. > > But I'd still like a review, just to know if there's anything broken about it > (and maybe to get a patch to bz_webservice_demo or something that could show us > that it works). Hi there. I had a look. The patch (241554) applied cleanly to tip. First, why do you return a hash from the create function? Why not just the bug_id as an int? As login does? It seems that severity is required, not defaulted: [104] A legal Severity was not set Perhaps the documentation is not up-to-date? Same for OS: [104] A legal OS/Version was not set. priority: [104] A legal Priority was not set. platform: [104] A legal Platform was not set. Finally, when all parameters are set, I get: Undefined subroutine &Bugzilla::Component::check_component called at Bugzilla/Bug.pm line 566. Could this last be some use clause missing? (I am not a perl coder). I hope you can use this for something - I am not a reviewer, but I sure would like to see this going somewhere. Let me know if I can do anything more/else.
(In reply to comment #6) > First, why do you return a hash from the create function? Why not just the > bug_id as an int? As login does? All standardized WebService functions return a hash. Remember: If it's not documented, it's not stable. Pretend it doesn't exist. > It seems that severity is required, not defaulted: > > [104] A legal Severity was not set Read the definition of "defaulted" again. *You* don't have a defaultseverity parameter set, so it's required for *you*. > Undefined subroutine &Bugzilla::Component::check_component called at > Bugzilla/Bug.pm line 566. That could be a bug, I could look into it. Are you sure you're actually on HEAD? That sounds like a bug that was in 2.23.2.
(In reply to comment #7) > (In reply to comment #6) > > First, why do you return a hash from the create function? Why not just the > > bug_id as an int? As login does? > > All standardized WebService functions return a hash. OK - I was not aware. Is that standardized as in "Bugzilla standard" or some other standard? (xm-rpc is pretty new to me...). > > Remember: If it's not documented, it's not stable. Pretend it doesn't exist. Login is not documented... But, then how should I perform a login? (Again, I apologize if I am asking really stupid/newbee questions...) > Read the definition of "defaulted" again. *You* don't have a defaultseverity > parameter set, so it's required for *you*. My bad - I did not notice this difference. Thanks for pointing it out. > > > Undefined subroutine &Bugzilla::Component::check_component called at > > Bugzilla/Bug.pm line 566. > > That could be a bug, I could look into it. Are you sure you're actually on > HEAD? That sounds like a bug that was in 2.23.2. To obtain the sources, I did: export CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot cvs login cvs checkout Bugzilla I assumed I was in HEAD then. Webservice/Bug.pm and Bug.pm does not have any sticky tags. I am perfectly open to the possibility that I am doing something wrong. However, looking at the information passed between me and the server, it does look like the server gets all the information it needs, but can not locate the module. I have checked the permissions of the files, and they do look OK to me.
(In reply to comment #8) > OK - I was not aware. Is that standardized as in "Bugzilla standard" or some > other standard? (xm-rpc is pretty new to me...). It's the Bugzilla standard. We had a conversation about it on developers@ (bugzilla.org) a month or two ago--you can probably check the archives. > Login is not documented... But, then how should I perform a login? (Again, I > apologize if I am asking really stupid/newbee questions...) Yeah, I completely understand. The API is not complete yet, this is only a development release. > I am perfectly open to the possibility that I am doing something wrong. > However, looking at the information passed between me and the server, it does > look like the server gets all the information it needs, but can not locate the > module. Okay. I can check it out. Do you have the code that you were using to test it with? I'd like to have something to check it against. (You could attach the code here as an attachment.)
This patch adds support for calling create from the bz_webservice_demo.pl script. It does so by adding a single option: --create, that takes as parameter a filename. The file is supposed to contain a anonymous hash with the needed parameter for bug creating. I will attach an example file shortly, and an example is given in the documentation part of the patch.
Attachment #242748 - Flags: review?(mkanat)
This is an example of a parameter file to the --create option that patch 242748 adds to bz_webservice_demo.pl: { product => "TestProduct", component => "TestComponent", summary => "TestBug - created from bz_webservice_demo.pl", version => "unspecified", description => "This is a description of the bug... hohoho", op_sys => "All", platform => "All", priority => "P4", severity => "normal" };
Attachment #242749 - Flags: review?(mkanat)
(In reply to comment #9) > (In reply to comment #8) > > OK - I was not aware. Is that standardized as in "Bugzilla standard" or some > > other standard? (xm-rpc is pretty new to me...). > > It's the Bugzilla standard. We had a conversation about it on developers@ > (bugzilla.org) a month or two ago--you can probably check the archives. After looking about a bit, I believe I found it: The email you send at 18/8 2006, titled "Webservice as a Stable API" must be it. (Specified here for the benefit of others). > > > Login is not documented... But, then how should I perform a login? (Again, I > > apologize if I am asking really stupid/newbee questions...) > > Yeah, I completely understand. The API is not complete yet, this is only a > development release. OK. Perhaps you could sketch what would be needed for the login method to conform to the Stable API? I could then try to add it to it, as login is quite useful to me... ;-) > > However, looking at the information passed between me and the server, it does > > look like the server gets all the information it needs, but can not locate the > > module. > > Okay. I can check it out. Do you have the code that you were using to test it > with? Unfortunately, that is part of a project at my company, that I am not sure I can send you. But, I have tried to construct a patch for bz_webservice_demo.pl, that adds a --create option. As the server fails, I can't say for sure it works, but I believe so. Please have a look (at your lesuire).
(In reply to comment #12) > After looking about a bit, I believe I found it: The email you send at 18/8 > 2006, titled "Webservice as a Stable API" must be it. (Specified here for the > benefit of others). Yep, that's it. :-) > OK. Perhaps you could sketch what would be needed for the login method to > conform to the Stable API? I could then try to add it to it, as login is quite > useful to me... ;-) Basically, it just needs to conform to our decisions in that thread. Basically, the input parameters need to be a hash, and the return value needs to be a hash, if there is a return value. You can file another bug for that.
(In reply to comment #6) > Finally, when all parameters are set, I get: > > Undefined subroutine &Bugzilla::Component::check_component called at > Bugzilla/Bug.pm line 566. Correct. I reported it as bug 357676.
After updating with the stuff from 357676, I now get: DBD::mysql::db do failed: Column 'remaining_time' cannot be null at Bugzilla/Object.pm line 238 Bugzilla::Object::insert_create_data('Bugzilla::Bug', 'HASH(0x8458a54)') called at Bugzilla/Bug.pm line 276 Bugzilla::Bug::create('Bugzilla::Bug', 'HASH(0x90c6534)') called at Bugzilla/WebService/Bug.pm line 74 Bugzilla::WebService::Bug::create('Bugzilla::WebService::Bug', 'HASH(0x90a03c4)') called at /usr/share/perl5/SOAP/Lite.pm line 2528 eval {...} called at /usr/share/perl5/SOAP/Lite.pm line 2516 eval {...} called at /usr/share/perl5/SOAP/Lite.pm line 2485 SOAP::Server::handle('Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI=HASH(0x901...', '<?xml version="1.0"?>\x{a}<methodCall>\x{a} <methodName>Bug.create</...') called at /usr/share/perl5/SOAP/Transport/HTTP.pm line 324 SOAP::Transport::HTTP::Server::handle('Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI=HASH(0x901...') called at /usr/share/perl5/SOAP/Transport/HTTP.pm line 420 SOAP::Transport::HTTP::CGI::handle('Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI=HASH(0x901...') called at /scratch/Svn/mozilla/webtools/bugzilla/xmlrpc.cgi line 32 When calling using the WebService interface. So, progress, but not really "game" ;-) (This is against a "fresh" cvs update, clean database, against TestProduct, TestComponent, etc).
Comment on attachment 242749 [details] Example of parameter passing to bz_webservice_demo after adding patch 242748 I don't have to review this, this is just an example.
Attachment #242749 - Flags: review?(mkanat)
Attached patch v3 (obsolete) — Splinter Review
Okay. Thanks to Mads's patch, I was able to actually test this version. Mads, could you test this some more? You can also look over the code, if you want, and make sure it's sensible.
Attachment #241554 - Attachment is obsolete: true
Attachment #244227 - Flags: review?
Attachment #241554 - Flags: review?(wurblzap)
Attachment #244227 - Flags: review? → review?(mbd)
Comment on attachment 244227 [details] [diff] [review] v3 >Index: Bugzilla/Bug.pm >+ # You can't set these fields on bug creation (or sometimes ever). >+ delete $params->{resolution}; Huh? Of course I can, when updating a bug.
Comment on attachment 242748 [details] [diff] [review] Patch to add support for create to bz_webservice_demo.pl This looks fine.
Attachment #242748 - Flags: review?(mkanat) → review+
(In reply to comment #18) > Huh? Of course I can, when updating a bug. On bug *creation*. This is run_create_validators.
Comment on attachment 244227 [details] [diff] [review] v3 >Index: Bugzilla/WebService/Bug.pm >+=item C<component> (string) B<Required> - The name of a component in thei s/thei/the/ >+=item C<description> (string) B<Defaulted> - The initial description for >+this bug. Some Bugzilla installations require this to not be blank. I am bit confused about this part. Setting description to "" works (fails for commentoncreate on, accepts if off), setting it to some value works too, but omitting it, returns this: Server DBD::mysql::db do failed: Column 'thetext' cannot be null at Bugzilla/Bug.pm line 321 Bugzilla::Bug::create('Bugzilla::Bug', 'HASH(0x90ca358)') called at Bugzilla/WebService/Bug.pm line 75 Bugzilla::WebService::Bug::create('Bugzilla::WebService::Bug', 'HASH(0x909ff68)') called at /usr/share/perl5/SOAP/Lite.pm line 2528 eval {...} called at /usr/share/perl5/SOAP/Lite.pm line 2516 eval {...} called at /usr/share/perl5/SOAP/Lite.pm line 2485 SOAP::Server::handle('Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI=HASH(0x902...', '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName...') called at /usr/share/perl5/SOAP/Transport/HTTP.pm line 324 SOAP::Transport::HTTP::Server::handle('Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI=HASH(0x902...') called at /usr/share/perl5/SOAP/Transport/HTTP.pm line 420 SOAP::Transport::HTTP::CGI::handle('Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI=HASH(0x902...') called at /scratch/Svn/mozilla/webtools/bugzilla/xmlrpc.cgi line 32 in SOAP call near ./bz_webservice_demo.pl line 258. No of the previous values returns a trace if omitted? What gives? I think this may actually be an error (omission) in Bugzilla::Bug::REQUIRED_CREATE_FIELDS ? Since this is the first time I do anything that is remotely like a review, I will not grant +. Even though I really want to ;-)
Attachment #244227 - Flags: review?(mbd) → review-
Attached patch v4Splinter Review
Okay, here's a new patch. This one works just fine for me in all my tests. I also noticed that I had forgotten the LOGIN_REQUIRED, and I'd forgotten to send bugmail! :-) So that's fixed here.
Attachment #244227 - Attachment is obsolete: true
Attachment #244357 - Flags: review?(mbd)
Comment on attachment 244357 [details] [diff] [review] v4 This looks good, passes my tests, and should, IMHO, go in.
Attachment #244357 - Flags: review?(mbd) → review+
Flags: approval?
Flags: approval? → approval+
Checking in Bugzilla/Bug.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm new revision: 1.163; previous revision: 1.162 done Checking in Bugzilla/WebService/Bug.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm,v <-- Bug.pm new revision: 1.2; previous revision: 1.1 done Checking in Bugzilla/WebService/Constants.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/WebService/Constants.pm,v <-- Constants.pm new revision: 1.4; previous revision: 1.3 done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Component: Bugzilla-General → WebService
test script: webservice_bug_create.t
Flags: testcase+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: