Adding an extension

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Adding an extension

Terry O'Leary
Hello,

I am attempting to add an extension for our scrum tool (Scrumwise) that has an API and am having issues attempting to add it.

Within the extension.pm, I have added the parameters:

curl https://api.scrumwise.com/service/api/v1/addTask -k
  -u "Bugzilla->user->email:key#here"
  -d "backlogItemID=$bug->scrum ID here"
  -d "name=$bug->summary"
  -d "description==$bug->short_desc"
  -d "index=-1"

After adding the extension, I get the following error when attempting :

syntax error at ./extensions/Scrumwise/Extension.pm line 23, near "curl https:"
Compilation failed in require at Bugzilla/Extension.pm line 68.

Do I need to add curl in the config.pm of the Scrumwise extension?

Thank You,
Terry O'Leary| Software Release Engineering Manager | IT Department | World Travel Holdings | t 617-587-6268 -(internal X76268) | c 339-927-5843 | f 617-587-6359
100 Fordham Rd. Building C | Wilmington | MA | 01887 | AIM: Teeo75 | www.WorldTravelHoldings.com<http://www.WorldTravelHoldings.com>
[wth.gif]

[50Most.gif]



_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

Re: Adding an extension

Gervase Markham
On 02/12/15 14:49, Terry O'Leary wrote:

> Hello,
>
> I am attempting to add an extension for our scrum tool (Scrumwise) that has an API and am having issues attempting to add it.
>
> Within the extension.pm, I have added the parameters:
>
> curl https://api.scrumwise.com/service/api/v1/addTask -k
>   -u "Bugzilla->user->email:key#here"
>   -d "backlogItemID=$bug->scrum ID here"
>   -d "name=$bug->summary"
>   -d "description==$bug->short_desc"
>   -d "index=-1"

You can't put shell-scripting commands in a .pm (Perl) file.

Gerv


_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

RE: Adding an extension

Terry O'Leary
In reply to this post by Terry O'Leary
Adjusting the syntax and then checksetup.pl compiled properly. This is what I used:

my $curl='https://api.scrumwise.com/service/api/v1/addTask -k -u Bugzilla->user->email:key here -d "backlogItemID=$bug->storyID here" -d "name=$bug->summary" -d "description==$bug->short_desc" -d "index=-1"'

Thank You,
Terry O'Leary


-----Original Message-----
From: support-bugzilla [mailto:support-bugzilla-bounces+toleary=[hidden email]] On Behalf Of Thorsten Schöning
Sent: Wednesday, December 02, 2015 10:19 AM
To: [hidden email]
Subject: Re: Adding an extension

Guten Tag Terry O'Leary,
am Mittwoch, 2. Dezember 2015 um 15:49 schrieben Sie:

> syntax error at ./extensions/Scrumwise/Extension.pm line 23, near "curl https:"
> Compilation failed in require at Bugzilla/Extension.pm line 68.

> Do I need to add curl in the config.pm of the Scrumwise extension?

That depends on what you think/want "curl" is, it's no Perl built-in function and therefore can't be called how you tried it. If you have some lib which provides that function by exporting it, you need to "use" it first, if it's a shell command you need to use something like "system".

http://perldoc.perl.org/functions/system.html

Mit freundlichen Grüßen,

Thorsten Schöning

--
Thorsten Schöning       E-Mail: [hidden email]
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|

RE: Adding an extension

Terry O'Leary
Yes and thank you Thorsten for your help. I ended up using LWP with the following example code and was able to pass a new bug to the Scrumwise API:

package Bugzilla::Extension::Scrumwise;
use strict;
use HTTP::Request::Common;
require LWP::UserAgent;
use base qw(Bugzilla::Extension);


# This code for this is in ./extensions/Scrumwise/lib/Util.pm
use Bugzilla::Extension::Scrumwise::Util;

our $VERSION = '0.01';

# See the documentation of Bugzilla::Hook ("perldoc Bugzilla::Hook"
# in the bugzilla directory) for a list of all available hooks.
sub bug_end_of_create {
   my ($self, $args) = @_;
   my $bug = $args->{bug};

        my $user=Bugzilla->user->email;
        my $pass='SSH key';
        my $URL= 'https://api.scrumwise.com/service/api/v1/addTask';
        my $backlogItemID='backlogitem ID';
        my $name='summary';
        my $description='short_desc';
        my $index='-1';

   my $ua = new LWP::UserAgent;
   $ua->timeout(20);

   my $request = POST $URL,
          Content => [
               backlogItemID => $backlogItemID,
               name => $name,
               description => $description,
               index => $index
           ];
   $request->authorization_basic($user, $pass);
   my $response = $ua->request($request);

 }
# sub install_update_db {
#    my ($self, $args) = @_;

__PACKAGE__->NAME;

Thank You,
Terry O'Leary


-----Original Message-----
From: support-bugzilla [mailto:support-bugzilla-bounces+toleary=[hidden email]] On Behalf Of Thorsten Schöning
Sent: Thursday, December 03, 2015 2:24 AM
To: [hidden email]
Subject: Re: Adding an extension

Guten Tag Terry O'Leary,
am Mittwoch, 2. Dezember 2015 um 22:40 schrieben Sie:

> my $curl='https://api.scrumwise.com/service/api/v1/addTask -k -u
> Bugzilla->user->email:key here -d "backlogItemID=$bug->storyID here"
> -d "name=$bug->summary" -d "description==$bug->short_desc" -d "index=-1"'

This creates a simple text string and won't do anything you expect, especially it won't do a request or call the methods like $bug->short_desc. '...' produces text as is, no magic applied. "..."
on the opposite will at least provide string interpolation, but not for object method calls and it won't to a request either, just produces text again.

Mit freundlichen Grüßen,

Thorsten Schöning

--
Thorsten Schöning       E-Mail: [hidden email]
AM-SoFT IT-Systeme      http://www.AM-SoFT.de/

Telefon...........05151-  9468- 55
Fax...............05151-  9468- 88
Mobil..............0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.